wreadln: use locale_width() in right_align_bytes()
authorMax Kellermann <max@musicpd.org>
Wed, 12 Sep 2018 17:38:34 +0000 (19:38 +0200)
committerMax Kellermann <max@musicpd.org>
Wed, 12 Sep 2018 17:38:34 +0000 (19:38 +0200)
src/wreadln.cxx

index 0e32c18..caa3f09 100644 (file)
@@ -145,16 +145,10 @@ right_align_bytes(const char *data, size_t right, unsigned width)
        const std::string dup(data, right);
 
        while (start < right) {
        const std::string dup(data, right);
 
        while (start < right) {
-               char *p = locale_to_utf8(dup.c_str() + start);
-               unsigned p_width = utf8_width(p);
-
-               if (p_width < width) {
-                       g_free(p);
+               if (locale_width(dup.c_str() + start) < width)
                        break;
                        break;
-               }
 
                start += CharSizeMB(data + start, right - start);
 
                start += CharSizeMB(data + start, right - start);
-               g_free(p);
        }
 
        return start;
        }
 
        return start;