mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
Minor tidyup
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14463 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1cd7de4274
commit
b6f8a1abbc
2 changed files with 4 additions and 57 deletions
|
@ -8,6 +8,8 @@
|
||||||
Documented the class.
|
Documented the class.
|
||||||
* Source/NSData.m: ([-writeToFile:atomically:]) implement workaround
|
* Source/NSData.m: ([-writeToFile:atomically:]) implement workaround
|
||||||
for bug in windoze implementation of rename()
|
for bug in windoze implementation of rename()
|
||||||
|
* Source/NSString.m: Remove some redundant code duplicating stuff in
|
||||||
|
GSMime.m
|
||||||
|
|
||||||
2002-09-15 Richard Frith-Macdonald <rfm@gnu.org>
|
2002-09-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@
|
||||||
#include <Foundation/NSLock.h>
|
#include <Foundation/NSLock.h>
|
||||||
#include <Foundation/NSUserDefaults.h>
|
#include <Foundation/NSUserDefaults.h>
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
|
#include <base/GSMime.h>
|
||||||
#include <base/GSFormat.h>
|
#include <base/GSFormat.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -4387,63 +4388,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
|
|
||||||
#ifdef HAVE_LIBXML
|
#ifdef HAVE_LIBXML
|
||||||
#include <Foundation/GSXML.h>
|
#include <Foundation/GSXML.h>
|
||||||
|
|
||||||
static int XML_ELEMENT_NODE;
|
static int XML_ELEMENT_NODE;
|
||||||
|
|
||||||
static void
|
|
||||||
decodeBase64Unit(const char* ptr, unsigned char *out)
|
|
||||||
{
|
|
||||||
out[0] = (ptr[0] << 2) | ((ptr[1] & 0x30) >> 4);
|
|
||||||
out[1] = ((ptr[1] & 0x0F) << 4) | ((ptr[2] & 0x3C) >> 2);
|
|
||||||
out[2] = ((ptr[2] & 0x03) << 6) | (ptr[3] & 0x3F);
|
|
||||||
out[3] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static NSData*
|
|
||||||
decodeBase64(const char *source)
|
|
||||||
{
|
|
||||||
int length = strlen(source);
|
|
||||||
char *sourceBuffer;
|
|
||||||
NSMutableData *data;
|
|
||||||
int i;
|
|
||||||
int j;
|
|
||||||
unsigned char tmp[4];
|
|
||||||
|
|
||||||
if (length == 0)
|
|
||||||
{
|
|
||||||
return [NSData data];
|
|
||||||
}
|
|
||||||
|
|
||||||
data = [NSMutableData dataWithCapacity: 0];
|
|
||||||
sourceBuffer = objc_malloc(length+1);
|
|
||||||
strcpy(sourceBuffer, source);
|
|
||||||
j = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < length; i++)
|
|
||||||
{
|
|
||||||
if (!isspace(source[i]))
|
|
||||||
{
|
|
||||||
sourceBuffer[j++] = source[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceBuffer[j] = '\0';
|
|
||||||
length = strlen(sourceBuffer);
|
|
||||||
while (length > 0 && sourceBuffer[length-1] == '=')
|
|
||||||
{
|
|
||||||
sourceBuffer[--length] = '\0';
|
|
||||||
}
|
|
||||||
for (i = 0; i < length; i += 4)
|
|
||||||
{
|
|
||||||
decodeBase64Unit(&sourceBuffer[i], tmp);
|
|
||||||
[data appendBytes: tmp length: strlen(tmp)];
|
|
||||||
}
|
|
||||||
|
|
||||||
objc_free(sourceBuffer);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define inrange(ch,min,max) ((ch)>=(min) && (ch)<=(max))
|
#define inrange(ch,min,max) ((ch)>=(min) && (ch)<=(max))
|
||||||
|
@ -5120,7 +5065,7 @@ nodeToObject(GSXMLNode* node)
|
||||||
}
|
}
|
||||||
else if ([name isEqualToString: @"data"])
|
else if ([name isEqualToString: @"data"])
|
||||||
{
|
{
|
||||||
return decodeBase64([content cString]);
|
return [GSMimeDocument decodeBase64String: content];
|
||||||
}
|
}
|
||||||
// container class
|
// container class
|
||||||
else if ([name isEqualToString: @"array"])
|
else if ([name isEqualToString: @"array"])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue