diff --git a/src/strutil.c b/src/strutil.c index 62d2993e..f93e1151 100644 --- a/src/strutil.c +++ b/src/strutil.c @@ -591,7 +591,7 @@ const char *str_plural(int x) { static const char *str_filename(const char *fn, const char *stdname) { if(!fn) fn = "???"; - char *p1 = strrchr(fn, '/'), *p2 = strrchr(fn, '\\'); + const char *p1 = strrchr(fn, '/'), *p2 = strrchr(fn, '\\'); return str_eq(fn, "-")? stdname: str_starts(fn, "/dev/")? fn: p1? p1 + 1: p2? p2 + 1: fn; } diff --git a/src/usbasp.c b/src/usbasp.c index b01d2711..049081a4 100644 --- a/src/usbasp.c +++ b/src/usbasp.c @@ -425,7 +425,7 @@ static int check_for_port_argument_match(const char *port, const char *bus, if(str_casestarts(port, "usb:")) { port += 4; - char *dev_name = strchr(port, ':'); + const char *dev_name = strchr(port, ':'); if(dev_name) // Compare with busdir:devicefile return str_busdev_eq(port, bus) && str_busdev_eq(dev_name+1, device); diff --git a/src/xbee.c b/src/xbee.c index 82af30a6..0c88b9b0 100644 --- a/src/xbee.c +++ b/src/xbee.c @@ -968,7 +968,7 @@ static int xbeedev_open(const char *port, union pinfo pinfo, union filedescripto * * ... for a direct connection. */ - char *ttySeparator = strchr(port, '@'); + const char *ttySeparator = strchr(port, '@'); if(ttySeparator == NULL) { pmsg_error("XBee: bad port syntax, require @\n"); @@ -979,7 +979,7 @@ static int xbeedev_open(const char *port, union pinfo pinfo, union filedescripto XBeeBootSessionInit(xbs); - char *tty = &ttySeparator[1]; + const char *tty = ttySeparator + 1; if(ttySeparator == port) { // Direct connection @@ -1073,8 +1073,7 @@ static int xbeedev_open(const char *port, union pinfo pinfo, union filedescripto pmsg_notice("baud %ld\n", (long) pinfo.serialinfo.baud); { - const int rc = xbs->serialDevice->open(tty, pinfo, - &xbs->serialDescriptor); + const int rc = xbs->serialDevice->open(tty, pinfo, &xbs->serialDescriptor); if(rc < 0) { mmt_free(xbs);