mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 16:20:42 +00:00
Base 64 encoding fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13915 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
829014482f
commit
be921624e4
2 changed files with 9 additions and 9 deletions
|
@ -4,6 +4,7 @@
|
|||
Check user, password, host, port parts for illegal characters.
|
||||
Thanks to bug report by Marco Manfredini <mldb@gmx.org>
|
||||
* Source/GSMime.m: add convenience method for setting document type.
|
||||
Fix error in recent change to base64 encoding.
|
||||
|
||||
2002-06-17 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -2887,15 +2887,14 @@ static NSCharacterSet *tokenSet = nil;
|
|||
|
||||
for (sIndex = 0; sIndex < length; sIndex += 3)
|
||||
{
|
||||
dBuf[dIndex] = b64[sBuf[sIndex] >> 2];
|
||||
dBuf[dIndex + 1]
|
||||
= b64[((sBuf[sIndex] << 4) & 060)
|
||||
| ((sBuf[sIndex + 1] >> 4) & 017)];
|
||||
dBuf[dIndex + 2]
|
||||
= b64[((sBuf[sIndex + 1] << 2) & 074)
|
||||
| ((sBuf[sIndex + 2] >> 6) & 03)];
|
||||
dBuf[dIndex + 3] = b64[sBuf[sIndex + 2] & 077];
|
||||
dIndex += 3;
|
||||
int c0 = sBuf[sIndex];
|
||||
int c1 = sBuf[sIndex+1];
|
||||
int c2 = sBuf[sIndex+2];
|
||||
|
||||
dBuf[dIndex++] = b64[(c0 >> 2) & 077];
|
||||
dBuf[dIndex++] = b64[((c0 << 4) & 060) | ((c1 >> 4) & 017)];
|
||||
dBuf[dIndex++] = b64[((c1 << 2) & 074) | ((c2 >> 6) & 03)];
|
||||
dBuf[dIndex++] = b64[c2 & 077];
|
||||
}
|
||||
|
||||
/* If len was not a multiple of 3, then we have encoded too
|
||||
|
|
Loading…
Reference in a new issue