diff options
author | rowanbeentje <rowan@beent.je> | 2011-03-02 02:25:08 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2011-03-02 02:25:08 +0000 |
commit | 4422810afa93d3cbce76812cc50e45ef8634180b (patch) | |
tree | 0d7cf391cdf495a6bef8c6970407e2e081c9d877 | |
parent | 64919b03fa59c8d93c81a8e3893934c04a3cac91 (diff) | |
download | sequelpro-4422810afa93d3cbce76812cc50e45ef8634180b.tar.gz sequelpro-4422810afa93d3cbce76812cc50e45ef8634180b.tar.bz2 sequelpro-4422810afa93d3cbce76812cc50e45ef8634180b.zip |
- Fix compiler warnings for MCPKit - largely typecast related
- Fix further compiler warnings, including a couple of bugs
- Disable the -wselector warnings (Multiple definition types for selector) as they're currently unsupported in LLVM
- Disable the -wconversion warnings (Prototype conversion) warnings as we usually can't affect protocol declaration
- Disable the -wstrict-selector-match (Strict selector matching) due to too many false positives
28 files changed, 278 insertions, 225 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h index 61ce1261..6364add8 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h @@ -66,9 +66,9 @@ typedef struct { NSString *connectionLogin; NSString *connectionPassword; NSString *connectionHost; - NSInteger connectionPort; + NSUInteger connectionPort; NSString *connectionSocket; - NSInteger maxAllowedPacketSize; + NSUInteger maxAllowedPacketSize; unsigned long connectionThreadId; BOOL useSSL; @@ -136,7 +136,7 @@ typedef struct { @property (readwrite, assign) CGFloat keepAliveInterval; // Initialisation -- (id)initToHost:(NSString *)host withLogin:(NSString *)login usingPort:(NSInteger)port; +- (id)initToHost:(NSString *)host withLogin:(NSString *)login usingPort:(NSUInteger)port; - (id)initToSocket:(NSString *)socket withLogin:(NSString *)login; // Delegate @@ -145,7 +145,7 @@ typedef struct { - (MCPConnectionCheck)delegateDecisionForLostConnection; // Connection details -- (BOOL)setPort:(NSInteger)thePort; +- (BOOL)setPort:(NSUInteger)thePort; - (BOOL)setPassword:(NSString *)thePassword; - (void) setSSL:(BOOL)shouldUseSSL usingKeyFilePath:(NSString *)keyFilePath certificatePath:(NSString *)certificatePath certificateAuthorityCertificatePath:(NSString *)caCertificatePath; @@ -169,7 +169,7 @@ typedef struct { - (BOOL)pingConnectionUsingLoopDelay:(NSUInteger)loopDelay; void backgroundPingTask(void *ptr); void forceThreadExit(int signalNumber); -void pingThreadCleanup(); +void pingThreadCleanup(void *pingDetails); - (void)keepAlive:(NSTimer *)theTimer; - (void)threadedKeepAlive; @@ -189,7 +189,7 @@ void pingThreadCleanup(); + (void)setTruncateLongFieldInLogs:(BOOL)iTruncFlag; + (BOOL)truncateLongField; - (BOOL)setConnectionOption:(NSInteger)option toValue:(BOOL)value; -- (BOOL)connectWithLogin:(NSString *)login password:(NSString *)pass host:(NSString *)host port:(NSInteger)port socket:(NSString *)socket; +- (BOOL)connectWithLogin:(NSString *)login password:(NSString *)pass host:(NSString *)host port:(NSUInteger)port socket:(NSString *)socket; - (BOOL)selectDB:(NSString *)dbName; @@ -266,9 +266,9 @@ void pingThreadCleanup(); // Packet size - (BOOL)fetchMaxAllowedPacket; -- (NSInteger)getMaxAllowedPacket; +- (NSUInteger)getMaxAllowedPacket; - (BOOL)isMaxAllowedPacketEditable; -- (NSInteger)setMaxAllowedPacketTo:(NSInteger)newSize resetSize:(BOOL)reset; +- (NSUInteger)setMaxAllowedPacketTo:(NSUInteger)newSize resetSize:(BOOL)reset; // Data conversion - (const char *)cStringFromString:(NSString *)theString; diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index 3556e9d7..7efe4499 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -32,6 +32,7 @@ #import "MCPNull.h" #import "MCPStreamingResult.h" #import "MCPConnectionProxy.h" +#import "MCPConnectionDelegate.h" #import "MCPStringAdditions.h" #import "SPStringAdditions.h" #import "RegexKitLite.h" @@ -133,7 +134,7 @@ static BOOL sTruncateLongFieldInLogs = YES; lastKeepAliveTime = 0; pingThread = NULL; connectionProxy = nil; - connectionStartTime = -1; + connectionStartTime = 0; lastQueryExecutedAtTime = CGFLOAT_MAX; lastDelegateDecisionForLostConnection = NSNotFound; queryCancelled = NO; @@ -195,7 +196,7 @@ static BOOL sTruncateLongFieldInLogs = YES; /** * Inialize connection using the supplied host details. */ -- (id)initToHost:(NSString *)host withLogin:(NSString *)login usingPort:(NSInteger)port +- (id)initToHost:(NSString *)host withLogin:(NSString *)login usingPort:(NSUInteger)port { if ((self = [self init])) { if (!host) host = @""; @@ -213,19 +214,19 @@ static BOOL sTruncateLongFieldInLogs = YES; /** * Inialize connection using the supplied socket details. */ -- (id)initToSocket:(NSString *)socket withLogin:(NSString *)login +- (id)initToSocket:(NSString *)aSocket withLogin:(NSString *)login { if ((self = [self init])) { - if (!socket || ![socket length]) { - socket = [self findSocketPath]; - if (!socket) socket = @""; + if (!aSocket || ![aSocket length]) { + aSocket = [self findSocketPath]; + if (!aSocket) aSocket = @""; } if (!login) login = @""; connectionHost = nil; connectionLogin = [[NSString alloc] initWithString:login]; - connectionSocket = [[NSString alloc] initWithString:socket]; + connectionSocket = [[NSString alloc] initWithString:aSocket]; connectionPort = 0; } @@ -298,7 +299,7 @@ static BOOL sTruncateLongFieldInLogs = YES; /** * Sets or updates the connection port - for use with tunnels. */ -- (BOOL)setPort:(NSInteger)thePort +- (BOOL)setPort:(NSUInteger)thePort { connectionPort = thePort; @@ -456,7 +457,7 @@ static BOOL sTruncateLongFieldInLogs = YES; } // Connect - theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, connectionPort, theSocket, mConnectionFlags); + theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, (unsigned int)connectionPort, theSocket, mConnectionFlags); thePass = NULL; if (theRet != mConnection) { @@ -558,12 +559,12 @@ static BOOL sTruncateLongFieldInLogs = YES; // Check whether a reconnection attempt is already being made - if so, wait and return the status of that reconnection attempt. if (isReconnecting) { - NSDate *reconnectLoopStartdate = [NSDate date], *eventLoopStartDate; + NSDate *eventLoopStartDate; while (isReconnecting) { eventLoopStartDate = [NSDate date]; [[NSRunLoop currentRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; if ([[NSDate date] timeIntervalSinceDate:eventLoopStartDate] < 0.1) { - usleep(100000 - (1000000 * [[NSDate date] timeIntervalSinceDate:eventLoopStartDate])); + usleep((useconds_t)(100000 - (1000000 * [[NSDate date] timeIntervalSinceDate:eventLoopStartDate]))); } } [reconnectionPool drain]; @@ -624,7 +625,7 @@ static BOOL sTruncateLongFieldInLogs = YES; eventLoopStartDate = [NSDate date]; [[NSRunLoop currentRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.25]]; if ([[NSDate date] timeIntervalSinceDate:eventLoopStartDate] < 0.25) { - usleep(250000 - (1000000 * [[NSDate date] timeIntervalSinceDate:eventLoopStartDate])); + usleep((useconds_t)(250000 - (1000000 * [[NSDate date] timeIntervalSinceDate:eventLoopStartDate]))); } } @@ -653,7 +654,7 @@ static BOOL sTruncateLongFieldInLogs = YES; [[NSRunLoop mainRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.25]]; //[[NSRunLoop currentRunLoop] runMode:NSModalPanelRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.25]]; if ([[NSDate date] timeIntervalSinceDate:interfaceInteractionTimer] < 0.25) { - usleep(250000 - (1000000 * [[NSDate date] timeIntervalSinceDate:interfaceInteractionTimer])); + usleep((useconds_t)(250000 - (1000000 * [[NSDate date] timeIntervalSinceDate:interfaceInteractionTimer]))); } if ([connectionProxy state] == PROXY_STATE_WAITING_FOR_AUTH) { proxyStartDate = [proxyStartDate addTimeInterval:[[NSDate date] timeIntervalSinceDate:interfaceInteractionTimer]]; @@ -844,7 +845,7 @@ static BOOL sTruncateLongFieldInLogs = YES; */ - (double)timeConnected { - if (connectionStartTime == -1) return -1; + if (connectionStartTime == 0) return -1; uint64_t currentTime_t = mach_absolute_time() - connectionStartTime; Nanoseconds elapsedTime = AbsoluteToNanoseconds(*(AbsoluteTime *)&(currentTime_t)); @@ -901,7 +902,7 @@ static BOOL sTruncateLongFieldInLogs = YES; // Loop until the ping completes do { - usleep(loopDelay); + usleep((useconds_t)loopDelay); // If the ping timeout has been exceeded, force a timeout; double-check that the // thread is still active. @@ -959,9 +960,10 @@ void forceThreadExit(int signalNumber) pthread_exit(NULL); } -void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) +void pingThreadCleanup(void *pingDetails) { - *(pingDetails->pingActivePointer) = NO; + MCPConnectionPingDetails *pingDetailsStruct = pingDetails; + *(pingDetailsStruct->pingActivePointer) = NO; } /** @@ -1348,12 +1350,12 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) * The socket is used if the host is set to !{@"localhost"}, to an empty or a !{nil} string * For the moment the implementation might not be safe if you have a nil pointer to one of the NSString* variables (underestand: I don't know what the result will be). */ -- (BOOL)connectWithLogin:(NSString *)login password:(NSString *)pass host:(NSString *)host port:(NSInteger)port socket:(NSString *)socket +- (BOOL)connectWithLogin:(NSString *)login password:(NSString *)pass host:(NSString *)host port:(NSUInteger)port socket:(NSString *)aSocket { const char *theLogin = [self cStringFromString:login]; const char *theHost = [self cStringFromString:host]; const char *thePass = [self cStringFromString:pass]; - const char *theSocket = [self cStringFromString:socket]; + const char *theSocket = [self cStringFromString:aSocket]; void *theRet; // Disconnect if it was already connected @@ -1394,7 +1396,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) kMCPSSLCipherList); } - theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, port, theSocket, mConnectionFlags); + theRet = mysql_real_connect(mConnection, theHost, theLogin, thePass, NULL, (unsigned int)port, theSocket, mConnectionFlags); if (theRet != mConnection) { return mConnected = NO; } @@ -1758,7 +1760,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) } else { - NSString *errorMessage = [NSString stringWithFormat:NSLocalizedString(@"The query length of %ld bytes is larger than max_allowed_packet size (%ld).", + NSString *errorMessage = [NSString stringWithFormat:NSLocalizedString(@"The query length of %lu bytes is larger than max_allowed_packet size (%lu).", @"error message if max_allowed_packet < query size"), (unsigned long)theCQueryLength, maxAllowedPacketSize]; @@ -1836,7 +1838,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) queryErrorMessage = [[NSString alloc] initWithString:@""]; queryErrorId = 0; - if (streamResultType == MCPStreamingNone && queryAffectedRows == -1) { + if (streamResultType == MCPStreamingNone && queryAffectedRows == (my_ulonglong)~0) { queryAffectedRows = mysql_affected_rows(mConnection); } @@ -1983,7 +1985,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) } // Connect - connectionSetupStatus = mysql_real_connect(killerConnection, theHost, theLogin, thePass, NULL, connectionPort, theSocket, mConnectionFlags); + connectionSetupStatus = mysql_real_connect(killerConnection, theHost, theLogin, thePass, NULL, (unsigned int)connectionPort, theSocket, mConnectionFlags); thePass = NULL; if (connectionSetupStatus) { @@ -2153,7 +2155,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) [self lockConnection]; if ((dbsName == nil) || ([dbsName isEqualToString:@""])) { - if (theResPtr = mysql_list_dbs(mConnection, NULL)) { + if ((theResPtr = mysql_list_dbs(mConnection, NULL))) { theResult = [[MCPResult alloc] initWithResPtr: theResPtr encoding:stringEncoding timeZone:mTimeZone]; } else { @@ -2163,7 +2165,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) else { const char *theCDBsName = (const char *)[self cStringFromString:dbsName]; - if (theResPtr = mysql_list_dbs(mConnection, theCDBsName)) { + if ((theResPtr = mysql_list_dbs(mConnection, theCDBsName))) { theResult = [[MCPResult alloc] initWithResPtr:theResPtr encoding:stringEncoding timeZone:mTimeZone]; } else { @@ -2210,7 +2212,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) [self lockConnection]; if ((tablesName == nil) || ([tablesName isEqualToString:@""])) { - if (theResPtr = mysql_list_tables(mConnection, NULL)) { + if ((theResPtr = mysql_list_tables(mConnection, NULL))) { theResult = [[MCPResult alloc] initWithResPtr: theResPtr encoding:stringEncoding timeZone:mTimeZone]; } else { @@ -2219,7 +2221,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) } else { const char *theCTablesName = (const char *)[self cStringFromString:tablesName]; - if (theResPtr = mysql_list_tables(mConnection, theCTablesName)) { + if ((theResPtr = mysql_list_tables(mConnection, theCTablesName))) { theResult = [[MCPResult alloc] initWithResPtr: theResPtr encoding:stringEncoding timeZone:mTimeZone]; } else { @@ -2263,7 +2265,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) // NSLog(@"num of fields: %@; num of rows: %@", [theResult numOfFields], [theResult numOfRows]); if ([theResult numOfRows] > 0) { - int i; + my_ulonglong i; for ( i = 0 ; i < [theResult numOfRows] ; i++ ) { theTableName = [[theResult fetchRowAsArray] objectAtIndex:0]; [theDBTables addObject:theTableName]; @@ -2440,7 +2442,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) // Do not parse more than 2000 tables/views per db if([tablesAndViews count] > 2000) { - NSLog(@"%ld items in database %@. Only 2000 items can be parsed. Stopped parsing.", [tablesAndViews count], currentDatabase); + NSLog(@"%lu items in database %@. Only 2000 items can be parsed. Stopped parsing.", (unsigned long)[tablesAndViews count], currentDatabase); [queryPool release]; return; } @@ -2507,7 +2509,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) } // Connect - connectionSetupStatus = mysql_real_connect(structConnection, theHost, theLogin, thePass, NULL, connectionPort, theSocket, mConnectionFlags); + connectionSetupStatus = mysql_real_connect(structConnection, theHost, theLogin, thePass, NULL, (unsigned int)connectionPort, theSocket, mConnectionFlags); thePass = NULL; if (connectionSetupStatus) { MYSQL_RES *theResult; @@ -2558,12 +2560,12 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) if(![aTableName isKindOfClass:[NSString class]]) continue; if(![aTableName length]) continue; // Retrieve the column details - NSString *query = [NSString stringWithFormat:@"SHOW FULL COLUMNS FROM `%@` FROM `%@`", + query = [NSString stringWithFormat:@"SHOW FULL COLUMNS FROM `%@` FROM `%@`", [aTableName stringByReplacingOccurrencesOfString:@"`" withString:@"``"], currentDatabaseEscaped]; - NSData *encodedQueryData = NSStringDataUsingLossyEncoding(query, theConnectionEncoding, 1); - const char *queryCString = [encodedQueryData bytes]; - unsigned long queryCStringLength = [encodedQueryData length]; + encodedQueryData = NSStringDataUsingLossyEncoding(query, theConnectionEncoding, 1); + queryCString = [encodedQueryData bytes]; + queryCStringLength = [encodedQueryData length]; if (mysql_real_query(structConnection, queryCString, queryCStringLength) != 0) { // NSLog(@"error %@", aTableName); continue; @@ -2579,7 +2581,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) NSMutableDictionary *tableStructure = [databaseStructure objectForKey:table_id]; // Loop through the fields, extracting details for each - while (row = mysql_fetch_row(theResult)) { + while ((row = mysql_fetch_row(theResult))) { NSString *field = [self stringWithCString:row[0] usingEncoding:theConnectionEncoding] ; NSString *type = [self stringWithCString:row[1] usingEncoding:theConnectionEncoding] ; NSString *type_display = [type stringByReplacingOccurrencesOfRegex:@"\\(.*?,.*?\\)" withString:@"(…)"]; @@ -2627,10 +2629,9 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) queryCStringLength = [encodedQueryData length]; if (mysql_real_query(structConnection, queryCString, queryCStringLength) == 0) { theResult = mysql_use_result(structConnection); - NSUInteger numberOfFields = mysql_num_fields(theResult); // Loop through the rows and extract the function details - while(row = mysql_fetch_row(theResult)) { + while ((row = mysql_fetch_row(theResult))) { // If cancelled, abort without saving the new structure if(cancelQueryingDbStructure) { @@ -2643,7 +2644,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) NSString *type = ([[self stringWithUTF8CString:row[4]] isEqualToString:@"FUNCTION"]) ? @"3" : @"2"; NSString *dtd = [self stringWithUTF8CString:row[5]]; NSString *det = [self stringWithUTF8CString:row[11]]; - NSString *access = [self stringWithUTF8CString:row[12]]; + NSString *dataaccess = [self stringWithUTF8CString:row[12]]; NSString *security_type = [self stringWithUTF8CString:row[14]]; NSString *definer = [self stringWithUTF8CString:row[19]]; @@ -2659,7 +2660,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) // Add the "field" details [[[queriedStructure valueForKey:db_id] valueForKey:table_id] setObject: - [NSArray arrayWithObjects:dtd, access, det, security_type, definer, [NSNumber numberWithUnsignedLongLong:uniqueCounter], nil] forKey:field_id]; + [NSArray arrayWithObjects:dtd, dataaccess, det, security_type, definer, [NSNumber numberWithUnsignedLongLong:uniqueCounter], nil] forKey:field_id]; [[[queriedStructure valueForKey:db_id] valueForKey:table_id] setObject:type forKey:@" struct_type "]; uniqueCounter++; } @@ -2802,7 +2803,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) [self lockConnection]; if (mConnected && (mConnection != NULL)) { - if (theResPtr = mysql_list_processes(mConnection)) { + if ((theResPtr = mysql_list_processes(mConnection))) { result = [[MCPResult alloc] initWithResPtr:theResPtr encoding:stringEncoding timeZone:mTimeZone]; } else { @@ -2850,7 +2851,7 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) @"/opt/local/lib/mysql/mysql.sock", // Alternate fedora nil]; - for (NSInteger i = 0; i < [possibleSocketLocations count]; i++) + for (NSUInteger i = 0; i < [possibleSocketLocations count]; i++) { if ([fileManager fileExistsAtPath:[possibleSocketLocations objectAtIndex:i]]) return [possibleSocketLocations objectAtIndex:i]; @@ -3091,9 +3092,9 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) /** * Retrieves max_allowed_packet size set as global variable. - * It returns -1 if it fails. + * It returns NSNotFound if it fails. */ -- (NSInteger)getMaxAllowedPacket +- (NSUInteger)getMaxAllowedPacket { MCPResult *r; r = [self queryString:@"SELECT @@global.max_allowed_packet" usingEncoding:stringEncoding streamingResult:NO]; @@ -3105,13 +3106,13 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) else NSRunAlertPanel(@"Error", errorMessage, @"OK", nil, nil); } - return -1; + return NSNotFound; } NSArray *a = [r fetchRowAsArray]; if([a count]) return [[a objectAtIndex:0] integerValue]; - return -1; + return NSNotFound; } /* @@ -3120,21 +3121,22 @@ void pingThreadCleanup(MCPConnectionPingDetails *pingDetails) * if the maximal size was reached (e.g. set it to 4GB it'll return 1GB up to now). * If something failed it return -1; */ -- (NSInteger)setMaxAllowedPacketTo:(NSInteger)newSize resetSize:(BOOL)reset +- (NSUInteger)setMaxAllowedPacketTo:(NSUInteger)newSize resetSize:(BOOL)reset { if(![self isMaxAllowedPacketEditable] || newSize < 1024) return maxAllowedPacketSize; [self lockConnection]; - mysql_query(mConnection, [[NSString stringWithFormat:@"SET GLOBAL max_allowed_packet = %ld", newSize] UTF8String]); + mysql_query(mConnection, [[NSString stringWithFormat:@"SET GLOBAL max_allowed_packet = %lu", newSize] UTF8String]); [self unlockConnection]; // Inform the user via a log entry about that change according to reset value - if(delegate && [delegate respondsToSelector:@selector(queryGaveError:connection:)]) + if(delegate && [delegate respondsToSelector:@selector(queryGaveError:connection:)]) { if(reset) - [delegate queryGaveError:[NSString stringWithFormat:@"max_allowed_packet was reset to %ld for new session", newSize] connection:self]; + [delegate queryGaveError:[NSString stringWithFormat:@"max_allowed_packet was reset to %lu for new session", newSize] connection:self]; else - [delegate queryGaveError:[NSString stringWithFormat:@"Query too large; max_allowed_packet temporarily set to %ld for the current session to allow query to succeed", newSize] connection:self]; - + [delegate queryGaveError:[NSString stringWithFormat:@"Query too large; max_allowed_packet temporarily set to %lu for the current session to allow query to succeed", newSize] connection:self]; + } + return maxAllowedPacketSize; } diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionDelegate.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionDelegate.h index 3cbba325..0e162875 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionDelegate.h +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionDelegate.h @@ -26,7 +26,7 @@ // More info at <http://mysql-cocoa.sourceforge.net/> // More info at <http://code.google.com/p/sequel-pro/> -@protocol MCPConnectionDelegate +@protocol MCPConnectionDelegate <NSObject> /** * diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionProxy.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionProxy.h index 6d03137c..f4edbfd8 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionProxy.h +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnectionProxy.h @@ -60,7 +60,7 @@ enum PROXY_TUNNEL_STATES /** * Get the local port being used by the proxy. */ -- (NSInteger)localPort; +- (NSUInteger)localPort; /** * Sets the method the proxy should call whenever the state of the connection changes. diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.h b/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.h index cca59b30..9af3fcfe 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.h +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.h @@ -42,7 +42,7 @@ typedef struct st_point_2d_ double y; } st_point_2d; -@interface MCPGeometryData : NSObject <NSCoding, NSCopying> +@interface MCPGeometryData : NSObject { // Holds the WKB bytes coming from SQL server Byte *geoBuffer; @@ -52,8 +52,8 @@ typedef struct st_point_2d_ } -- (id)initWithBytes:(Byte*)geoData length:(NSUInteger)length; -+ (id)dataWithBytes:(Byte*)geoData length:(NSUInteger)length; +- (id)initWithBytes:(const void *)geoData length:(NSUInteger)length; ++ (id)dataWithBytes:(const void *)geoData length:(NSUInteger)length; - (NSString*)description; - (NSUInteger)length; - (NSData*)data; diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m b/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m index 00d7d44f..b7a3fd09 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m @@ -47,7 +47,7 @@ /** * Initialize the MCPGeometryData object with the WKB data */ -- (id)initWithBytes:(Byte*)geoData length:(NSUInteger)length +- (id)initWithBytes:(const void *)geoData length:(NSUInteger)length { if ((self = [self init])) { bufferLength = length; @@ -60,7 +60,7 @@ /** * Return an autorelease MCPGeometryData object */ -+ (id)dataWithBytes:(Byte*)geoData length:(NSUInteger)length ++ (id)dataWithBytes:(const void *)geoData length:(NSUInteger)length { return [[[MCPGeometryData alloc] initWithBytes:geoData length:length] autorelease]; } @@ -370,10 +370,10 @@ uint32_t i, j, k, n; // Loop counter for numberOf...Items uint32_t ptr = BUFFER_START; // pointer to geoBuffer while parsing - double x_min = 1e998; - double x_max = -1e998; - double y_min = 1e998; - double y_max = -1e998; + double x_min = DBL_MAX; + double x_max = -DBL_MAX; + double y_min = DBL_MAX; + double y_max = -DBL_MAX; NSMutableArray *coordinates = [NSMutableArray array]; NSMutableArray *subcoordinates = [NSMutableArray array]; @@ -406,7 +406,7 @@ x_max = aPoint.x; y_min = aPoint.y; y_max = aPoint.y; - [coordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [coordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; return [NSDictionary dictionaryWithObjectsAndKeys: [NSArray arrayWithObjects: [NSNumber numberWithDouble:x_min], @@ -429,7 +429,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [coordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [coordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE; } return [NSDictionary dictionaryWithObjectsAndKeys: @@ -456,7 +456,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [subcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [subcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE; } [coordinates addObject:[[subcoordinates copy] autorelease]]; @@ -484,7 +484,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [coordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [coordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE+WKB_HEADER_SIZE; } return [NSDictionary dictionaryWithObjectsAndKeys: @@ -512,7 +512,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [subcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [subcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE; } ptr += WKB_HEADER_SIZE; @@ -547,7 +547,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [subcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [subcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE; } [coordinates addObject:[[subcoordinates copy] autorelease]]; @@ -591,7 +591,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [pointcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [pointcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE; break; @@ -604,7 +604,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [linesubcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [linesubcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE; } [linecoordinates addObject:[[linesubcoordinates copy] autorelease]]; @@ -623,7 +623,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [polygonsubcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [polygonsubcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE; } [polygoncoordinates addObject:[[polygonsubcoordinates copy] autorelease]]; @@ -640,7 +640,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [pointcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [pointcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE+WKB_HEADER_SIZE; } ptr -= WKB_HEADER_SIZE; @@ -658,7 +658,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [linesubcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [linesubcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE; } [linecoordinates addObject:[[linesubcoordinates copy] autorelease]]; @@ -683,7 +683,7 @@ x_max = (aPoint.x > x_max) ? aPoint.x : x_max; y_min = (aPoint.y < y_min) ? aPoint.y : y_min; y_max = (aPoint.y > y_max) ? aPoint.y : y_max; - [polygonsubcoordinates addObject:NSStringFromPoint(NSMakePoint(aPoint.x, aPoint.y))]; + [polygonsubcoordinates addObject:NSStringFromPoint(NSMakePoint((CGFloat)aPoint.x, (CGFloat)aPoint.y))]; ptr += POINT_DATA_SIZE; } [polygoncoordinates addObject:[[polygonsubcoordinates copy] autorelease]]; @@ -728,7 +728,7 @@ NSUInteger ptr = BUFFER_START; // pointer to geoBuffer while parsing if (bufferLength < WKB_HEADER_SIZE) - return @"-1"; + return -1; byteOrder = geoBuffer[ptr]; diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPNumber.m b/Frameworks/MCPKit/MCPFoundationKit/MCPNumber.m index 3dab0e07..de035ee8 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPNumber.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPNumber.m @@ -246,12 +246,12 @@ - (int)intValue { - return [number integerValue]; + return [number intValue]; } - (unsigned int)unsignedIntValue { - return [number unsignedIntegerValue]; + return [number unsignedIntValue]; } - (long)longValue @@ -276,7 +276,7 @@ - (float)floatValue { - return [number doubleValue]; + return [number floatValue]; } - (double)doubleValue diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m index 24d14193..53066c14 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m @@ -227,7 +227,7 @@ const OUR_CHARSET our_charsets60[] = */ + (void)initialize { - if (self = [MCPResult class]) { + if ((self = [MCPResult class])) { [self setVersion:030001]; // Ma.Mi.Re -> MaMiRe MCPYear0000 = [NSCalendarDate dateWithTimeIntervalSinceReferenceDate:-63146822400.0]; [MCPYear0000 setCalendarFormat:@"%Y"]; @@ -367,7 +367,7 @@ const OUR_CHARSET our_charsets60[] = */ - (void)dataSeek:(my_ulonglong)row { - my_ulonglong theRow = (row < 0)? 0 : row; + my_ulonglong theRow = (row < 1)? 0 : row; theRow = (theRow < [self numOfRows]) ? theRow : ([self numOfRows] - 1); mysql_data_seek(mResult,theRow); } @@ -380,7 +380,7 @@ const OUR_CHARSET our_charsets60[] = MYSQL_ROW theRow; unsigned long *theLengths; MYSQL_FIELD *theField; - NSInteger i; + NSUInteger i; id theReturn; if (mResult == NULL) { @@ -405,7 +405,7 @@ const OUR_CHARSET our_charsets60[] = theReturn = [NSMutableDictionary dictionaryWithCapacity:mNumOfFields]; break; default : - NSLog (@"Unknown type : %d, will return an Array!\n", aType); + NSLog (@"Unknown type : %d, will return an Array!\n", (int)aType); theReturn = [NSMutableArray arrayWithCapacity:mNumOfFields]; break; } @@ -474,7 +474,7 @@ const OUR_CHARSET our_charsets60[] = break; default: - NSLog (@"in fetchRowAsType : Unknown type : %ld for column %ld, send back a NSData object", (NSInteger)theField[i].type, (NSInteger)i); + NSLog (@"in fetchRowAsType : Unknown type : %d for column %lu, send back a NSData object", (int)theField[i].type, (unsigned long)i); theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]]; break; } @@ -542,7 +542,7 @@ const OUR_CHARSET our_charsets60[] = */ - (NSArray *)fetchFieldNames { - NSInteger i; + NSUInteger i; NSUInteger theNumFields; NSMutableArray *theNamesArray; MYSQL_FIELD *theField; @@ -581,7 +581,7 @@ const OUR_CHARSET our_charsets60[] = */ - (id)fetchTypesAsType:(MCPReturnType)aType { - NSInteger i; + NSUInteger i; id theTypes; MYSQL_FIELD *theField; @@ -601,7 +601,7 @@ const OUR_CHARSET our_charsets60[] = theTypes = [NSMutableDictionary dictionaryWithCapacity:mNumOfFields]; break; default : - NSLog (@"Unknown type : %d, will return an Array!\n", aType); + NSLog (@"Unknown type : %d, will return an Array!\n", (int)aType); theTypes = [NSMutableArray arrayWithCapacity:mNumOfFields]; break; } @@ -686,7 +686,7 @@ const OUR_CHARSET our_charsets60[] = break; default: theType = @"unknown"; - NSLog (@"in fetchTypesAsArray : Unknown type for column %ld of the MCPResult, type = %ld", (NSInteger)i, (NSInteger)theField[i].type); + NSLog (@"in fetchTypesAsArray : Unknown type for column %lu of the MCPResult, type = %d", (unsigned long)i, (int)theField[i].type); break; } @@ -843,7 +843,7 @@ const OUR_CHARSET our_charsets60[] = /** * Return the MySQL flags of the column at the given index... Can be used to check if a number is signed or not... */ -- (NSUInteger)fetchFlagsAtIndex:(NSUInteger)index +- (NSUInteger)fetchFlagsAtIndex:(NSUInteger)anIndex { NSUInteger theRet; NSUInteger theNumFields; @@ -857,12 +857,12 @@ const OUR_CHARSET our_charsets60[] = theNumFields = [self numOfFields]; theField = mysql_fetch_fields(mResult); - if (index >= theNumFields) { + if (anIndex >= theNumFields) { // Out of range... should raise an exception theRet = 0; } else { - theRet = theField[index].flags; + theRet = theField[anIndex].flags; } return theRet; @@ -874,7 +874,7 @@ const OUR_CHARSET our_charsets60[] = - (NSUInteger)fetchFlagsForKey:(NSString *)key { NSUInteger theRet; - NSUInteger index; + NSUInteger anIndex; MYSQL_FIELD *theField; if (mResult == NULL) { @@ -893,9 +893,9 @@ const OUR_CHARSET our_charsets60[] = theRet = 0; } else { - index = [mNames indexOfObject:key]; + anIndex = [mNames indexOfObject:key]; - theRet = theField[index].flags; + theRet = theField[anIndex].flags; } return theRet; @@ -911,7 +911,7 @@ const OUR_CHARSET our_charsets60[] = * #{NOTE} That the current version handles properly TEXT, and returns those as NSString (and not NSData as * it used to be). */ -- (BOOL)isBlobAtIndex:(NSUInteger)index +- (BOOL)isBlobAtIndex:(NSUInteger)anIndex { BOOL theRet; NSUInteger theNumFields; @@ -925,17 +925,17 @@ const OUR_CHARSET our_charsets60[] = theNumFields = [self numOfFields]; theField = mysql_fetch_fields(mResult); - if (index >= theNumFields) { + if (anIndex >= theNumFields) { // Out of range... should raise an exception theRet = NO; } else { - switch(theField[index].type) { + switch(theField[anIndex].type) { case FIELD_TYPE_TINY_BLOB: case FIELD_TYPE_BLOB: case FIELD_TYPE_MEDIUM_BLOB: case FIELD_TYPE_LONG_BLOB: - theRet = (theField[index].flags & BINARY_FLAG); + theRet = (theField[anIndex].flags & BINARY_FLAG); break; default: theRet = NO; @@ -959,7 +959,7 @@ const OUR_CHARSET our_charsets60[] = - (BOOL)isBlobForKey:(NSString *)key { BOOL theRet; - NSUInteger index; + NSUInteger anIndex; MYSQL_FIELD *theField; if (mResult == NULL) { @@ -978,14 +978,14 @@ const OUR_CHARSET our_charsets60[] = theRet = NO; } else { - index = [mNames indexOfObject:key]; + anIndex = [mNames indexOfObject:key]; - switch(theField[index].type) { + switch(theField[anIndex].type) { case FIELD_TYPE_TINY_BLOB: case FIELD_TYPE_BLOB: case FIELD_TYPE_MEDIUM_BLOB: case FIELD_TYPE_LONG_BLOB: - theRet = (theField[index].flags & BINARY_FLAG); + theRet = (theField[anIndex].flags & BINARY_FLAG); break; default: theRet = NO; @@ -1043,10 +1043,10 @@ const OUR_CHARSET our_charsets60[] = } else { NSMutableString *theString = [NSMutableString stringWithCapacity:0]; - NSInteger i; + NSUInteger i; NSArray *theRow; MYSQL_ROW_OFFSET thePosition; - BOOL trunc = [MCPConnection truncateLongField]; + BOOL shouldTruncateFields = [MCPConnection truncateLongField]; // First line, saying we are displaying a MCPResult [theString appendFormat:@"MCPResult: (encoding : %ld, dim %ld x %ld)\n", (long)mEncoding, (long)mNumOfFields, (long)[self numOfRows]]; @@ -1063,11 +1063,11 @@ const OUR_CHARSET our_charsets60[] = thePosition = mysql_row_tell(mResult); [self dataSeek:0]; - while (theRow = [self fetchRowAsArray]) + while ((theRow = [self fetchRowAsArray])) { id theField = [theRow objectAtIndex:i]; - if (trunc) { + if (shouldTruncateFields) { if (([theField isKindOfClass:[NSString class]]) && (kLengthOfTruncationForLog < [(NSString *)theField length])) { theField = [theField substringToIndex:kLengthOfTruncationForLog]; } diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPResultPlus.m b/Frameworks/MCPKit/MCPFoundationKit/MCPResultPlus.m index c171dc7f..dbf9d070 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPResultPlus.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPResultPlus.m @@ -42,7 +42,7 @@ */ - (NSArray *)fetchColAtIndex:(NSUInteger)col { - NSMutableArray *theCol = [NSMutableArray arrayWithCapacity:[self numOfRows]]; + NSMutableArray *theCol = [NSMutableArray arrayWithCapacity:(NSUInteger)[self numOfRows]]; MYSQL_ROW_OFFSET thePosition; NSArray *theRow; @@ -61,7 +61,7 @@ [self dataSeek:0]; // One might want to have optimized code here. Maybe in later versions - while (theRow = [self fetchRowAsType:MCPTypeArray]) + while ((theRow = [self fetchRowAsType:MCPTypeArray])) { [theCol addObject:[theRow objectAtIndex:col]]; } @@ -131,9 +131,9 @@ switch (type) { case MCPTypeArray : - theTable = [NSMutableArray arrayWithCapacity:[self numOfRows]]; + theTable = [NSMutableArray arrayWithCapacity:(NSUInteger)[self numOfRows]]; - while (theVect = [self fetchRowAsArray]) + while ((theVect = [self fetchRowAsArray])) { [theTable addObject:theVect]; } @@ -141,9 +141,9 @@ theTable = [NSArray arrayWithArray:theTable]; break; case MCPTypeDictionary : - theTable = [NSMutableArray arrayWithCapacity:[self numOfRows]]; + theTable = [NSMutableArray arrayWithCapacity:(NSUInteger)[self numOfRows]]; - while (theVect = [self fetchRowAsDictionary]) + while ((theVect = [self fetchRowAsDictionary])) { [theTable addObject:theVect]; } @@ -175,7 +175,7 @@ theTable = [NSDictionary dictionaryWithDictionary:theTable]; break; default : - NSLog (@"Unknown MCPReturnType : %ld; return nil\n", (NSInteger)type); + NSLog (@"Unknown MCPReturnType : %d; return nil\n", (int)type); theTable = nil; break; } diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m index c15db6c6..465221fe 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m @@ -164,7 +164,7 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf); MYSQL_ROW theRow; char *theRowData, *buf; unsigned long *fieldLengths; - NSInteger i, copiedDataLength; + NSUInteger i, copiedDataLength; NSMutableArray *returnArray; // Retrieve the next row according to the mode this result set is in. @@ -290,7 +290,7 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf); // Get a binary representation of the data buf = malloc(fieldDefinitions[i].length + 1); - _bytes2bin(theData, fieldLengths[i], fieldDefinitions[i].length, buf); + _bytes2bin((Byte *)theData, fieldLengths[i], fieldDefinitions[i].length, buf); cellData = (theData != NULL) ? [NSString stringWithUTF8String:buf] : @""; @@ -323,7 +323,7 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf); break; default: - NSLog(@"in fetchNextRowAsArray : Unknown type : %ld for column %ld, sending back a NSData object", (NSInteger)fieldDefinitions[i].type, (NSInteger)i); + NSLog(@"in fetchNextRowAsArray : Unknown type : %d for column %lu, sending back a NSData object", (int)fieldDefinitions[i].type, (unsigned long)i); cellData = [NSData dataWithBytes:theData length:fieldLengths[i]]; break; } @@ -435,10 +435,10 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf); void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf) { - int i = 0; + NSUInteger i = 0; nbytes--; - while (i < len) - buf[len - ++i] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0'; + while (++i <= len) + buf[len - i] = ( (n[nbytes - (i >> 3)] >> (i & 0x7)) & 1 ) ? '1' : '0'; buf[len] = '\0'; } @@ -451,14 +451,14 @@ void _bytes2bin(Byte *n, NSUInteger nbytes, NSUInteger len, char *buf) NSAutoreleasePool *downloadPool = [[NSAutoreleasePool alloc] init]; MYSQL_ROW theRow; unsigned long *fieldLengths; - NSInteger i, dataCopiedLength, rowDataLength; + NSUInteger i, dataCopiedLength, rowDataLength; LOCAL_ROW_DATA *newRowStore; size_t sizeOfLocalRowData = sizeof(LOCAL_ROW_DATA); size_t sizeOfDataLengths = (size_t)(sizeof(unsigned long) * mNumOfFields); // Loop through the rows until the end of the data is reached - indicated via a NULL - while ( (BOOL)(*isConnectedPtr)(parentConnection, isConnectedSEL) && (theRow = mysql_fetch_row(mResult))) { + while ((*isConnectedPtr)(parentConnection, isConnectedSEL) && (theRow = mysql_fetch_row(mResult))) { // Retrieve the lengths of the returned data fieldLengths = mysql_fetch_lengths(mResult); diff --git a/Frameworks/MCPKit/Support files/NSNotificationAdditions.m b/Frameworks/MCPKit/Support files/NSNotificationAdditions.m index d615231e..9991c999 100644 --- a/Frameworks/MCPKit/Support files/NSNotificationAdditions.m +++ b/Frameworks/MCPKit/Support files/NSNotificationAdditions.m @@ -26,6 +26,12 @@ #import "NSNotificationAdditions.h" #import "pthread.h" +@interface NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI) ++ (void)_postNotification:(NSNotification *)notification; ++ (void)_postNotificationName:(NSDictionary *)info; ++ (void)_postNotificationForwarder:(NSDictionary *)info; +@end + @implementation NSNotificationCenter (NSNotificationCenterAdditions) - (void)postNotificationOnMainThread:(NSNotification *)notification @@ -35,16 +41,11 @@ [self postNotificationOnMainThread:notification waitUntilDone:NO]; } -- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait +- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone { if (pthread_main_np()) return [self postNotification:notification]; - [[self class] performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:wait]; -} - -+ (void)_postNotification:(NSNotification *)notification -{ - [[self defaultCenter] postNotification:notification]; + [self performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone]; } - (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object @@ -61,7 +62,7 @@ [self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO]; } -- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone { if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo]; @@ -71,11 +72,20 @@ if (object) [info setObject:object forKey:@"object"]; if (userInfo) [info setObject:userInfo forKey:@"userInfo"]; - [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:wait]; + [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone]; [info release]; } +@end + +@implementation NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI) + ++ (void)_postNotification:(NSNotification *)notification +{ + [[self defaultCenter] postNotification:notification]; +} + + (void)_postNotificationName:(NSDictionary *)info { NSString *name = [info objectForKey:@"name"]; @@ -87,4 +97,15 @@ [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo]; } ++ (void)_postNotificationForwarder:(NSDictionary *)info +{ + NSString *name = [info objectForKey:@"name"]; + + id object = [info objectForKey:@"object"]; + + NSDictionary *userInfo = [info objectForKey:@"userInfo"]; + + [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo]; +} + @end diff --git a/Resources/English.lproj/BundleEditor.strings b/Resources/English.lproj/BundleEditor.strings Binary files differindex 17be5976..56496dce 100644 --- a/Resources/English.lproj/BundleEditor.strings +++ b/Resources/English.lproj/BundleEditor.strings diff --git a/Resources/English.lproj/DBView.strings b/Resources/English.lproj/DBView.strings Binary files differindex 35f47990..aa6a0a4d 100644 --- a/Resources/English.lproj/DBView.strings +++ b/Resources/English.lproj/DBView.strings diff --git a/Resources/English.lproj/FieldEditorSheet.strings b/Resources/English.lproj/FieldEditorSheet.strings Binary files differindex d2995a33..ebd17ce7 100644 --- a/Resources/English.lproj/FieldEditorSheet.strings +++ b/Resources/English.lproj/FieldEditorSheet.strings diff --git a/Resources/English.lproj/Localizable.strings b/Resources/English.lproj/Localizable.strings Binary files differindex 101f45e3..dac7c145 100644 --- a/Resources/English.lproj/Localizable.strings +++ b/Resources/English.lproj/Localizable.strings diff --git a/Source/NSNotificationAdditions.m b/Source/NSNotificationAdditions.m index 53917dae..ae949347 100644 --- a/Source/NSNotificationAdditions.m +++ b/Source/NSNotificationAdditions.m @@ -24,7 +24,13 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "NSNotificationAdditions.h" -#import <pthread.h> +#import "pthread.h" + +@interface NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI) ++ (void)_postNotification:(NSNotification *)notification; ++ (void)_postNotificationName:(NSDictionary *)info; ++ (void)_postNotificationForwarder:(NSDictionary *)info; +@end @implementation NSNotificationCenter (NSNotificationCenterAdditions) @@ -35,16 +41,11 @@ [self postNotificationOnMainThread:notification waitUntilDone:NO]; } -- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)wait +- (void)postNotificationOnMainThread:(NSNotification *)notification waitUntilDone:(BOOL)shouldWaitUntilDone { if (pthread_main_np()) return [self postNotification:notification]; - [[self class] performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:wait]; -} - -+ (void)_postNotification:(NSNotification *)notification -{ - [[self defaultCenter] postNotification:notification]; + [self performSelectorOnMainThread:@selector(_postNotification:) withObject:notification waitUntilDone:shouldWaitUntilDone]; } - (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object @@ -61,21 +62,30 @@ [self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO]; } -- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)wait +- (void)postNotificationOnMainThreadWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)shouldWaitUntilDone { if (pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo]; - + NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:3]; if (name) [info setObject:name forKey:@"name"]; if (object) [info setObject:object forKey:@"object"]; if (userInfo) [info setObject:userInfo forKey:@"userInfo"]; - - [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:wait]; - + + [[self class] performSelectorOnMainThread:@selector(_postNotificationName:) withObject:info waitUntilDone:shouldWaitUntilDone]; + [info release]; } +@end + +@implementation NSNotificationCenter (NSNotificationCenterAdditions_PrivateAPI) + ++ (void)_postNotification:(NSNotification *)notification +{ + [[self defaultCenter] postNotification:notification]; +} + + (void)_postNotificationName:(NSDictionary *)info { NSString *name = [info objectForKey:@"name"]; @@ -83,7 +93,18 @@ id object = [info objectForKey:@"object"]; NSDictionary *userInfo = [info objectForKey:@"userInfo"]; + + [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo]; +} + ++ (void)_postNotificationForwarder:(NSDictionary *)info +{ + NSString *name = [info objectForKey:@"name"]; + id object = [info objectForKey:@"object"]; + + NSDictionary *userInfo = [info objectForKey:@"userInfo"]; + [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo]; } diff --git a/Source/SPAlertSheets.m b/Source/SPAlertSheets.m index 3299c351..b9ac1136 100644 --- a/Source/SPAlertSheets.m +++ b/Source/SPAlertSheets.m @@ -22,6 +22,8 @@ // // More info at <http://code.google.com/p/sequel-pro/> +#import "SPAlertSheets.h" + /** * Provide a simple alias of NSBeginAlertSheet, with a few differences: * - printf-type format strings are no longer supported within the "msg" @@ -101,7 +103,7 @@ void SPBeginWaitingAlertSheet( // Initialize returnCode with a value which can't be returned as // returnCode in the didEndSelector method NSInteger initialReturnCode = -5; - returnCode = initialReturnCode; + returnCode = &initialReturnCode; // Set up an NSAlert with the supplied details NSAlert *alert = [[[NSAlert alloc] init] autorelease]; @@ -141,7 +143,7 @@ void SPBeginWaitingAlertSheet( // Since the returnCode can only be -1, 0, or 1 // run the session until returnCode was changed in // the didEndSelector method of the calling class - if(returnCode != initialReturnCode) + if(returnCode != &initialReturnCode) break; // Execute code on DefaultRunLoop diff --git a/Source/SPDataAdditions.m b/Source/SPDataAdditions.m index b0a4e6d2..805692c6 100644 --- a/Source/SPDataAdditions.m +++ b/Source/SPDataAdditions.m @@ -57,8 +57,8 @@ static char base64encodingTable[64] = { NSUInteger lentext = [self length]; NSInteger ctremaining = 0; unsigned char inbuf[3], outbuf[4]; - short i = 0; - short charsonline = 0, ctcopy = 0; + NSUInteger i = 0; + NSUInteger charsonline = 0, ctcopy = 0; NSUInteger ix = 0; NSMutableString *base64 = [NSMutableString stringWithCapacity:lentext]; @@ -111,7 +111,7 @@ static char base64encodingTable[64] = { - (NSData *)dataEncryptedWithPassword:(NSString *)password { // Create a random 128-bit initialization vector - srand(time(NULL)); + srand((unsigned int)time(NULL)); NSInteger ivIndex; unsigned char iv[16]; for (ivIndex = 0; ivIndex < 16; ivIndex++) @@ -131,7 +131,7 @@ static char base64encodingTable[64] = { memcpy(paddedBytes, [self bytes], dataLength); // The last 32-bit chunk is the size of the plaintext, which is encrypted with the plaintext - NSInteger bigIntDataLength = NSSwapHostIntToBig(dataLength); + NSInteger bigIntDataLength = NSSwapHostIntToBig((unsigned int)dataLength); memcpy(paddedBytes + (paddedLength - 4), &bigIntDataLength, 4); // Create the key from first 128-bits of the 160-bit password hash @@ -180,7 +180,7 @@ static char base64encodingTable[64] = { // Get the size of the data from the last 32-bit chunk NSInteger bigIntDataLength = *((UInt32*)decryptedBytes + ((encryptedLength / 4) - 1)); - NSInteger dataLength = NSSwapBigIntToHost(bigIntDataLength); + NSInteger dataLength = NSSwapBigIntToHost((unsigned int)bigIntDataLength); return [NSData dataWithBytesNoCopy:decryptedBytes length:dataLength]; } @@ -198,7 +198,7 @@ static char base64encodingTable[64] = { z_stream zlibStream; zlibStream.next_in = (Bytef *)[self bytes]; - zlibStream.avail_in = [self length]; + zlibStream.avail_in = (uInt)[self length]; zlibStream.total_out = 0; zlibStream.zalloc = Z_NULL; zlibStream.zfree = Z_NULL; @@ -210,7 +210,7 @@ static char base64encodingTable[64] = { if (zlibStream.total_out >= [unzipData length]) [unzipData increaseLengthBy: half_length]; zlibStream.next_out = [unzipData mutableBytes] + zlibStream.total_out; - zlibStream.avail_out = [unzipData length] - zlibStream.total_out; + zlibStream.avail_out = (uInt)([unzipData length] - zlibStream.total_out); status = inflate (&zlibStream, Z_SYNC_FLUSH); if (status == Z_STREAM_END) done = YES; @@ -238,7 +238,7 @@ static char base64encodingTable[64] = { zlibStream.opaque = Z_NULL; zlibStream.total_out = 0; zlibStream.next_in=(Bytef *)[self bytes]; - zlibStream.avail_in = [self length]; + zlibStream.avail_in = (uInt)[self length]; if (deflateInit(&zlibStream, Z_DEFAULT_COMPRESSION) != Z_OK) return nil; @@ -251,7 +251,7 @@ static char base64encodingTable[64] = { [zipData increaseLengthBy: 16384]; zlibStream.next_out = [zipData mutableBytes] + zlibStream.total_out; - zlibStream.avail_out = [zipData length] - zlibStream.total_out; + zlibStream.avail_out = (uInt)([zipData length] - zlibStream.total_out); deflate(&zlibStream, Z_FINISH); diff --git a/Source/SPExportFileUtilities.m b/Source/SPExportFileUtilities.m index b4d31d67..d39aee17 100644 --- a/Source/SPExportFileUtilities.m +++ b/Source/SPExportFileUtilities.m @@ -138,8 +138,17 @@ } } } - - + + // Compare the count of exported files to the count of failed files + NSUInteger totalFilesExported = [exportFiles count]; + + // If all the files failed, show a simplified export dialog + + + // If only some of the files failed, show an export dialog with the option to ignore the failed files. + + + // For single files, show a dialog very close to the OS dialog if (i > 0) { NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Error creating export files", @"export file handle creation error message") diff --git a/Source/SPExportFilenameUtilities.m b/Source/SPExportFilenameUtilities.m index 0695d29e..7ce7b3a2 100644 --- a/Source/SPExportFilenameUtilities.m +++ b/Source/SPExportFilenameUtilities.m @@ -78,7 +78,7 @@ filename = @"query_result"; break; case SPTableExport: - filename = [tableDocumentInstance database]; + filename = [NSString stringWithFormat:@"%@_%@", [tableDocumentInstance database], [[NSDate date] descriptionWithCalendarFormat:@"%Y-%m-%d" timeZone:nil locale:nil]]; break; } diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m index ed60846f..f1868210 100644 --- a/Source/SPExportInitializer.m +++ b/Source/SPExportInitializer.m @@ -280,7 +280,7 @@ [sqlExporter setSqlExportTables:exportTables]; // Create custom filename if required - [exportFilename setString:(createCustomFilename) ? [self expandCustomFilenameFormatFromString:[exportCustomFilenameTokenField stringValue] usingTableName:nil] : [NSString stringWithFormat:@"%@_%@", [tableDocumentInstance database], [[NSDate date] descriptionWithCalendarFormat:@"%Y-%m-%d" timeZone:nil locale:nil]]]; + [exportFilename setString:(createCustomFilename) ? [self expandCustomFilenameFormatFromString:[exportCustomFilenameTokenField stringValue] usingTableName:nil] : [self generateDefaultExportFilename]]; [exportFilename setString:[exportFilename stringByAppendingPathExtension:[self currentDefaultExportFileExtension]]]; diff --git a/Source/SPKeychain.m b/Source/SPKeychain.m index 335c0a0b..bb010d3b 100644 --- a/Source/SPKeychain.m +++ b/Source/SPKeychain.m @@ -66,7 +66,7 @@ NSArray *trustedApps = [NSArray arrayWithObjects:(id)sequelProRef, (id)sequelProHelperRef, nil]; status = SecAccessCreate((CFStringRef)name, (CFArrayRef)trustedApps, &passwordAccessRef); if (status != noErr) { - NSLog(@"Error (%i) while trying to create access list for name: %@ account: %@", status, name, account); + NSLog(@"Error (%i) while trying to create access list for name: %@ account: %@", (int)status, name, account); passwordAccessRef = NULL; } } @@ -77,13 +77,13 @@ attributes[0].length = 20; attributes[1].tag = kSecLabelItemAttr; attributes[1].data = (unichar *)[label UTF8String]; - attributes[1].length = strlen([label UTF8String]); + attributes[1].length = (UInt32)strlen([label UTF8String]); attributes[2].tag = kSecAccountItemAttr; attributes[2].data = (unichar *)[account UTF8String]; - attributes[2].length = strlen([account UTF8String]); + attributes[2].length = (UInt32)strlen([account UTF8String]); attributes[3].tag = kSecServiceItemAttr; attributes[3].data = (unichar *)[name UTF8String]; - attributes[3].length = strlen([name UTF8String]); + attributes[3].length = (UInt32)strlen([name UTF8String]); attList.count = 4; attList.attr = attributes; @@ -91,7 +91,7 @@ status = SecKeychainItemCreateFromContent( kSecGenericPasswordItemClass, // Generic password type &attList, // The attribute list created for the keychain item - strlen([password UTF8String]), // Length of password + (UInt32)strlen([password UTF8String]), // Length of password [password UTF8String], // Password data NULL, // Default keychain passwordAccessRef, // Access list for this keychain @@ -100,7 +100,7 @@ if (passwordAccessRef) CFRelease(passwordAccessRef); if (status != noErr) { - NSLog(@"Error (%i) while trying to add password for name: %@ account: %@", status, name, account); + NSLog(@"Error (%i) while trying to add password for name: %@ account: %@", (int)status, name, account); SPBeginAlertSheet(NSLocalizedString(@"Error adding password to Keychain", @"error adding password to keychain message"), NSLocalizedString(@"OK", @"OK button"), @@ -127,15 +127,15 @@ if (!account) account = @""; status = SecKeychainFindGenericPassword( - NULL, // default keychain - strlen([name UTF8String]), // length of service name (bytes) - [name UTF8String], // service name - - strlen([account UTF8String]), // length of account name (bytes) - [account UTF8String], // account name - &passwordLength, // length of password - &passwordData, // pointer to password data - &itemRef // the item reference + NULL, // default keychain + (UInt32)strlen([name UTF8String]), // length of service name (bytes) + [name UTF8String], // service name + + (UInt32)strlen([account UTF8String]), // length of account name (bytes) + [account UTF8String], // account name + &passwordLength, // length of password + &passwordData, // pointer to password data + &itemRef // the item reference ); if (status == noErr) { @@ -171,21 +171,21 @@ // Check if password already exists before deleting if ([self passwordExistsForName:name account:account]) { status = SecKeychainFindGenericPassword( - NULL, // default keychain - strlen([name UTF8String]), // length of service name - [name UTF8String], // service name - strlen([account UTF8String]), // length of account name - [account UTF8String], // account name - nil, // length of password - nil, // pointer to password data - &itemRef // the item reference + NULL, // default keychain + (UInt32)strlen([name UTF8String]), // length of service name + [name UTF8String], // service name + (UInt32)strlen([account UTF8String]), // length of account name + [account UTF8String], // account name + nil, // length of password + nil, // pointer to password data + &itemRef // the item reference ); if (status == noErr) { status = SecKeychainItemDelete(itemRef); if (status != noErr) { - NSLog(@"Error (%i) while trying to delete password for name: %@ account: %@", status, name, account); + NSLog(@"Error (%i) while trying to delete password for name: %@ account: %@", (int)status, name, account); } } @@ -209,12 +209,12 @@ if (!account) account = @""; attributes[0].tag = kSecAccountItemAttr; - attributes[0].data = (void *)[account UTF8String]; // Account name - attributes[0].length = strlen([account UTF8String]); // Length of account name (bytes) + attributes[0].data = (void *)[account UTF8String]; // Account name + attributes[0].length = (UInt32)strlen([account UTF8String]); // Length of account name (bytes) attributes[1].tag = kSecServiceItemAttr; - attributes[1].data = (void *)[name UTF8String]; // Service name - attributes[1].length = strlen([name UTF8String]); // Length of service name (bytes) + attributes[1].data = (void *)[name UTF8String]; // Service name + attributes[1].length = (UInt32)strlen([name UTF8String]); // Length of service name (bytes) list.count = 2; list.attr = attributes; diff --git a/Source/SPSSHTunnel.h b/Source/SPSSHTunnel.h index 4afec738..bf7fd8a4 100644 --- a/Source/SPSSHTunnel.h +++ b/Source/SPSSHTunnel.h @@ -48,8 +48,8 @@ NSLock *debugMessagesLock; NSInteger sshPort; NSInteger remotePort; - NSInteger localPort; - NSInteger localPortFallback; + NSUInteger localPort; + NSUInteger localPortFallback; NSInteger connectionState; NSLock *answerAvailableLock; @@ -81,8 +81,8 @@ - (NSInteger)state; - (NSString *)lastError; - (NSString *)debugMessages; -- (NSInteger)localPort; -- (NSInteger)localPortFallback; +- (NSUInteger)localPort; +- (NSUInteger)localPortFallback; - (void)connect; - (void)launchTask:(id)dummy; - (void)disconnect; diff --git a/Source/SPSSHTunnel.m b/Source/SPSSHTunnel.m index ceed74b4..16d0c590 100644 --- a/Source/SPSSHTunnel.m +++ b/Source/SPSSHTunnel.m @@ -488,7 +488,7 @@ /* * Returns the local port assigned for use by the tunnel */ -- (NSInteger)localPort +- (NSUInteger)localPort { return localPort; } @@ -496,7 +496,7 @@ /* * Returns the local port assigned for fallback use by the tunnel, if any */ -- (NSInteger)localPortFallback +- (NSUInteger)localPortFallback { if (!useHostFallback) return 0; diff --git a/Source/SPStringAdditions.h b/Source/SPStringAdditions.h index 042e69f0..16841a34 100644 --- a/Source/SPStringAdditions.h +++ b/Source/SPStringAdditions.h @@ -46,12 +46,12 @@ static inline void NSMutableAttributedStringAddAttributeValueRange (NSMutableAtt return; } -static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedString* self, NSString* aStr, NSUInteger index, NSRangePointer range) +static inline id NSMutableAttributedStringAttributeAtIndex (NSMutableAttributedString* self, NSString* aStr, NSUInteger anIndex, NSRangePointer aRange) { typedef id (*SPMutableAttributedStringAttributeAtIndexMethodPtr)(NSMutableAttributedString*, SEL, NSString*, NSUInteger, NSRangePointer); static SPMutableAttributedStringAttributeAtIndexMethodPtr SPMutableAttributedStringAttributeAtIndex; if (!SPMutableAttributedStringAttributeAtIndex) SPMutableAttributedStringAttributeAtIndex = (SPMutableAttributedStringAttributeAtIndexMethodPtr)[self methodForSelector:@selector(attribute:atIndex:effectiveRange:)]; - id r = SPMutableAttributedStringAttributeAtIndex(self, @selector(attribute:atIndex:effectiveRange:), aStr, index, range); + id r = SPMutableAttributedStringAttributeAtIndex(self, @selector(attribute:atIndex:effectiveRange:), aStr, anIndex, aRange); return r; } diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m index 21059ba2..421ef4c1 100644 --- a/Source/SPStringAdditions.m +++ b/Source/SPStringAdditions.m @@ -164,7 +164,7 @@ { NSMutableString *holder = [[NSMutableString alloc] init]; unichar theChar; - int i; + NSUInteger i; for(i = 0; i < [self length]; i++) { theChar = [self characterAtIndex:i]; @@ -492,7 +492,7 @@ if([scriptPath hasPrefix:@"/"] && [fm fileExistsAtPath:scriptPath isDirectory:&isDir] && !isDir) { NSString *script = [self substringWithRange:NSMakeRange(NSMaxRange(firstLineRange), [self length] - NSMaxRange(firstLineRange))]; NSError *writeError = nil; - [script writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:writeError]; + [script writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:&writeError]; if(writeError == nil) { redirectForScript = YES; [scriptHeaderArguments addObject:scriptFilePath]; @@ -504,7 +504,7 @@ } else { [scriptHeaderArguments addObject:@"/bin/sh"]; NSError *writeError = nil; - [self writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:writeError]; + [self writeToFile:scriptFilePath atomically:YES encoding:NSUTF8StringEncoding error:&writeError]; if(writeError == nil) { redirectForScript = YES; [scriptHeaderArguments addObject:scriptFilePath]; @@ -673,12 +673,12 @@ // Read STDOUT saved to file if([fm fileExistsAtPath:stdoutFilePath isDirectory:nil]) { - NSString *stdout = [NSString stringWithContentsOfFile:stdoutFilePath encoding:NSUTF8StringEncoding error:nil]; - if(bashTask) [bashTask release]; + NSString *stdoutContent = [NSString stringWithContentsOfFile:stdoutFilePath encoding:NSUTF8StringEncoding error:nil]; + if(bashTask) [bashTask release], bashTask = nil; [fm removeItemAtPath:stdoutFilePath error:nil]; - if(stdout != nil) { + if(stdoutContent != nil) { if (status == 0) { - return stdout; + return stdoutContent; } else { if(theError != NULL) { if(status == 9 || userTerminated) return @""; @@ -694,7 +694,7 @@ NSBeep(); } if(status > SPBundleRedirectActionNone && status <= SPBundleRedirectActionLastCode) - return stdout; + return stdoutContent; else return @""; } @@ -702,12 +702,11 @@ NSLog(@"Couldn't read return string from “%@” by using UTF-8 encoding.", self); NSBeep(); } - } else { - if(bashTask) [bashTask release]; - [fm removeItemAtPath:stdoutFilePath error:nil]; - return @""; } + if (bashTask) [bashTask release]; + [fm removeItemAtPath:stdoutFilePath error:nil]; + return @""; } /** diff --git a/Source/xibLocalizationPostprocessor.m b/Source/xibLocalizationPostprocessor.m index a6379aa7..ad2e152d 100644 --- a/Source/xibLocalizationPostprocessor.m +++ b/Source/xibLocalizationPostprocessor.m @@ -51,7 +51,7 @@ int main(int argc, const char *argv[]) } } - NSLog(@"Warning: skipped garbage input line %d, contents: \"%@\"", lineCount, line); + NSLog(@"Warning: skipped garbage input line %lu, contents: \"%@\"", (unsigned long)lineCount, line); } if (outputStrings.length && ![outputStrings writeToFile:[NSString stringWithUTF8String:argv[2]] atomically:NO encoding:usedEncoding error:&error]) { @@ -59,4 +59,4 @@ int main(int argc, const char *argv[]) exit (-1); } } [autoreleasePool release]; -}
\ No newline at end of file +} diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 5f003404..3538339b 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -2717,7 +2717,6 @@ isa = PBXProject; buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "sequel-pro" */; compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, @@ -3861,13 +3860,13 @@ GCC_WARN_INHIBIT_ALL_WARNINGS = NO; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MISSING_PARENTHESES = YES; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = NO; - GCC_WARN_PROTOTYPE_CONVERSION = YES; + GCC_WARN_PROTOTYPE_CONVERSION = NO; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; - GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = NO; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; @@ -4186,13 +4185,13 @@ GCC_WARN_INHIBIT_ALL_WARNINGS = NO; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MISSING_PARENTHESES = YES; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = NO; - GCC_WARN_PROTOTYPE_CONVERSION = YES; + GCC_WARN_PROTOTYPE_CONVERSION = NO; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; - GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = NO; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; @@ -4239,13 +4238,13 @@ GCC_WARN_INHIBIT_ALL_WARNINGS = NO; GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; GCC_WARN_MISSING_PARENTHESES = YES; - GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; GCC_WARN_PEDANTIC = NO; - GCC_WARN_PROTOTYPE_CONVERSION = YES; + GCC_WARN_PROTOTYPE_CONVERSION = NO; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; - GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = NO; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; |