Skip to content

Commit d9a69d2

Browse files
committed
Fix compatibility with glibc<2.68
1 parent 26af9ce commit d9a69d2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/hardware/scpi-dmm/protocol.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,22 @@ SR_PRIV const char *scpi_dmm_owon_get_range_text(const struct sr_dev_inst *sdi)
303303
return NULL;
304304
}
305305
/* Replace Unicode Omega symbol (0xCE 0xA9) with "Ohm". */
306+
#if __GLIBC_PREREQ(2, 68)
306307
GString *response_str = g_string_new(response);
307308
g_string_replace(response_str, "\xCE\xA9", "Ohm", 0);
309+
#else
310+
GString *response_str = g_string_new("");
311+
const char *src = response;
312+
while (*src) {
313+
if (src[0] == '\xCE' && src[1] == '\xA9') {
314+
g_string_append(response_str, "Ohm");
315+
src += 2;
316+
} else {
317+
g_string_append_c(response_str, *src);
318+
src++;
319+
}
320+
}
321+
#endif
308322
g_free(response);
309323
response = g_string_free(response_str, FALSE);
310324

0 commit comments

Comments
 (0)