]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0029: STRLEN() used for a string literal v9.2.0029
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Thu, 19 Feb 2026 16:55:39 +0000 (16:55 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 19 Feb 2026 16:55:39 +0000 (16:55 +0000)
Problem:  STRLEN() used for a string literal
Solution: Use STRLEN_LITERAL instead (Yasuhiro Matsumoto).

closes: #19450

Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/channel.c
src/gui_w32.c
src/hardcopy.c
src/if_cscope.c
src/if_xcmdsrv.c
src/version.c

index a1c9bb7a91b26e7ccb62ab0f1b90d528cac25af8..abe9bddca9466aa9d855dd00c4fd8febbc22bca7 100644 (file)
@@ -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.
index 3c5178067a10d95b3e69a9aa324dfeef90f02ad6..4b8b5f83dc694986e0e62dab5bf24928f201debc 100644 (file)
@@ -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
        {
index 99a991dc2d1ace85cd652e70cc71ae82f682a218..5333116049557fbbc64067ded4d86880052984d2 100644 (file)
@@ -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
     {
index e23d78d97ff95b16f82e13052d39c0748bdc72ae..5c8f9ff4770f4499857157a9a2d7b1611ad95d39 100644 (file)
@@ -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);
index da64aa0e5439d758c23bc5a3f4a798ab1e8571cc..b4736b3fb2a28545d2a02c12e8c22399f06f4baf 100644 (file)
@@ -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);
index 84a2a8e69535a36c0efe614f08e29b8fbd3c5cd2..66e7169c3e469f5c4e5fc373a6a0967a9fc8e165 100644 (file)
@@ -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,
 /**/