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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]