From: Yasuhiro Matsumoto Date: Thu, 19 Feb 2026 16:55:39 +0000 (+0000) Subject: patch 9.2.0029: STRLEN() used for a string literal X-Git-Tag: v9.2.0029^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d673411ff2a9e1e7e371b3541f72f7bb01018ebe;p=thirdparty%2Fvim.git patch 9.2.0029: STRLEN() used for a string literal Problem: STRLEN() used for a string literal Solution: Use STRLEN_LITERAL instead (Yasuhiro Matsumoto). closes: #19450 Signed-off-by: Yasuhiro Matsumoto Signed-off-by: Christian Brabandt --- diff --git a/src/channel.c b/src/channel.c index a1c9bb7a91..abe9bddca9 100644 --- a/src/channel.c +++ b/src/channel.c @@ -3756,7 +3756,7 @@ ch_close_part_on_error( // Only send "DETACH" for a netbeans channel. if (channel->ch_nb_close_cb != NULL) channel_save(channel, PART_SOCK, (char_u *)DETACH_MSG_RAW, - (int)STRLEN(DETACH_MSG_RAW), FALSE, "PUT "); + (int)STRLEN_LITERAL(DETACH_MSG_RAW), FALSE, "PUT "); // When reading is not possible close this part of the channel. Don't // close the channel yet, there may be something to read on another part. diff --git a/src/gui_w32.c b/src/gui_w32.c index 3c5178067a..4b8b5f83dc 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -8185,7 +8185,7 @@ gui_mch_tearoff( if (submenuWidth != 0) { submenuWidth = GetTextWidth(hdc, (char_u *)TEAROFF_SUBMENU_LABEL, - (int)STRLEN(TEAROFF_SUBMENU_LABEL)); + (int)STRLEN_LITERAL(TEAROFF_SUBMENU_LABEL)); textWidth += submenuWidth; } dlgwidth = GetTextWidthEnc(hdc, title, (int)STRLEN(title)); @@ -8308,7 +8308,7 @@ gui_mch_tearoff( } else { - len += (int)STRLEN(TEAROFF_SUBMENU_LABEL); + len += (int)STRLEN_LITERAL(TEAROFF_SUBMENU_LABEL); menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); } @@ -8333,7 +8333,7 @@ gui_mch_tearoff( if (menu->children != NULL) { STRCPY(text, TEAROFF_SUBMENU_LABEL); - text += STRLEN(TEAROFF_SUBMENU_LABEL); + text += STRLEN_LITERAL(TEAROFF_SUBMENU_LABEL); } else { diff --git a/src/hardcopy.c b/src/hardcopy.c index 99a991dc2d..5333116049 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -1857,7 +1857,7 @@ prt_open_resource(struct prt_ps_resource_S *resource) offset = 0; if (prt_resfile_strncmp(offset, PRT_RESOURCE_HEADER, - (int)STRLEN(PRT_RESOURCE_HEADER)) != 0) + (int)STRLEN_LITERAL(PRT_RESOURCE_HEADER)) != 0) { semsg(_(e_file_str_is_not_postscript_resource_file), resource->filename); @@ -1865,7 +1865,7 @@ prt_open_resource(struct prt_ps_resource_S *resource) } // Skip over any version numbers and following ws - offset += (int)STRLEN(PRT_RESOURCE_HEADER); + offset += (int)STRLEN_LITERAL(PRT_RESOURCE_HEADER); offset = prt_resfile_skip_nonws(offset); if (offset == -1) return FALSE; @@ -1874,23 +1874,23 @@ prt_open_resource(struct prt_ps_resource_S *resource) return FALSE; if (prt_resfile_strncmp(offset, PRT_RESOURCE_RESOURCE, - (int)STRLEN(PRT_RESOURCE_RESOURCE)) != 0) + (int)STRLEN_LITERAL(PRT_RESOURCE_RESOURCE)) != 0) { semsg(_(e_file_str_is_not_supported_postscript_resource_file), resource->filename); return FALSE; } - offset += (int)STRLEN(PRT_RESOURCE_RESOURCE); + offset += (int)STRLEN_LITERAL(PRT_RESOURCE_RESOURCE); // Decide type of resource in the file if (prt_resfile_strncmp(offset, PRT_RESOURCE_PROCSET, - (int)STRLEN(PRT_RESOURCE_PROCSET)) == 0) + (int)STRLEN_LITERAL(PRT_RESOURCE_PROCSET)) == 0) resource->type = PRT_RESOURCE_TYPE_PROCSET; else if (prt_resfile_strncmp(offset, PRT_RESOURCE_ENCODING, - (int)STRLEN(PRT_RESOURCE_ENCODING)) == 0) + (int)STRLEN_LITERAL(PRT_RESOURCE_ENCODING)) == 0) resource->type = PRT_RESOURCE_TYPE_ENCODING; else if (prt_resfile_strncmp(offset, PRT_RESOURCE_CMAP, - (int)STRLEN(PRT_RESOURCE_CMAP)) == 0) + (int)STRLEN_LITERAL(PRT_RESOURCE_CMAP)) == 0) resource->type = PRT_RESOURCE_TYPE_CMAP; else { diff --git a/src/if_cscope.c b/src/if_cscope.c index e23d78d97f..5c8f9ff477 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -583,7 +583,7 @@ staterr: // if filename is a directory, append the cscope database name to it if (S_ISDIR(statbuf.st_mode)) { - fname2 = alloc(strlen(CSCOPE_DBFILE) + strlen(fname) + 2); + fname2 = alloc(STRLEN_LITERAL(CSCOPE_DBFILE) + strlen(fname) + 2); if (fname2 == NULL) goto add_err; @@ -2166,7 +2166,7 @@ cs_read_prompt(int i) } } - for (n = 0; n < (int)strlen(CSCOPE_PROMPT); ++n) + for (n = 0; n < (int)STRLEN_LITERAL(CSCOPE_PROMPT); ++n) { if (n > 0) ch = getc(csinfo[i].fr_fp); diff --git a/src/if_xcmdsrv.c b/src/if_xcmdsrv.c index da64aa0e54..b4736b3fb2 100644 --- a/src/if_xcmdsrv.c +++ b/src/if_xcmdsrv.c @@ -881,7 +881,7 @@ SendInit(Display *dpy) // Make window recognizable as a vim window XChangeProperty(dpy, commWindow, vimProperty, XA_STRING, 8, PropModeReplace, (char_u *)VIM_VERSION_SHORT, - (int)STRLEN(VIM_VERSION_SHORT) + 1); + (int)STRLEN_LITERAL(VIM_VERSION_SHORT) + 1); XSync(dpy, False); (void)XSetErrorHandler(old_handler); diff --git a/src/version.c b/src/version.c index 84a2a8e695..66e7169c3e 100644 --- a/src/version.c +++ b/src/version.c @@ -67,8 +67,8 @@ init_longVersion(void) # endif char *msg = _("%s (%s, compiled %s)"); size_t len = strlen(msg) - + strlen(VIM_VERSION_LONG_ONLY) - + strlen(VIM_VERSION_DATE_ONLY) + + STRLEN_LITERAL(VIM_VERSION_LONG_ONLY) + + STRLEN_LITERAL(VIM_VERSION_DATE_ONLY) + strlen(date_time); longVersion = alloc(len); @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 29, /**/ 28, /**/