diff options
author | Ian Bruene <ianbruene@gmail.com> | 2018-11-26 13:16:48 -0600 |
---|---|---|
committer | Ian Bruene <ianbruene@gmail.com> | 2018-11-26 13:16:48 -0600 |
commit | f258bb20c290e41fff4a74e08ad0e55304a3709a (patch) | |
tree | ae0ef4a046f3f9732422d186d1897cb706d4f5b8 /net_ntrip.c | |
parent | 9e1b215838e3f8c0dc55d84d6d8fcdbfdf213b3b (diff) | |
download | gpsd-f258bb20c290e41fff4a74e08ad0e55304a3709a.tar.gz |
Removed variable length arrays, added -Wvla compiler option.vla-removal
Diffstat (limited to 'net_ntrip.c')
-rw-r--r-- | net_ntrip.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/net_ntrip.c b/net_ntrip.c index 72f718e4..b10f34bb 100644 --- a/net_ntrip.c +++ b/net_ntrip.c @@ -457,8 +457,6 @@ int ntrip_open(struct gps_device_t *device, char *caster) char *stream = NULL; char *url = NULL; int ret = -1; - char t[strlen(caster) + 1]; - char *tmp = t; switch (device->ntrip.conn_state) { case ntrip_conn_init: @@ -467,14 +465,13 @@ int ntrip_open(struct gps_device_t *device, char *caster) device->ntrip.works = false; device->ntrip.sourcetable_parse = false; device->ntrip.stream.set = false; - (void)strlcpy(tmp, caster, sizeof(t)); - if ((amp = strchr(tmp, '@')) != NULL) { - if (((colon = strchr(tmp, ':')) != NULL) && colon < amp) { - auth = tmp; + if ((amp = strchr(caster, '@')) != NULL) { + if (((colon = strchr(caster, ':')) != NULL) && colon < amp) { + auth = caster; *amp = '\0'; - tmp = amp + 1; - url = tmp; + caster = amp + 1; + url = caster; } else { gpsd_log(&device->context->errout, LOG_ERROR, "can't extract user-ID and password from %s\n", @@ -483,7 +480,7 @@ int ntrip_open(struct gps_device_t *device, char *caster) return -1; } } - if ((slash = strchr(tmp, '/')) != NULL) { + if ((slash = strchr(caster, '/')) != NULL) { *slash = '\0'; stream = slash + 1; } else { @@ -494,7 +491,7 @@ int ntrip_open(struct gps_device_t *device, char *caster) device->ntrip.conn_state = ntrip_conn_err; return -1; } - if ((colon = strchr(tmp, ':')) != NULL) { + if ((colon = strchr(caster, ':')) != NULL) { port = colon + 1; *colon = '\0'; } |