Fix bug with empty data object in xml plist

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10592 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-07-27 13:30:31 +00:00
parent b680f3e314
commit 71b8835828
3 changed files with 21 additions and 5 deletions

View file

@ -143,11 +143,17 @@ encodeBase64(NSData *source)
int enclen = length / 3;
int remlen = length - 3 * enclen;
int destlen = 4 * ((length - 1) / 3) + 5;
unsigned char *sBuf = (unsigned char*)[source bytes];
unsigned char *dBuf = NSZoneMalloc(NSDefaultMallocZone(), destlen);
unsigned char *sBuf;
unsigned char *dBuf;
int sIndex = 0;
int dIndex = 0;
if (length == 0)
{
return @"";
}
sBuf = (unsigned char*)[source bytes];
dBuf = NSZoneMalloc(NSDefaultMallocZone(), destlen);
dBuf[destlen - 1] = '\0';
for (sIndex = 0; sIndex < length - 2; sIndex += 3, dIndex += 4)