]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/mbsalign: escape "\x" when HAVE_WIDECHAR not defined
authorVaclav Dolezal <vdolezal@redhat.com>
Thu, 21 Dec 2017 14:23:56 +0000 (15:23 +0100)
committerVaclav Dolezal <vdolezal@redhat.com>
Fri, 22 Dec 2017 11:32:36 +0000 (12:32 +0100)
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
lib/mbsalign.c

index 07fc313b845f4b163808dda41337422f9bed8f90..3959d46ddf5eaa9ba778e900ee43558bcb222738 100644 (file)
@@ -223,6 +223,9 @@ char *mbs_invalid_encode_to_buffer(const char *s, size_t *width, char *buf)
 #ifdef HAVE_WIDECHAR
                wchar_t wc;
                size_t len = mbrtowc(&wc, p, MB_CUR_MAX, &st);
+#else
+               size_t len = 1;
+#endif
 
                if (len == 0)
                        break;          /* end of string */
@@ -251,10 +254,6 @@ char *mbs_invalid_encode_to_buffer(const char *s, size_t *width, char *buf)
                        *width += wcwidth(wc);
                }
                p += len;
-#else
-               *r++ = *p++;
-               (*width)++;
-#endif
        }
 
        *r = '\0';