term_set_window_title(): fix bad check for invalid UTF-8

mbsntoc32() returns (size_t)-1 on failure, not (char32_t)-1.
This commit is contained in:
Daniel Eklöf 2024-08-20 07:15:22 +02:00
parent 7dd204fd31
commit 8f9f3dbd9d
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -3528,7 +3528,7 @@ term_set_window_title(struct terminal *term, const char *title)
if (term->window_title != NULL && streq(term->window_title, title))
return;
if (mbsntoc32(NULL, title, strlen(title), 0) == (char32_t)-1) {
if (mbsntoc32(NULL, title, strlen(title), 0) == (size_t)-1) {
/* It's an xdg_toplevel::set_title() protocol violation to set
a title with an invalid UTF-8 sequence */
LOG_WARN("%s: title is not valid UTF-8, ignoring", title);