From 808ae467381bf597c487fb321dbabc3ccb309b67 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 28 Feb 2018 00:42:52 +0100 Subject: Reapply changes from rolled back commit that are common to master and callback-auth branches This includes 3a944d7867c750c29e02e2619d72694bdbfb0b2a, 770c18901f82696d1233e0139e9bb3c4fbbcb90b, ca864a1f887feaf7ac6d35eeb55b265f3e630a09 --- .../Patches/001-cpp-dependency.diff | 8 ++++++++ .../Patches/002-new-types.diff | 9 +++++++++ .../SPMySQLFramework/Source/SPMySQLConnection.m | 23 +++++++++------------- .../SPMySQLFramework/Source/SPMySQLUtilities.h | 2 +- Frameworks/SPMySQLFramework/build-mysql-client.sh | 2 +- 5 files changed, 28 insertions(+), 16 deletions(-) (limited to 'Frameworks') diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/001-cpp-dependency.diff b/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/001-cpp-dependency.diff index 06c20001..e3ce848a 100644 --- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/001-cpp-dependency.diff +++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/001-cpp-dependency.diff @@ -1,3 +1,11 @@ +This patch is neccesary to remove a linker error when trying to link SPMySQL with libmysqlclient.a. + +To apply: + cd mysql-source-root + patch -p1 < this-file + +(patch created with `diff -Naur`) + --- mysql-5.5.56-dist/extra/yassl/taocrypt/include/runtime.hpp 2017-04-27 09:12:30.000000000 +0200 +++ mysql-5.5.56/extra/yassl/taocrypt/include/runtime.hpp 2017-05-20 23:27:14.000000000 +0200 @@ -53,8 +53,8 @@ diff --git a/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/002-new-types.diff b/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/002-new-types.diff index bb42f9d9..47aa9c6d 100644 --- a/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/002-new-types.diff +++ b/Frameworks/SPMySQLFramework/MySQL Client Libraries/Patches/002-new-types.diff @@ -1,3 +1,12 @@ +This patch backports field types that were added after MySQL 5.5, +but are technically still compatible to the old client libs. + +To apply: + cd mysql-source-root + patch -p1 < this-file + +(patch created with `diff -Naur`) + --- mysql-5.5.56-dist/include/mysql_com.h 2017-04-27 09:12:30.000000000 +0200 +++ mysql-5.5.56/include/mysql_com.h 2017-05-21 01:46:44.000000000 +0200 @@ -349,7 +349,11 @@ diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m index d50375e2..897df32f 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m @@ -33,6 +33,7 @@ #include #include #include +#import "SPMySQLUtilities.h" // Thread flag constant static pthread_key_t mySQLThreadInitFlagKey; @@ -321,12 +322,11 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS } /** - * Returns YES if the MCPConnection is connected to a server via SSL, NO otherwise. + * Returns YES if the SPMySQLConnection is connected to a server via SSL, NO otherwise. */ - (BOOL)isConnectedViaSSL { - if (![self isConnected]) return NO; - return connectedWithSSL; + return ([self isConnected] && connectedWithSSL); } /** @@ -470,14 +470,6 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS const char *__crashreporter_info__ = NULL; asm(".desc ___crashreporter_info__, 0x10"); -static uint64_t _elapsedMicroSecondsSinceAbsoluteTime(uint64_t comparisonTime) -{ - uint64_t elapsedTime_t = mach_absolute_time() - comparisonTime; - Nanoseconds elapsedTime = AbsoluteToNanoseconds(*(AbsoluteTime *)&(elapsedTime_t)); - - return (UnsignedWideToUInt64(elapsedTime) / 1000ULL); -} - @implementation SPMySQLConnection (PrivateAPI) /** @@ -489,8 +481,8 @@ static uint64_t _elapsedMicroSecondsSinceAbsoluteTime(uint64_t comparisonTime) // If a connection is already active in some form, throw an exception if (state != SPMySQLDisconnected && state != SPMySQLConnectionLostInBackground) { @synchronized (self) { - uint64_t diff = _elapsedMicroSecondsSinceAbsoluteTime(initialConnectTime); - asprintf(&__crashreporter_info__, "Attempted to connect a connection that is not disconnected (SPMySQLConnectionState=%d).\nIf state==2: Previous connection made %lluµs ago from: %s", state, diff, [_debugLastConnectedEvent cStringUsingEncoding:NSUTF8StringEncoding]); + double diff = _elapsedSecondsSinceAbsoluteTime(initialConnectTime); + asprintf(&__crashreporter_info__, "Attempted to connect a connection that is not disconnected (SPMySQLConnectionState=%d).\nIf state==2: Previous connection made %lfs ago from: %s", state, diff, [_debugLastConnectedEvent cStringUsingEncoding:NSUTF8StringEncoding]); __builtin_trap(); } [NSException raise:NSInternalInconsistencyException format:@"Attempted to connect a connection that is not disconnected (SPMySQLConnectionState=%d).", state]; @@ -1147,7 +1139,10 @@ static uint64_t _elapsedMicroSecondsSinceAbsoluteTime(uint64_t comparisonTime) pthread_setspecific(mySQLThreadInitFlagKey, &mySQLThreadFlag); // Set up the notification handler to deregister it - [[NSNotificationCenter defaultCenter] addObserver:[self class] selector:@selector(_removeThreadVariables:) name:NSThreadWillExitNotification object:[NSThread currentThread]]; + [[NSNotificationCenter defaultCenter] addObserver:[self class] + selector:@selector(_removeThreadVariables:) + name:NSThreadWillExitNotification + object:[NSThread currentThread]]; } /** diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLUtilities.h b/Frameworks/SPMySQLFramework/Source/SPMySQLUtilities.h index 50f9d504..3aa63ae7 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLUtilities.h +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLUtilities.h @@ -1,5 +1,5 @@ // -// Locking.h +// SPMySQLUtilities.h // SPMySQLFramework // // Created by Rowan Beentje (rowan.beent.je) on February 6, 2012 diff --git a/Frameworks/SPMySQLFramework/build-mysql-client.sh b/Frameworks/SPMySQLFramework/build-mysql-client.sh index 5475b0a0..ca43eab2 100755 --- a/Frameworks/SPMySQLFramework/build-mysql-client.sh +++ b/Frameworks/SPMySQLFramework/build-mysql-client.sh @@ -47,7 +47,7 @@ CLEAN='NO' MIN_OS_X_VERSION='10.6' ARCHITECTURES='-arch i386 -arch x86_64' -CONFIGURE_OPTIONS='-DBUILD_CONFIG=mysql_release -DENABLED_LOCAL_INFILE=1 -DWITH_SSL=bundled -DWITH_MYSQLD_LDFLAGS="-all-static --disable-shared" -DWITHOUT_SERVER=1 -DWITH_ZLIB=system' +CONFIGURE_OPTIONS='-DBUILD_CONFIG=mysql_release -DENABLED_LOCAL_INFILE=1 -DWITH_SSL=bundled -DWITH_MYSQLD_LDFLAGS="-all-static --disable-shared" -DWITHOUT_SERVER=1 -DWITH_ZLIB=system -DWITH_UNIT_TESTS=0' OUTPUT_DIR='SPMySQLFiles.build' ESC=`printf '\033'` -- cgit v1.2.3