From c70dc822c2b9d2d39a65bdde0ca7b61a1355b846 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 18 Mar 2012 17:24:52 +0000 Subject: - Add a base64Encoding method for convenience when the result should be all on one line, and use it in SPTableContent --- Source/SPDataBase64EncodingAdditions.h | 1 + Source/SPDataBase64EncodingAdditions.m | 9 +++++++++ Source/SPTableContent.m | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/SPDataBase64EncodingAdditions.h b/Source/SPDataBase64EncodingAdditions.h index 96474ee3..63812025 100644 --- a/Source/SPDataBase64EncodingAdditions.h +++ b/Source/SPDataBase64EncodingAdditions.h @@ -25,6 +25,7 @@ @interface NSData (SPDataBase64EncodingAdditions) +- (NSString *)base64Encoding; - (NSString *)base64EncodingWithLineLength:(NSUInteger)lineLength; @end diff --git a/Source/SPDataBase64EncodingAdditions.m b/Source/SPDataBase64EncodingAdditions.m index 788184cf..9ca32b14 100644 --- a/Source/SPDataBase64EncodingAdditions.m +++ b/Source/SPDataBase64EncodingAdditions.m @@ -29,6 +29,15 @@ static const char _base64EncodingTable[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefgh @implementation NSData (SPDataBase64EncodingAdditions) +/** + * Returns a base64-encoded representation of the NSData as an NSString, + * on a single line. + */ +- (NSString *)base64Encoding +{ + return [self base64EncodingWithLineLength:NSNotFound]; +} + /** * Returns a base64-encoded representation of the NSData as an NSString. * Takes an argument for the maximum output line length; supply 0 or NSNotFound diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 11e19588..7afbfe84 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -2273,7 +2273,7 @@ @"
", maxSizeValue, (long)imageWidth, - [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01f] base64EncodingWithLineLength:0]]; + [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01f] base64Encoding]]; } [v release]; @@ -2289,7 +2289,7 @@ [tempRow addObject:[NSString stringWithFormat: @"", (long)imageWidth, - [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01f] base64EncodingWithLineLength:0]]]; + [[image TIFFRepresentationUsingCompression:NSTIFFCompressionJPEG factor:0.01f] base64Encoding]]]; } else { [tempRow addObject:@"<BLOB>"]; -- cgit v1.2.3