mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix: build
This commit is contained in:
parent
1445dc4151
commit
626a1f58be
@ -185,7 +185,7 @@ size_t utf8_truncate(std::string& str, size_t width = std::string::npos) {
|
|||||||
|
|
||||||
for (gchar *data = str.data(), *end = data + str.size(); data;) {
|
for (gchar *data = str.data(), *end = data + str.size(); data;) {
|
||||||
gunichar c = g_utf8_get_char_validated(data, end - data);
|
gunichar c = g_utf8_get_char_validated(data, end - data);
|
||||||
if (c == -1 || c == -2) {
|
if (c == -1U || c == -2U) {
|
||||||
// invalid unicode, treat string as ascii
|
// invalid unicode, treat string as ascii
|
||||||
if (width != std::string::npos && str.length() > width) str.resize(width);
|
if (width != std::string::npos && str.length() > width) str.resize(width);
|
||||||
return str.length();
|
return str.length();
|
||||||
|
Loading…
Reference in New Issue
Block a user