To: vim_dev@googlegroups.com Subject: Patch 7.4.1819 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1819 Problem: Compiler warnings when sprintf() is a macro. Solution: Don't interrupt sprintf() with an #ifdef. (Michael Jarvis, closes #788) Files: src/fileio.c, src/tag.c, src/term.c *** ../vim-7.4.1818/src/fileio.c 2016-04-20 12:49:43.518961695 +0200 --- src/fileio.c 2016-05-05 18:06:03.284933558 +0200 *************** *** 5230,5243 **** if (insert_space) *p++ = ' '; if (shortmess(SHM_LINES)) - sprintf((char *)p, #ifdef LONG_LONG_OFF_T ! "%ldL, %lldC", lnum, (long long)nchars #else /* Explicit typecast avoids warning on Mac OS X 10.6 */ ! "%ldL, %ldC", lnum, (long)nchars #endif - ); else { if (lnum == 1) --- 5230,5243 ---- if (insert_space) *p++ = ' '; if (shortmess(SHM_LINES)) #ifdef LONG_LONG_OFF_T ! sprintf((char *)p, ! "%ldL, %lldC", lnum, (long long)nchars); #else + sprintf((char *)p, /* Explicit typecast avoids warning on Mac OS X 10.6 */ ! "%ldL, %ldC", lnum, (long)nchars); #endif else { if (lnum == 1) *************** *** 5248,5261 **** if (nchars == 1) STRCPY(p, _("1 character")); else - sprintf((char *)p, #ifdef LONG_LONG_OFF_T ! _("%lld characters"), (long long)nchars #else /* Explicit typecast avoids warning on Mac OS X 10.6 */ ! _("%ld characters"), (long)nchars #endif - ); } } --- 5248,5261 ---- if (nchars == 1) STRCPY(p, _("1 character")); else #ifdef LONG_LONG_OFF_T ! sprintf((char *)p, ! _("%lld characters"), (long long)nchars); #else + sprintf((char *)p, /* Explicit typecast avoids warning on Mac OS X 10.6 */ ! _("%ld characters"), (long)nchars); #endif } } *** ../vim-7.4.1818/src/tag.c 2016-04-18 19:45:13.463066926 +0200 --- src/tag.c 2016-05-05 18:09:27.254809026 +0200 *************** *** 2264,2269 **** --- 2264,2270 ---- if (ga_grow(&ga_match[mtt], 1) == OK) { int len; + int heuristic; if (help_only) { *************** *** 2293,2305 **** p[len] = '@'; STRCPY(p + len + 1, help_lang); #endif ! sprintf((char *)p + len + 1 + ML_EXTRA, "%06d", ! help_heuristic(tagp.tagname, ! match_re ? matchoff : 0, !match_no_ic) #ifdef FEAT_MULTI_LANG ! + help_pri #endif ! ); } *tagp.tagname_end = TAB; } --- 2294,2307 ---- p[len] = '@'; STRCPY(p + len + 1, help_lang); #endif ! ! heuristic = help_heuristic(tagp.tagname, ! match_re ? matchoff : 0, !match_no_ic); #ifdef FEAT_MULTI_LANG ! heuristic += help_pri; #endif ! sprintf((char *)p + len + 1 + ML_EXTRA, "%06d", ! heuristic); } *tagp.tagname_end = TAB; } *** ../vim-7.4.1818/src/term.c 2016-04-29 22:58:25.626876587 +0200 --- src/term.c 2016-05-05 18:11:31.709542849 +0200 *************** *** 2630,2641 **** || STRCMP(s + i + 1, "%dm") == 0) && (s[i] == '3' || s[i] == '4')) { - sprintf(buf, #ifdef TERMINFO ! "%s%s%%p1%%dm", #else ! "%s%s%%dm", #endif i == 2 ? IF_EB("\033[", ESC_STR "[") : "\233", s[i] == '3' ? (n >= 16 ? "38;5;" : "9") : (n >= 16 ? "48;5;" : "10")); --- 2630,2641 ---- || STRCMP(s + i + 1, "%dm") == 0) && (s[i] == '3' || s[i] == '4')) { #ifdef TERMINFO ! char *format = "%s%s%%p1%%dm"; #else ! char *format = "%s%s%%dm"; #endif + sprintf(buf, format, i == 2 ? IF_EB("\033[", ESC_STR "[") : "\233", s[i] == '3' ? (n >= 16 ? "38;5;" : "9") : (n >= 16 ? "48;5;" : "10")); *** ../vim-7.4.1818/src/version.c 2016-05-05 17:18:36.963948500 +0200 --- src/version.c 2016-05-05 18:12:10.129151221 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1819, /**/ -- NEIL INNES PLAYED: THE FIRST SELF-DESTRUCTIVE MONK, ROBIN'S LEAST FAVORITE MINSTREL, THE PAGE CRUSHED BY A RABBIT, THE OWNER OF A DUCK "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///