aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-03-02 02:25:08 +0000
committerrowanbeentje <rowan@beent.je>2011-03-02 02:25:08 +0000
commit4422810afa93d3cbce76812cc50e45ef8634180b (patch)
tree0d7cf391cdf495a6bef8c6970407e2e081c9d877 /Frameworks
parent64919b03fa59c8d93c81a8e3893934c04a3cac91 (diff)
downloadsequelpro-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
Diffstat (limited to 'Frameworks')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h16
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m104
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnectionDelegate.h2
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnectionProxy.h2
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.h6
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPGeometryData.m38
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPNumber.m6
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPResult.m54
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPResultPlus.m14
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m16
-rw-r--r--Frameworks/MCPKit/Support files/NSNotificationAdditions.m39
11 files changed, 160 insertions, 137 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