From 966867d3544e70e8fde0d2dbec8ef32d674925b1 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Thu, 19 Feb 2009 23:50:38 +0000 Subject: Fix the last two warnings in TableContent.m. Also include an error string instead of breaking display when an NSData object can't be encoded, in the style of the -text or blob- placeholder. --- Source/TableContent.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/TableContent.m b/Source/TableContent.m index d8a0f761..045d75ca 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -798,7 +798,7 @@ unsigned totalLength = [data length]; int bytesPerLine = 16; NSMutableString *retVal = [NSMutableString string]; - unsigned char *nodisplay = "\t\n\r\f"; + char *nodisplay = "\t\n\r\f"; // get the length of the longest location int longest = [(NSString *)[NSString stringWithFormat:@"%X", totalLength - ( totalLength % bytesPerLine )] length]; @@ -853,7 +853,7 @@ } // remove extra ghost characters - [chars appendString:[NSString stringWithCString:buffer]]; + [chars appendString:[NSString stringWithCString:(char *)buffer]]; if ( [chars length] > bytesPerLine ) { [chars deleteCharactersInRange:NSMakeRange( bytesPerLine, [chars length] - bytesPerLine )]; } @@ -1555,7 +1555,8 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn // Convert data objects to their string representation in the current encoding. if ( [theValue isKindOfClass:[NSData class]] ) { NSString *dataRepresentation = [[NSString alloc] initWithData:theValue encoding:[mySQLConnection encoding]]; - theValue = [NSString stringWithString:dataRepresentation]; + if (dataRepresentation == nil) theValue = @"- cannot be displayed -"; + else theValue = [NSString stringWithString:dataRepresentation]; [dataRepresentation release]; } -- cgit v1.2.3