From: Christian Brabandt Date: Sat, 13 Jun 2026 14:41:35 +0000 (+0000) Subject: patch 9.2.0625: GTK4: Link error when Wayland is disabled X-Git-Tag: v9.2.0625^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6fe4d8614e22eb4158a21e68b16ae02e7e7fa395;p=thirdparty%2Fvim.git patch 9.2.0625: GTK4: Link error when Wayland is disabled Problem: GTK4: Link error when Wayland is disabled (chdiza) Solution: Adjust ifdefs for clip_convert_data() fixes: #20488 Signed-off-by: Christian Brabandt --- diff --git a/src/clipboard.c b/src/clipboard.c index 243625047d..5ac185cb53 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -2574,72 +2574,6 @@ clip_reset_wayland(void) return OK; } -/* - * If "vim" is TRUE, then get the motion type. If "vimenc" is TRUE, then get the - * motion type and also convert "*buf". "buf" and "len_store" will be updated to - * reflect the actual contents, but should be set beforehand with the initial - * contents. Returns OK on success and FAIL on failure. - */ - int -clip_convert_data( - char_u **buf, - long *len_store, - int *motion, - bool vim, - bool vimenc, - char_u **tofree) -{ - char_u *final = *buf; - char_u *enc; - long len = *len_store; - - if (vim && len >= 2) - { - *motion = *final++; - len--; - } - else if (vimenc && len >= 3) - { - vimconv_T conv; - int convlen; - - // First byte is motion type - *motion = *final++; - len--; - - // Get encoding of selection - enc = final; - - // Skip the encoding type including null terminator in final text - final = memchr(final, NUL, len); - if (final == NULL) - return FAIL; - final++; // Skip NUL - - // Subtract pointers to get length of encoding; - len -= final - enc; - - conv.vc_type = CONV_NONE; - convert_setup(&conv, enc, p_enc); - if (conv.vc_type != CONV_NONE) - { - char_u *tmp; - - convlen = len; - tmp = string_convert(&conv, final, &convlen); - len = convlen; - if (tmp != NULL) - { - final = tmp; - *tofree = final; - } - convert_setup(&conv, NULL, NULL); - } - } - *buf = final; - *len_store = len; - return OK; -} /* * Read data from a file descriptor and write it to the given clipboard. @@ -3790,3 +3724,72 @@ dec_clip_provider(void) } #endif // FEAT_CLIPBOARD_PROVIDER + +#if defined(FEAT_WAYLAND_CLIPBOARD) || (defined(FEAT_GUI_GTK) && defined(USE_GTK4)) +/* + * If "vim" is TRUE, then get the motion type. If "vimenc" is TRUE, then get the + * motion type and also convert "*buf". "buf" and "len_store" will be updated to + * reflect the actual contents, but should be set beforehand with the initial + * contents. Returns OK on success and FAIL on failure. + */ + int +clip_convert_data( + char_u **buf, + long *len_store, + int *motion, + bool vim, + bool vimenc, + char_u **tofree) +{ + char_u *final = *buf; + char_u *enc; + long len = *len_store; + + if (vim && len >= 2) + { + *motion = *final++; + len--; + } + else if (vimenc && len >= 3) + { + vimconv_T conv; + int convlen; + + // First byte is motion type + *motion = *final++; + len--; + + // Get encoding of selection + enc = final; + + // Skip the encoding type including null terminator in final text + final = memchr(final, NUL, len); + if (final == NULL) + return FAIL; + final++; // Skip NUL + + // Subtract pointers to get length of encoding; + len -= final - enc; + + conv.vc_type = CONV_NONE; + convert_setup(&conv, enc, p_enc); + if (conv.vc_type != CONV_NONE) + { + char_u *tmp; + + convlen = len; + tmp = string_convert(&conv, final, &convlen); + len = convlen; + if (tmp != NULL) + { + final = tmp; + *tofree = final; + } + convert_setup(&conv, NULL, NULL); + } + } + *buf = final; + *len_store = len; + return OK; +} +#endif diff --git a/src/proto/clipboard.pro b/src/proto/clipboard.pro index 25633ca394..46dc72edeb 100644 --- a/src/proto/clipboard.pro +++ b/src/proto/clipboard.pro @@ -37,7 +37,6 @@ void may_set_selection(void); int clip_init_wayland(void); void clip_uninit_wayland(void); int clip_reset_wayland(void); -int clip_convert_data(char_u **buf, long *len_store, int *motion, bool vim, bool vimenc, char_u **tofree); char *choose_clipmethod(void); void ex_clipreset(exarg_T *eap); void adjust_clip_reg(int *rp); @@ -46,4 +45,5 @@ void call_clip_provider_request(int reg); void call_clip_provider_set(int reg); void inc_clip_provider(void); void dec_clip_provider(void); +int clip_convert_data(char_u **buf, long *len_store, int *motion, bool vim, bool vimenc, char_u **tofree); /* vim: set ft=c : */ diff --git a/src/version.c b/src/version.c index 28606e3d3e..6e78357c41 100644 --- a/src/version.c +++ b/src/version.c @@ -754,6 +754,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 625, /**/ 624, /**/