diff options
author | rowanbeentje <rowan@beent.je> | 2009-02-19 23:50:38 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-02-19 23:50:38 +0000 |
commit | 966867d3544e70e8fde0d2dbec8ef32d674925b1 (patch) | |
tree | 5869632f790b5205b1340d6fb896655eb0d5ac7e | |
parent | 75de2e00aedbaccb7c15231a5bb41c41c5bfd7e2 (diff) | |
download | sequelpro-966867d3544e70e8fde0d2dbec8ef32d674925b1.tar.gz sequelpro-966867d3544e70e8fde0d2dbec8ef32d674925b1.tar.bz2 sequelpro-966867d3544e70e8fde0d2dbec8ef32d674925b1.zip |
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.
-rw-r--r-- | Source/TableContent.m | 7 |
1 files 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]; } |