okular/core/synctex/patches/04-gcc-specify-printf-format.diff

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

78 lines
3.2 KiB
Diff
Raw Normal View History

Update to synctex 1.19 Summary: This should prevent crashes when reloading some synctex-enabled pdf files created with newer versions of TeXLive. We also gain bugfixes, features and improved accuracy from the last 6 years of synctex development. Procedure followed: - svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir - Check out revision 45150 - Update files present in core/synctex/* - Adapt Okular code to changes - Review and drop or update/apply old patches using quilt - Create missing patches for local synctex changes - New patch: Omit warning message when opening non-synctex pdf - Two new patches to fix more compiler warnings - New patch: Plug multiple leaks and prevent a segfault TODO for later: - Move sync file detection code to Okular to never call into synctex C code for non-synctex files - Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library BUG: 383915 FIXED-IN: 17.12.0 Test Plan: - No crash in synctex on reloading empty.pdf from bugreport anymore. - Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line. - Forward and backward search in Kile seems to work. - Works with synctex files from both TeXLive 2015 and 2017. - PartTest::testForwardPDF still passes. - No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular. Reviewers: #okular, sander, #kile, aacid Reviewed By: #okular, aacid Subscribers: mludwig, aacid Tags: #okular Differential Revision: https://phabricator.kde.org/D7594
2017-08-28 22:29:46 +00:00
_synctex_error has a printf-like format, so use the proper gcc extensions
to check its arguments (doing nothing for other compilers)
Author: Pino Toscano <pino@kde.org>
Index: synctex/synctex_parser_utils.h
===================================================================
--- synctex.orig/synctex_parser_utils.h
+++ synctex/synctex_parser_utils.h
@@ -83,6 +83,12 @@ extern "C" {
# else
Update to synctex 1.19 Summary: This should prevent crashes when reloading some synctex-enabled pdf files created with newer versions of TeXLive. We also gain bugfixes, features and improved accuracy from the last 6 years of synctex development. Procedure followed: - svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir - Check out revision 45150 - Update files present in core/synctex/* - Adapt Okular code to changes - Review and drop or update/apply old patches using quilt - Create missing patches for local synctex changes - New patch: Omit warning message when opening non-synctex pdf - Two new patches to fix more compiler warnings - New patch: Plug multiple leaks and prevent a segfault TODO for later: - Move sync file detection code to Okular to never call into synctex C code for non-synctex files - Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library BUG: 383915 FIXED-IN: 17.12.0 Test Plan: - No crash in synctex on reloading empty.pdf from bugreport anymore. - Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line. - Forward and backward search in Kile seems to work. - Works with synctex files from both TeXLive 2015 and 2017. - PartTest::testForwardPDF still passes. - No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular. Reviewers: #okular, sander, #kile, aacid Reviewed By: #okular, aacid Subscribers: mludwig, aacid Tags: #okular Differential Revision: https://phabricator.kde.org/D7594
2017-08-28 22:29:46 +00:00
# define SYNCTEX_ARE_PATH_CHARACTERS_EQUAL(left,right) (toupper(left) != toupper(right))
# endif
+
+# ifdef __GNUC__
+# define SYNCTEX_PRINTF_FORMAT(si, ftc) __attribute__ ((format (printf, si, ftc)))
+# else
+# define SYNCTEX_PRINTF_FORMAT(si, ftc)
+# endif
Update to synctex 1.19 Summary: This should prevent crashes when reloading some synctex-enabled pdf files created with newer versions of TeXLive. We also gain bugfixes, features and improved accuracy from the last 6 years of synctex development. Procedure followed: - svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir - Check out revision 45150 - Update files present in core/synctex/* - Adapt Okular code to changes - Review and drop or update/apply old patches using quilt - Create missing patches for local synctex changes - New patch: Omit warning message when opening non-synctex pdf - Two new patches to fix more compiler warnings - New patch: Plug multiple leaks and prevent a segfault TODO for later: - Move sync file detection code to Okular to never call into synctex C code for non-synctex files - Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library BUG: 383915 FIXED-IN: 17.12.0 Test Plan: - No crash in synctex on reloading empty.pdf from bugreport anymore. - Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line. - Forward and backward search in Kile seems to work. - Works with synctex files from both TeXLive 2015 and 2017. - PartTest::testForwardPDF still passes. - No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular. Reviewers: #okular, sander, #kile, aacid Reviewed By: #okular, aacid Subscribers: mludwig, aacid Tags: #okular Differential Revision: https://phabricator.kde.org/D7594
2017-08-28 22:29:46 +00:00
/* This custom malloc functions initializes to 0 the newly allocated memory.
* There is no bzero function on windows. */
Update to synctex 1.19 Summary: This should prevent crashes when reloading some synctex-enabled pdf files created with newer versions of TeXLive. We also gain bugfixes, features and improved accuracy from the last 6 years of synctex development. Procedure followed: - svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir - Check out revision 45150 - Update files present in core/synctex/* - Adapt Okular code to changes - Review and drop or update/apply old patches using quilt - Create missing patches for local synctex changes - New patch: Omit warning message when opening non-synctex pdf - Two new patches to fix more compiler warnings - New patch: Plug multiple leaks and prevent a segfault TODO for later: - Move sync file detection code to Okular to never call into synctex C code for non-synctex files - Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library BUG: 383915 FIXED-IN: 17.12.0 Test Plan: - No crash in synctex on reloading empty.pdf from bugreport anymore. - Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line. - Forward and backward search in Kile seems to work. - Works with synctex files from both TeXLive 2015 and 2017. - PartTest::testForwardPDF still passes. - No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular. Reviewers: #okular, sander, #kile, aacid Reviewed By: #okular, aacid Subscribers: mludwig, aacid Tags: #okular Differential Revision: https://phabricator.kde.org/D7594
2017-08-28 22:29:46 +00:00
@@ -95,8 +101,8 @@ void _synctex_free(void * ptr);
/* This is used to log some informational message to the standard error stream.
* On Windows, the stderr stream is not exposed and another method is used.
* The return value is the number of characters printed. */
Update to synctex 1.19 Summary: This should prevent crashes when reloading some synctex-enabled pdf files created with newer versions of TeXLive. We also gain bugfixes, features and improved accuracy from the last 6 years of synctex development. Procedure followed: - svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir - Check out revision 45150 - Update files present in core/synctex/* - Adapt Okular code to changes - Review and drop or update/apply old patches using quilt - Create missing patches for local synctex changes - New patch: Omit warning message when opening non-synctex pdf - Two new patches to fix more compiler warnings - New patch: Plug multiple leaks and prevent a segfault TODO for later: - Move sync file detection code to Okular to never call into synctex C code for non-synctex files - Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library BUG: 383915 FIXED-IN: 17.12.0 Test Plan: - No crash in synctex on reloading empty.pdf from bugreport anymore. - Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line. - Forward and backward search in Kile seems to work. - Works with synctex files from both TeXLive 2015 and 2017. - PartTest::testForwardPDF still passes. - No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular. Reviewers: #okular, sander, #kile, aacid Reviewed By: #okular, aacid Subscribers: mludwig, aacid Tags: #okular Differential Revision: https://phabricator.kde.org/D7594
2017-08-28 22:29:46 +00:00
- int _synctex_error(const char * reason,...);
- int _synctex_debug(const char * reason,...);
+ int _synctex_error(const char * reason,...) SYNCTEX_PRINTF_FORMAT(1, 2);
+ int _synctex_debug(const char * reason,...) SYNCTEX_PRINTF_FORMAT(1, 2);
/* strip the last extension of the given string, this string is modified!
* This function depends on the OS because the path separator may differ.
Update to synctex 1.19 Summary: This should prevent crashes when reloading some synctex-enabled pdf files created with newer versions of TeXLive. We also gain bugfixes, features and improved accuracy from the last 6 years of synctex development. Procedure followed: - svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir - Check out revision 45150 - Update files present in core/synctex/* - Adapt Okular code to changes - Review and drop or update/apply old patches using quilt - Create missing patches for local synctex changes - New patch: Omit warning message when opening non-synctex pdf - Two new patches to fix more compiler warnings - New patch: Plug multiple leaks and prevent a segfault TODO for later: - Move sync file detection code to Okular to never call into synctex C code for non-synctex files - Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library BUG: 383915 FIXED-IN: 17.12.0 Test Plan: - No crash in synctex on reloading empty.pdf from bugreport anymore. - Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line. - Forward and backward search in Kile seems to work. - Works with synctex files from both TeXLive 2015 and 2017. - PartTest::testForwardPDF still passes. - No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular. Reviewers: #okular, sander, #kile, aacid Reviewed By: #okular, aacid Subscribers: mludwig, aacid Tags: #okular Differential Revision: https://phabricator.kde.org/D7594
2017-08-28 22:29:46 +00:00
Index: synctex/synctex_parser.c
===================================================================
--- synctex.orig/synctex_parser.c
+++ synctex/synctex_parser.c
@@ -8148,6 +8148,7 @@ struct synctex_updater_t {
int length; /* the number of chars appended */
};
+static int _synctex_updater_print(synctex_updater_p updater, const char * format, ...) SYNCTEX_PRINTF_FORMAT(2, 3);
static int _synctex_updater_print(synctex_updater_p updater, const char * format, ...) {
int result = 0;
if (updater) {
@@ -8184,6 +8185,7 @@ static int vasprintf(char **ret,
/**
* gzvprintf is not available until OSX 10.10
*/
+static int _synctex_updater_print_gz(synctex_updater_p updater, const char * format, ...) SYNCTEX_PRINTF_FORMAT(2, 3);
static int _synctex_updater_print_gz(synctex_updater_p updater, const char * format, ...) {
int result = 0;
if (updater) {
Index: synctex/synctex_parser_utils.c
===================================================================
--- synctex.orig/synctex_parser_utils.c
+++ synctex/synctex_parser_utils.c
@@ -87,8 +87,11 @@ void _synctex_free(void * ptr) {
Update to synctex 1.19 Summary: This should prevent crashes when reloading some synctex-enabled pdf files created with newer versions of TeXLive. We also gain bugfixes, features and improved accuracy from the last 6 years of synctex development. Procedure followed: - svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir - Check out revision 45150 - Update files present in core/synctex/* - Adapt Okular code to changes - Review and drop or update/apply old patches using quilt - Create missing patches for local synctex changes - New patch: Omit warning message when opening non-synctex pdf - Two new patches to fix more compiler warnings - New patch: Plug multiple leaks and prevent a segfault TODO for later: - Move sync file detection code to Okular to never call into synctex C code for non-synctex files - Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library BUG: 383915 FIXED-IN: 17.12.0 Test Plan: - No crash in synctex on reloading empty.pdf from bugreport anymore. - Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line. - Forward and backward search in Kile seems to work. - Works with synctex files from both TeXLive 2015 and 2017. - PartTest::testForwardPDF still passes. - No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular. Reviewers: #okular, sander, #kile, aacid Reviewed By: #okular, aacid Subscribers: mludwig, aacid Tags: #okular Differential Revision: https://phabricator.kde.org/D7594
2017-08-28 22:29:46 +00:00
# include <syslog.h>
#endif
-int _synctex_log(int level, const char * prompt, const char * reason, va_list arg;) {
+int _synctex_log(int level, const char * prompt, const char * reason, ...) SYNCTEX_PRINTF_FORMAT(3, 4);
+int _synctex_log(int level, const char * prompt, const char * reason, ...) {
+ va_list arg;
int result;
+ va_start(arg, reason);
Update to synctex 1.19 Summary: This should prevent crashes when reloading some synctex-enabled pdf files created with newer versions of TeXLive. We also gain bugfixes, features and improved accuracy from the last 6 years of synctex development. Procedure followed: - svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir - Check out revision 45150 - Update files present in core/synctex/* - Adapt Okular code to changes - Review and drop or update/apply old patches using quilt - Create missing patches for local synctex changes - New patch: Omit warning message when opening non-synctex pdf - Two new patches to fix more compiler warnings - New patch: Plug multiple leaks and prevent a segfault TODO for later: - Move sync file detection code to Okular to never call into synctex C code for non-synctex files - Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library BUG: 383915 FIXED-IN: 17.12.0 Test Plan: - No crash in synctex on reloading empty.pdf from bugreport anymore. - Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line. - Forward and backward search in Kile seems to work. - Works with synctex files from both TeXLive 2015 and 2017. - PartTest::testForwardPDF still passes. - No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular. Reviewers: #okular, sander, #kile, aacid Reviewed By: #okular, aacid Subscribers: mludwig, aacid Tags: #okular Differential Revision: https://phabricator.kde.org/D7594
2017-08-28 22:29:46 +00:00
# ifdef SYNCTEX_RECENT_WINDOWS
{/* This code is contributed by William Blum.
As it does not work on some older computers,
@@ -130,6 +133,7 @@ int _synctex_log(int level, const char *
result += vfprintf(where, reason, arg);
result += fprintf(where,"\n");
# endif
+ va_end(arg);
return result;
}