Skip to content

Commit 827b165

Browse files
committed
patch 7.4.1819
Problem: Compiler warnings when sprintf() is a macro. Solution: Don't interrupt sprintf() with an #ifdef. (Michael Jarvis, closes #788)
1 parent 89c79b9 commit 827b165

4 files changed

Lines changed: 20 additions & 16 deletions

File tree

src/fileio.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5230,14 +5230,14 @@ msg_add_lines(
52305230
if (insert_space)
52315231
*p++ = ' ';
52325232
if (shortmess(SHM_LINES))
5233-
sprintf((char *)p,
52345233
#ifdef LONG_LONG_OFF_T
5235-
"%ldL, %lldC", lnum, (long long)nchars
5234+
sprintf((char *)p,
5235+
"%ldL, %lldC", lnum, (long long)nchars);
52365236
#else
5237+
sprintf((char *)p,
52375238
/* Explicit typecast avoids warning on Mac OS X 10.6 */
5238-
"%ldL, %ldC", lnum, (long)nchars
5239+
"%ldL, %ldC", lnum, (long)nchars);
52395240
#endif
5240-
);
52415241
else
52425242
{
52435243
if (lnum == 1)
@@ -5248,14 +5248,14 @@ msg_add_lines(
52485248
if (nchars == 1)
52495249
STRCPY(p, _("1 character"));
52505250
else
5251-
sprintf((char *)p,
52525251
#ifdef LONG_LONG_OFF_T
5253-
_("%lld characters"), (long long)nchars
5252+
sprintf((char *)p,
5253+
_("%lld characters"), (long long)nchars);
52545254
#else
5255+
sprintf((char *)p,
52555256
/* Explicit typecast avoids warning on Mac OS X 10.6 */
5256-
_("%ld characters"), (long)nchars
5257+
_("%ld characters"), (long)nchars);
52575258
#endif
5258-
);
52595259
}
52605260
}
52615261

src/tag.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,6 +2264,7 @@ find_tags(
22642264
if (ga_grow(&ga_match[mtt], 1) == OK)
22652265
{
22662266
int len;
2267+
int heuristic;
22672268

22682269
if (help_only)
22692270
{
@@ -2293,13 +2294,14 @@ find_tags(
22932294
p[len] = '@';
22942295
STRCPY(p + len + 1, help_lang);
22952296
#endif
2296-
sprintf((char *)p + len + 1 + ML_EXTRA, "%06d",
2297-
help_heuristic(tagp.tagname,
2298-
match_re ? matchoff : 0, !match_no_ic)
2297+
2298+
heuristic = help_heuristic(tagp.tagname,
2299+
match_re ? matchoff : 0, !match_no_ic);
22992300
#ifdef FEAT_MULTI_LANG
2300-
+ help_pri
2301+
heuristic += help_pri;
23012302
#endif
2302-
);
2303+
sprintf((char *)p + len + 1 + ML_EXTRA, "%06d",
2304+
heuristic);
23032305
}
23042306
*tagp.tagname_end = TAB;
23052307
}

src/term.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,12 +2630,12 @@ term_color(char_u *s, int n)
26302630
|| STRCMP(s + i + 1, "%dm") == 0)
26312631
&& (s[i] == '3' || s[i] == '4'))
26322632
{
2633-
sprintf(buf,
26342633
#ifdef TERMINFO
2635-
"%s%s%%p1%%dm",
2634+
char *format = "%s%s%%p1%%dm";
26362635
#else
2637-
"%s%s%%dm",
2636+
char *format = "%s%s%%dm";
26382637
#endif
2638+
sprintf(buf, format,
26392639
i == 2 ? IF_EB("\033[", ESC_STR "[") : "\233",
26402640
s[i] == '3' ? (n >= 16 ? "38;5;" : "9")
26412641
: (n >= 16 ? "48;5;" : "10"));

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,8 @@ static char *(features[]) =
753753

754754
static int included_patches[] =
755755
{ /* Add new patch number below this line */
756+
/**/
757+
1819,
756758
/**/
757759
1818,
758760
/**/

0 commit comments

Comments
 (0)