diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/serdi.c | 2 | ||||
-rw-r--r-- | src/uri.c | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/serdi.c b/src/serdi.c index 1d6a8663..91cffe46 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -133,7 +133,7 @@ main(int argc, char** argv) const uint8_t* base_uri_str = NULL; SerdURI base_uri; if (a < argc) { // Base URI given on command line - const uint8_t* const in_base_uri = (const uint8_t*)argv[a++]; + const uint8_t* const in_base_uri = (const uint8_t*)argv[a]; if (serd_uri_parse((const uint8_t*)in_base_uri, &base_uri)) { fprintf(stderr, "Invalid base URI <%s>\n", argv[2]); return 1; @@ -32,7 +32,7 @@ serd_uri_string_has_scheme(const uint8_t* utf8) if (!is_alpha(utf8[0])) { return false; // Invalid scheme initial character, URI is relative } - for (uint8_t c = *++utf8; (c = *utf8) != '\0'; ++utf8) { + for (uint8_t c; (c = *++utf8) != '\0';) { switch (c) { case ':': return true; // End of scheme @@ -113,7 +113,7 @@ maybe_authority: ptr += 2; uri->authority.buf = ptr; assert(uri->authority.len == 0); - for (uint8_t c = *ptr; (c = *ptr) != '\0'; ++ptr) { + for (uint8_t c; (c = *ptr) != '\0'; ++ptr) { switch (c) { case '/': goto path; case '?': goto query; @@ -136,7 +136,7 @@ path: } uri->path.buf = ptr; uri->path.len = 0; - for (uint8_t c = *ptr; (c = *ptr) != '\0'; ++ptr) { + for (uint8_t c; (c = *ptr) != '\0'; ++ptr) { switch (c) { case '?': goto query; case '#': goto fragment; @@ -152,7 +152,7 @@ path: query: if (*ptr == '?') { uri->query.buf = ++ptr; - for (uint8_t c = *ptr; (c = *ptr) != '\0'; ++ptr) { + for (uint8_t c; (c = *ptr) != '\0'; ++ptr) { switch (c) { case '#': goto fragment; @@ -268,11 +268,11 @@ serd_uri_serialise(const SerdURI* uri, SerdSink sink, void* stream) See http://tools.ietf.org/html/rfc3986#section-5.2.3 */ const uint8_t* begin = uri->path.buf; - const uint8_t* end = begin; - size_t up = 1; + size_t up = 1; + if (begin) { // Count and skip leading dot components - end = uri->path.buf + uri->path.len; + const uint8_t* end = uri->path.buf + uri->path.len; for (bool done = false; !done && (begin < end);) { switch (begin[0]) { case '.': |