You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ka...@apache.org on 2007/10/31 12:24:56 UTC

svn commit: r590625 - /webservices/axis2/trunk/c/util/src/base64.c

Author: kaushalye
Date: Wed Oct 31 04:24:55 2007
New Revision: 590625

URL: http://svn.apache.org/viewvc?rev=590625&view=rev
Log:
New implementation for axutil_base64_decode_len.
JIRA issue : AXIS2C-731

Modified:
    webservices/axis2/trunk/c/util/src/base64.c

Modified: webservices/axis2/trunk/c/util/src/base64.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/base64.c?rev=590625&r1=590624&r2=590625&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/base64.c (original)
+++ webservices/axis2/trunk/c/util/src/base64.c Wed Oct 31 04:24:55 2007
@@ -94,7 +94,7 @@
 axutil_base64_decode_len(
     const char *bufcoded)
 {
-    int nbytesdecoded;
+   int nbytesdecoded;
     register const unsigned char *bufin;
     register int nprbytes;
 
@@ -102,9 +102,12 @@
     while (pr2six[*(bufin++)] <= 63);
 
     nprbytes = (bufin - (const unsigned char *) bufcoded) - 1;
-    nbytesdecoded = ((nprbytes + 3) / 4) * 3;
 
-    return nbytesdecoded + 1;
+    nbytesdecoded = ((nprbytes >> 2) * 3);
+
+    if (nprbytes & 0x03) nbytesdecoded += (nprbytes & 0x03) - 1;
+
+    return nbytesdecoded; 
 }
 
 AXIS2_EXTERN int AXIS2_CALL



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org