apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r587610 - /apr/apr-util/branches/1.2.x/encoding/apr_base64.c
Date Tue, 23 Oct 2007 18:57:05 GMT
Author: wrowe
Date: Tue Oct 23 11:57:04 2007
New Revision: 587610

URL: http://svn.apache.org/viewvc?rev=587610&view=rev
Log:
When dealing with deltas/offsets, use size_t until
the last possible moment (the API restricts us to
returning int's).

Backport: r587431

Modified:
    apr/apr-util/branches/1.2.x/encoding/apr_base64.c

Modified: apr/apr-util/branches/1.2.x/encoding/apr_base64.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.2.x/encoding/apr_base64.c?rev=587610&r1=587609&r2=587610&view=diff
==============================================================================
--- apr/apr-util/branches/1.2.x/encoding/apr_base64.c (original)
+++ apr/apr-util/branches/1.2.x/encoding/apr_base64.c Tue Oct 23 11:57:04 2007
@@ -111,13 +111,13 @@
 {
     int nbytesdecoded;
     register const unsigned char *bufin;
-    register int nprbytes;
+    register apr_size_t nprbytes;
 
     bufin = (const unsigned char *) bufcoded;
     while (pr2six[*(bufin++)] <= 63);
 
     nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
-    nbytesdecoded = ((nprbytes + 3) / 4) * 3;
+    nbytesdecoded = (((int)nprbytes + 3) / 4) * 3;
 
     return nbytesdecoded + 1;
 }
@@ -148,12 +148,12 @@
     int nbytesdecoded;
     register const unsigned char *bufin;
     register unsigned char *bufout;
-    register int nprbytes;
+    register apr_size_t nprbytes;
 
     bufin = (const unsigned char *) bufcoded;
     while (pr2six[*(bufin++)] <= 63);
     nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
-    nbytesdecoded = ((nprbytes + 3) / 4) * 3;
+    nbytesdecoded = (((int)nprbytes + 3) / 4) * 3;
 
     bufout = (unsigned char *) bufplain;
     bufin = (const unsigned char *) bufcoded;
@@ -183,7 +183,7 @@
 	    (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
     }
 
-    nbytesdecoded -= (4 - nprbytes) & 3;
+    nbytesdecoded -= (4 - (int)nprbytes) & 3;
     return nbytesdecoded;
 }
 
@@ -264,5 +264,5 @@
     }
 
     *p++ = '\0';
-    return p - encoded;
+    return (int)(p - encoded);
 }



Mime
View raw message