On Wed, 15 Jan 2025, 'John Marriott' via vim_dev wrote:
> > On 15-Jan-2025 03:45, Christian Brabandt wrote: > > patch 9.1.1016: Not possible to convert string2blob and blob2string > > > > Commit:https://github.com/vim/vim/commit/1aefe1de0b20fe4966863e07efa14b6aa87323ee > > Author: Yegappan Lakshmanan<yegap...@yahoo.com> > > Date: Tue Jan 14 17:29:42 2025 +0100 > > > > patch 9.1.1016: Not possible to convert string2blob and blob2string > > Problem: Not possible to convert string2blob and blob2string > > Solution: add support for the blob2str() and str2blob() functions > > closes: #16373 > > Signed-off-by: Yegappan Lakshmanan<yegap...@yahoo.com> > > Signed-off-by: Christian Brabandt<c...@256bit.org> > > > > > After this patch, clang (v19.1.16) on Win11 Pro throws this linker error if > FEAT_SPELL is not defined (same for non-GUI build): > <snip> > clang -I. -Iproto -DWIN32 -DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00 [...] > -Wl,-Bdynamic -lole32 -luuid > E:/msys64/ucrt64/bin/ld: gobjx86-64/strings.o:strings.c:(.text+0x1dd3): > undefined reference to `utf_valid_string' > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > make: *** [Make_cyg_ming.mak:1170: gvim.exe] Error 1 > </snip> > > I'm not 100% certain of the correct fix, but the attached diff at least > means it will compile.😉 > > Cheers > John > > --- strings.c.20250115-074230 2025-01-15 07:42:30 +0000 > +++ strings.c 2025-01-15 08:11:44 +0000 > @@ -1286,6 +1286,7 @@ > } > } > > +#if defined(FEAT_GUI_GTK) || defined(FEAT_SPELL) || defined(PROTO) > if (STRCMP(p_enc, "utf-8") == 0 || STRCMP(p_enc, "utf8") == 0) > { > if (!utf_valid_string(p, NULL)) > @@ -1295,6 +1296,7 @@ > return; > } > } > +#endif > > rettv->vval.v_string = p; > } That seems to return a potential invalid string however. I wonder what is the reason for the #ifdefs in `utf_valid_string()` at all? It seems this patch would be better, no? ``` diff --git a/src/mbyte.c b/src/mbyte.c index 157018266..a8819d992 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -4355,7 +4355,6 @@ theend: convert_setup(&vimconv, NULL, NULL); } -#if defined(FEAT_GUI_GTK) || defined(FEAT_SPELL) || defined(PROTO) /* * Return TRUE if string "s" is a valid utf-8 string. * When "end" is NULL stop at the first NUL. Otherwise stop at "end". @@ -4380,7 +4379,6 @@ utf_valid_string(char_u *s, char_u *end) } return TRUE; } -#endif #if defined(FEAT_GUI) || defined(PROTO) /* ``` Thanks, Christian -- Halley's Comet: It came, we saw, we drank. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/Z4pAe5geojjk3gp0%40256bit.org.