libidav/utils.c

changeset 818
bc782cca0759
parent 816
839fefbdedc7
--- a/libidav/utils.c	Thu May 23 23:19:06 2024 +0200
+++ b/libidav/utils.c	Thu May 23 23:23:36 2024 +0200
@@ -522,9 +522,8 @@
     
     // get prefix of abspath and base
     // this dir is the root of the link
-    size_t i;
     size_t last_dir = 0;
-    for(i=0;i<max;i++) {
+    for(size_t i=0;i<max;i++) {
         char c = abspath[i];
         if(c != base[i]) {
             break;
@@ -537,8 +536,8 @@
     CxBuffer out;
     if(last_dir+1 < base_len) {
         // base is deeper than the link root, we have to go backwards
-        int dircount = 0;
-        for(int i=last_dir+1;i<base_len;i++) {
+        size_t dircount = 0;
+        for(size_t i=last_dir+1;i<base_len;i++) {
             if(IS_PATH_SEPARATOR(base[i])) {
                 dircount++;
             }
@@ -546,7 +545,7 @@
         
         cxBufferInit(&out, NULL, dircount*3+path_len-last_dir, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
         
-        for(int i=0;i<dircount;i++) {
+        for(size_t i=0;i<dircount;i++) {
             cxBufferPutString(&out, "../");
         }
     } else {

mercurial