Skip to content

Commit fab18c0

Browse files
committed
Prevent unintended side effects by fixing QString conversion handling in dipswitch parsing functions (#437).
1 parent 12cc62a commit fab18c0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/gui/dipswitch.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void tag_crc(void) {
198198
return;
199199
}
200200
QString buf = dp_read.splitted.at(1);
201-
dp.crc32s.append(to_uint(buf.remove("0x"), buf.contains("0x") ? 16 : 10));
201+
dp.crc32s.append(to_uint(QString(buf).remove("0x"), buf.contains("0x") ? 16 : 10));
202202
}
203203
BYTE tag_setting(void) {
204204
_dp_type type;
@@ -211,9 +211,9 @@ BYTE tag_setting(void) {
211211
return (FALSE);
212212
}
213213
QString buf = dp_read.splitted.at(2);
214-
type.mask = to_uint(buf.remove("0x"), buf.contains("0x") ? 16 : 10);
214+
type.mask = to_uint(QString(buf).remove("0x"), buf.contains("0x") ? 16 : 10);
215215
buf = dp_read.splitted.at(4);
216-
type.def = to_uint(buf.remove("0x"), buf.contains("0x") ? 16 : 10);
216+
type.def = to_uint(QString(buf).remove("0x"), buf.contains("0x") ? 16 : 10);
217217
type.name = name_from_splitted(6);
218218
dp.types.append(type);
219219
return (TRUE);
@@ -228,7 +228,7 @@ void tag_choiche(void) {
228228
return;
229229
}
230230
QString buf = dp_read.splitted.at(2);
231-
value.value = to_uint(buf.remove("0x"), buf.contains("0x") ? 16 : 10);
231+
value.value = to_uint(QString(buf).remove("0x"), buf.contains("0x") ? 16 : 10);
232232
value.name = name_from_splitted(4);
233233
dp.types.last().values.append(value);
234234
}

0 commit comments

Comments
 (0)