diff --git a/intern/ghost/intern/GHOST_SystemWayland.cc b/intern/ghost/intern/GHOST_SystemWayland.cc index a9d1e4113c9..004c0603426 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cc +++ b/intern/ghost/intern/GHOST_SystemWayland.cc @@ -1335,7 +1335,7 @@ static void ghost_wayland_log_handler(const char *msg, va_list arg) } } -#ifdef WITH_GHOST_X11 +#if defined(WITH_GHOST_X11) && defined(WITH_GHOST_WAYLAND_LIBDECOR) /** * Check if the system is running X11. * This is not intended to be a fool-proof check (the `DISPLAY` is not validated for e.g.). @@ -1349,7 +1349,7 @@ static bool ghost_wayland_is_x11_available() } return false; } -#endif /* WITH_GHOST_X11 */ +#endif /* WITH_GHOST_X11 && WITH_GHOST_WAYLAND_LIBDECOR */ static GHOST_TKey xkb_map_gkey(const xkb_keysym_t sym) { diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 92570925f02..9bf51aff7b8 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -1000,29 +1000,31 @@ static void flip_names(tAnimCopybufItem *aci, char **r_name) const char *str_end = aci->rna_path + ofs_end; /* Swap out the name. - * Note that there is no need to un-escape the string to flip it. */ - char bname_new[MAX_VGROUP_NAME]; + * NOTE: there is no need to un-escape the string to flip it. + * However the buffer does need to be twice the size. */ + char bname_new[MAX_VGROUP_NAME * 2]; char *str_iter; - int length, prefix_l, postfix_l; + int len_old, prefix_l, postfix_l; prefix_l = str_start - aci->rna_path; - length = str_end - str_start; + len_old = str_end - str_start; postfix_l = strlen(str_end); /* Temporary substitute with NULL terminator. */ - BLI_assert(str_start[length] == '\"'); - str_start[length] = 0; - BLI_string_flip_side_name(bname_new, str_start, false, sizeof(bname_new)); - str_start[length] = '\"'; + BLI_assert(str_start[len_old] == '\"'); + str_start[len_old] = 0; + const int len_new = BLI_string_flip_side_name( + bname_new, str_start, false, sizeof(bname_new)); + str_start[len_old] = '\"'; - str_iter = *r_name = MEM_mallocN(sizeof(char) * (prefix_l + postfix_l + length + 1), + str_iter = *r_name = MEM_mallocN(sizeof(char) * (prefix_l + postfix_l + len_new + 1), "flipped_path"); BLI_strncpy(str_iter, aci->rna_path, prefix_l + 1); str_iter += prefix_l; - BLI_strncpy(str_iter, bname_new, length + 1); - str_iter += length; + BLI_strncpy(str_iter, bname_new, len_new + 1); + str_iter += len_new; BLI_strncpy(str_iter, str_end, postfix_l + 1); str_iter[postfix_l] = '\0'; }