cut spurious \0 byte from string properties
added with 26c263cc1de9cf0af66c12d0d746cd8ae7b1744a CCBUG: 326893 FIXED-IN: 4.11.6 REVIEW: 114963
This commit is contained in:
parent
edf0ed895f
commit
5032520920
1 changed files with 4 additions and 1 deletions
|
@ -129,14 +129,17 @@ QByteArray getStringProperty(xcb_window_t w, xcb_atom_t prop, char separator)
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
char *data = static_cast<char*>(xcb_get_property_value(property.data()));
|
char *data = static_cast<char*>(xcb_get_property_value(property.data()));
|
||||||
|
int length = property->value_len;
|
||||||
if (data && separator) {
|
if (data && separator) {
|
||||||
for (uint32_t i = 0; i < property->value_len; ++i) {
|
for (uint32_t i = 0; i < property->value_len; ++i) {
|
||||||
if (!data[i] && i + 1 < property->value_len) {
|
if (!data[i] && i + 1 < property->value_len) {
|
||||||
data[i] = separator;
|
data[i] = separator;
|
||||||
|
} else {
|
||||||
|
length = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QByteArray(data, property->value_len);
|
return QByteArray(data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef KCMRULES
|
#ifndef KCMRULES
|
||||||
|
|
Loading…
Reference in a new issue