Author: rfm
Date: Sun Aug 30 12:50:59 2015
New Revision: 38957
URL: http://svn.gna.org/viewcvs/gnustep?rev=38957&view=rev
Log:
tweak format of base64 encoded data content
Modified:
libs/base/trunk/Source/Additions/GSMime.m
Modified: libs/base/trunk/Source/Additions/GSMime.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/Additions/GSMime.m?rev=38957&r1=38956&r2=38957&view=diff
==============================================================================
--- libs/base/trunk/Source/Additions/GSMime.m (original)
+++ libs/base/trunk/Source/Additions/GSMime.m Sun Aug 30 12:50:59 2015
@@ -5558,9 +5558,14 @@
[m appendString: @"Content:\n"];
if ([content isKindOfClass: NSDataClass])
{
- NSString *t = [self convertToText];
- NSData *d = [[self class] encodeBase64: content];
-
+ NSString *t = [self convertToText];
+ NSUInteger l = [content length];
+ int hl = (int)(((l + 2) / 3) * 4);
+ uint8_t *hex;
+
+ hex = (uint8_t*)malloc(hl + 1);
+ hex[hl] = '\0';
+ GSPrivateEncodeBase64([content bytes], l, hex);
if (nil != t)
{
for (pad = 0; pad <= level; pad++) { [m appendString: @" "]; }
@@ -5569,11 +5574,8 @@
[m appendString: @"\n"];
}
for (pad = 0; pad <= level; pad++) { [m appendString: @" "]; }
- [m appendFormat: @"%lu bytes: ", (unsigned long)[content length]];
- t = [[NSString alloc] initWithData: d encoding: NSASCIIStringEncoding];
- [m appendString: t];
- [m appendString: @"\n"];
- RELEASE(t);
+ [m appendFormat: @"%lu bytes: <[%s]>\n", (unsigned long)l, (char*)hex];
+ free(hex);
}
else if ([content isKindOfClass: NSStringClass])
{
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs