From b48d3efeb093dd0075fc7201de779048626ca4b3 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 16 Aug 2009 13:22:51 +0000 Subject: - Make result sets 1.5x faster to process by using 10.4+ native stringWithCString:encoding: instead of old NSData-based functions. Speeds up large table loading significantly. --- Frameworks/MCPKit/MCPFoundationKit/MCPResult.m | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'Frameworks/MCPKit/MCPFoundationKit') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m index f8572613..158d01c8 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m @@ -451,7 +451,7 @@ const OUR_CHARSET our_charsets60[] = case FIELD_TYPE_SET: case FIELD_TYPE_ENUM: case FIELD_TYPE_NEWDATE: // Don't know what the format for this type is... - theCurrentObj = [self stringWithCString:theData]; + theCurrentObj = [NSString stringWithCString:theData encoding:mEncoding]; break; case FIELD_TYPE_BIT: @@ -1098,20 +1098,9 @@ const OUR_CHARSET our_charsets60[] = */ - (NSString *)stringWithCString:(const char *)theCString { - NSData *theData; - NSString *theString; - - if (theCString == NULL) { - return @""; - } - - theData = [[NSData alloc] initWithBytes:theCString length:(strlen(theCString))]; - theString = [[NSString alloc] initWithData:theData encoding:mEncoding]; - - if (theData) [theData release]; - if (theString) [theString autorelease]; - - return theString; + if (theCString == NULL) return @""; + + return [NSString stringWithCString:theCString encoding:mEncoding]; } #pragma mark - -- cgit v1.2.3