aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks/MCPKit')
-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
='n2262' href='#n2262'>2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930