Warning, /graphics/okular/core/synctex/patches/04-gcc-specify-printf-format.diff is written in an unsupported language. File is not indexed.

0001 _synctex_error has a printf-like format, so use the proper gcc extensions
0002 to check its arguments (doing nothing for other compilers)
0003 Author: Pino Toscano <pino@kde.org>
0004 
0005 Index: synctex/synctex_parser_utils.h
0006 ===================================================================
0007 --- synctex.orig/synctex_parser_utils.h
0008 +++ synctex/synctex_parser_utils.h
0009 @@ -83,6 +83,12 @@ extern "C" {
0010  #      else
0011  #              define SYNCTEX_ARE_PATH_CHARACTERS_EQUAL(left,right) (toupper(left) != toupper(right))
0012  #      endif
0013 +
0014 +#      ifdef __GNUC__
0015 +#              define SYNCTEX_PRINTF_FORMAT(si, ftc) __attribute__ ((format (printf, si, ftc)))
0016 +#      else
0017 +#              define SYNCTEX_PRINTF_FORMAT(si, ftc)
0018 +#      endif
0019      
0020  /*  This custom malloc functions initializes to 0 the newly allocated memory.
0021   *  There is no bzero function on windows. */
0022 @@ -95,8 +101,8 @@ void _synctex_free(void * ptr);
0023  /*  This is used to log some informational message to the standard error stream.
0024   *  On Windows, the stderr stream is not exposed and another method is used.
0025   *     The return value is the number of characters printed.   */
0026 -    int _synctex_error(const char * reason,...);
0027 -    int _synctex_debug(const char * reason,...);
0028 +    int _synctex_error(const char * reason,...) SYNCTEX_PRINTF_FORMAT(1, 2);
0029 +    int _synctex_debug(const char * reason,...) SYNCTEX_PRINTF_FORMAT(1, 2);
0030  
0031  /*  strip the last extension of the given string, this string is modified!
0032   *  This function depends on the OS because the path separator may differ.
0033 Index: synctex/synctex_parser.c
0034 ===================================================================
0035 --- synctex.orig/synctex_parser.c
0036 +++ synctex/synctex_parser.c
0037 @@ -8148,6 +8148,7 @@ struct synctex_updater_t {
0038      int length;             /*  the number of chars appended */
0039  };
0040  
0041 +static int _synctex_updater_print(synctex_updater_p updater, const char * format, ...) SYNCTEX_PRINTF_FORMAT(2, 3);
0042  static int _synctex_updater_print(synctex_updater_p updater, const char * format, ...) {
0043      int result = 0;
0044      if (updater) {
0045 @@ -8184,6 +8185,7 @@ static int vasprintf(char **ret,
0046  /**
0047   *  gzvprintf is not available until OSX 10.10
0048   */
0049 +static int _synctex_updater_print_gz(synctex_updater_p updater, const char * format, ...) SYNCTEX_PRINTF_FORMAT(2, 3);
0050  static int _synctex_updater_print_gz(synctex_updater_p updater, const char * format, ...) {
0051      int result = 0;
0052      if (updater) {
0053 Index: synctex/synctex_parser_utils.c
0054 ===================================================================
0055 --- synctex.orig/synctex_parser_utils.c
0056 +++ synctex/synctex_parser_utils.c
0057 @@ -87,8 +87,11 @@ void _synctex_free(void * ptr) {
0058  #   include <syslog.h>
0059  #endif
0060  
0061 -int _synctex_log(int level, const char * prompt, const char * reason, va_list arg;) {
0062 +int _synctex_log(int level, const char * prompt, const char * reason, ...) SYNCTEX_PRINTF_FORMAT(3, 4);
0063 +int _synctex_log(int level, const char * prompt, const char * reason, ...) {
0064 +    va_list arg;
0065         int result;
0066 +    va_start(arg, reason);
0067  #      ifdef SYNCTEX_RECENT_WINDOWS
0068         {/*     This code is contributed by William Blum.
0069          As it does not work on some older computers,
0070 @@ -130,6 +133,7 @@ int _synctex_log(int level, const char *
0071      result += vfprintf(where, reason, arg);
0072      result += fprintf(where,"\n");
0073  #   endif
0074 +    va_end(arg);
0075         return result;
0076  }
0077