fix code that is not standard C cpp-ports

Wed, 08 Jun 2022 19:14:57 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 08 Jun 2022 19:14:57 +0200
branch
cpp-ports
changeset 364
e56f9c6f6b8f
parent 363
7f0f5c03666a
child 365
2ea1ed291e9f

fix code that is not standard C

src/server/util/uri.c file | annotate | diff | comparison | revisions
--- a/src/server/util/uri.c	Wed Jun 08 18:55:59 2022 +0200
+++ b/src/server/util/uri.c	Wed Jun 08 19:14:57 2022 +0200
@@ -464,21 +464,19 @@
     }
 
 done:
-    int canonLen = 0;
 
     if (success) {
         /* the path looks fine; return the canonicalized form */
-        canonLen = (int) (out_ptr - canonPath);
+        unsigned canonLen = (unsigned) (out_ptr - canonPath);
         canonPath[canonLen] = '\0';
+        if (pcanonlen) *pcanonlen = (int) canonLen;
     } else {
         /* error canonicalizing */
         pool_free(pool, canonPath);
         canonPath = NULL;
+        if (pcanonlen) *pcanonlen = 0;
     }
 
-    if (pcanonlen)
-        *pcanonlen = canonLen;
-
     return canonPath;
 }
 

mercurial