Skip to content

Commit c85c8fc

Browse files
committed
patch 8.1.0944: format of nbdbg() arguments is not checked
Problem: Format of nbdbg() arguments is not checked. Solution: Add format attribute. Fix reported problems. (Dominique Pelle, closes #3992)
1 parent 749f07c commit c85c8fc

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/nbdebug.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ typedef enum {
4242
} WtWait;
4343

4444

45-
void nbdbg(char *, ...);
45+
void nbdbg(char *, ...)
46+
#ifdef USE_PRINTF_FORMAT_ATTRIBUTE
47+
__attribute__((format(printf, 1, 2)))
48+
#endif
49+
;
4650

4751
void nbdebug_wait(u_int wait_flags, char *wait_var, u_int wait_secs);
4852
void nbdebug_log_init(char *log_var, char *level_var);

src/netbeans.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ nb_partialremove(linenr_T lnum, colnr_T first, colnr_T last)
934934
{
935935
mch_memmove(newtext, oldtext, first);
936936
STRMOVE(newtext + first, oldtext + lastbyte + 1);
937-
nbdebug((" NEW LINE %d: %s\n", lnum, newtext));
937+
nbdebug((" NEW LINE %ld: %s\n", lnum, newtext));
938938
ml_replace(lnum, newtext, FALSE);
939939
}
940940
}
@@ -1166,7 +1166,7 @@ nb_do_cmd(
11661166
return FAIL;
11671167
}
11681168
first = *pos;
1169-
nbdebug((" FIRST POS: line %d, col %d\n",
1169+
nbdebug((" FIRST POS: line %ld, col %d\n",
11701170
first.lnum, first.col));
11711171
pos = off2pos(buf->bufp, off+count-1);
11721172
if (!pos)
@@ -1178,7 +1178,7 @@ nb_do_cmd(
11781178
return FAIL;
11791179
}
11801180
last = *pos;
1181-
nbdebug((" LAST POS: line %d, col %d\n",
1181+
nbdebug((" LAST POS: line %ld, col %d\n",
11821182
last.lnum, last.col));
11831183
del_from_lnum = first.lnum;
11841184
del_to_lnum = last.lnum;
@@ -1264,7 +1264,7 @@ nb_do_cmd(
12641264
}
12651265
}
12661266

1267-
nbdebug((" Deleting lines %d through %d\n",
1267+
nbdebug((" Deleting lines %ld through %ld\n",
12681268
del_from_lnum, del_to_lnum));
12691269
curwin->w_cursor.lnum = del_from_lnum;
12701270
curwin->w_cursor.col = 0;
@@ -1540,7 +1540,7 @@ nb_do_cmd(
15401540
{
15411541
if (!buf->bufp->b_netbeans_file)
15421542
{
1543-
nbdebug(("E658: NetBeans connection lost for buffer %ld\n", buf->bufp->b_fnum));
1543+
nbdebug(("E658: NetBeans connection lost for buffer %d\n", buf->bufp->b_fnum));
15441544
semsg(_("E658: NetBeans connection lost for buffer %d"),
15451545
buf->bufp->b_fnum);
15461546
}

src/version.c

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

780780
static int included_patches[] =
781781
{ /* Add new patch number below this line */
782+
/**/
783+
944,
782784
/**/
783785
943,
784786
/**/

0 commit comments

Comments
 (0)