From: Gerhard Sittig Date: Tue, 18 Jun 2019 16:57:44 +0000 (+0200) Subject: serial_hid: address constness nits X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=87307940f11c53a3f4efe7c4aaddd9db75ebae9c;p=libsigrok.git serial_hid: address constness nits --- diff --git a/src/serial_hid.c b/src/serial_hid.c index ee073d1d..0c5b9ccc 100644 --- a/src/serial_hid.c +++ b/src/serial_hid.c @@ -591,9 +591,9 @@ static int ser_hid_setup_funcs(struct sr_serial_dev_inst *serial) * returns the chip index and advances the spec pointer upon match, * returns SER_HID_CHIP_UNKNOWN upon mismatch. */ -static enum ser_hid_chip_t ser_hid_chip_find_enum(char **spec_p) +static enum ser_hid_chip_t ser_hid_chip_find_enum(const char **spec_p) { - gchar *spec; + const gchar *spec; enum ser_hid_chip_t idx; struct ser_hid_chip_functions *desc; @@ -774,7 +774,8 @@ static int ser_hid_parse_conn_spec( serno = g_strdup(p); p += strlen(p); } else if (!chip) { - char *copy, *endptr; + char *copy; + const char *endptr; const char *name; copy = g_strdup(p); endptr = copy; @@ -960,7 +961,7 @@ static int ser_hid_chip_search(enum ser_hid_chip_t *chip_ref, sr_dbg("DBG: %s(), name %s", __func__, name); if (!name || !*name) return SR_ERR_NA; - chip = ser_hid_chip_find_enum((char **)&name); + chip = ser_hid_chip_find_enum(&name); sr_dbg("DBG: %s(), chip %d", __func__, chip); if (chip == SER_HID_CHIP_UNKNOWN) return SR_ERR_NA; @@ -1058,7 +1059,7 @@ static int ser_hid_chip_search(enum ser_hid_chip_t *chip_ref, sr_dbg("DBG: %s(), name %s", __func__, name); if (!name || !*name) return SR_ERR_NA; - chip = ser_hid_chip_find_enum((char **)&name); + chip = ser_hid_chip_find_enum(&name); sr_dbg("DBG: %s(), chip %d", __func__, chip); if (chip == SER_HID_CHIP_UNKNOWN) return SR_ERR_NA;