From 5b1ccfdbb744be5b4b3227d92675d140c4ed4b82 Mon Sep 17 00:00:00 2001 From: Christoph Krey Date: Wed, 20 Sep 2017 08:40:02 +0200 Subject: [PATCH] [FIX] Format string warnings #374 [FIX] Xcode9 warnings [FIX] Cocoalumberjack upgrade --- .../MQTTClient.xcodeproj/project.pbxproj | 84 ++++++++++++++++--- .../xcschemes/MQTTClientOSXTests.xcscheme | 4 +- .../MQTTClientOSXTestsNOLumberjack.xcscheme | 4 +- .../xcschemes/MQTTClientTVTests.xcscheme | 4 +- .../xcschemes/MQTTClientTests.xcscheme | 4 +- .../xcschemes/MQTTFramework Mac.xcscheme | 4 +- .../xcschemes/MQTTFramework iOS.xcscheme | 4 +- .../xcschemes/MQTTFramework tvOS.xcscheme | 4 +- MQTTClient/MQTTClient/MQTTMessage.m | 2 +- MQTTClient/MQTTClient/MQTTProperties.m | 3 + MQTTClient/MQTTClient/MQTTSession.m | 21 +++-- MQTTClient/MQTTClient/ReconnectTimer.h | 2 +- MQTTClient/MQTTClient/ReconnectTimer.m | 4 +- MQTTClient/MQTTClientTests/MQTTACLTests.m | 15 ++-- MQTTClient/MQTTClientTests/MQTTTestFlows.m | 4 +- .../MQTTClientTests/MQTTTestSessionManager.m | 2 +- .../MQTTClientTests/MQTTTestWebsockets.m | 2 +- MQTTClient/Podfile.lock | 16 ++-- 18 files changed, 131 insertions(+), 52 deletions(-) diff --git a/MQTTClient/MQTTClient.xcodeproj/project.pbxproj b/MQTTClient/MQTTClient.xcodeproj/project.pbxproj index 33ee3b63..51754a6f 100644 --- a/MQTTClient/MQTTClient.xcodeproj/project.pbxproj +++ b/MQTTClient/MQTTClient.xcodeproj/project.pbxproj @@ -1309,7 +1309,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0710; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0900; ORGANIZATIONNAME = "Christoph Krey"; TargetAttributes = { 8404875D1C51212600569C79 = { @@ -1317,10 +1317,14 @@ }; 840716311BBEF13A00FBB3CB = { CreatedOnToolsVersion = 7.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; }; 8425D7001BBE8D3D005AD733 = { CreatedOnToolsVersion = 7.1; + LastSwiftMigration = 0900; + }; + 846191391883E56800101409 = { + LastSwiftMigration = 0900; }; DE9EF5C41C0628B1009EF667 = { CreatedOnToolsVersion = 7.0.1; @@ -1506,9 +1510,16 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-MQTTClientTVTests/Pods-MQTTClientTVTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/CocoaLumberjack-tvOS/CocoaLumberjack.framework", + "${BUILT_PRODUCTS_DIR}/MQTTClient-ManagerL-MinL-WebsocketL-tvOS/MQTTClient.framework", + "${BUILT_PRODUCTS_DIR}/SocketRocket-tvOS/SocketRocket.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MQTTClient.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -1521,13 +1532,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-MQTTClientOSXTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 4FDDA8E069DB09D8AA6752F5 /* [CP] Embed Pods Frameworks */ = { @@ -1536,9 +1550,16 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-MQTTClientTests/Pods-MQTTClientTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/CocoaLumberjack-iOS/CocoaLumberjack.framework", + "${BUILT_PRODUCTS_DIR}/MQTTClient-ManagerL-MinL-WebsocketL-iOS/MQTTClient.framework", + "${BUILT_PRODUCTS_DIR}/SocketRocket-iOS/SocketRocket.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MQTTClient.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -1551,13 +1572,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-MQTTClientTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 840D3CF11F28A7C20072019B /* [CP] Check Pods Manifest.lock */ = { @@ -1566,13 +1590,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-MQTTClientOSXTestsNOLumberjack-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 840D3D2C1F28A7C20072019B /* [CP] Embed Pods Frameworks */ = { @@ -1581,9 +1608,14 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-MQTTClientOSXTestsNOLumberjack/Pods-MQTTClientOSXTestsNOLumberjack-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/MQTTClient-Manager-Min-Websocket/MQTTClient.framework", + "${BUILT_PRODUCTS_DIR}/SocketRocket-macOS/SocketRocket.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MQTTClient.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -1641,13 +1673,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-MQTTClientTVTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; FCD05701E6A805296E8D37CD /* [CP] Embed Pods Frameworks */ = { @@ -1656,9 +1691,16 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-MQTTClientOSXTests/Pods-MQTTClientOSXTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/CocoaLumberjack-macOS/CocoaLumberjack.framework", + "${BUILT_PRODUCTS_DIR}/MQTTClient-ManagerL-MinL-WebsocketL-macOS/MQTTClient.framework", + "${BUILT_PRODUCTS_DIR}/SocketRocket-macOS/SocketRocket.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MQTTClient.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -1939,7 +1981,8 @@ SDKROOT = macosx; SUPPORTED_PLATFORMS = macosx; SWIFT_OBJC_BRIDGING_HEADER = "MQTTClientTests/MQTTClientTests-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -1976,7 +2019,8 @@ SDKROOT = macosx; SUPPORTED_PLATFORMS = macosx; SWIFT_OBJC_BRIDGING_HEADER = "MQTTClientTests/MQTTClientTests-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -2065,7 +2109,8 @@ SDKROOT = appletvos; SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; SWIFT_OBJC_BRIDGING_HEADER = "MQTTClientTests/MQTTClientTests-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; @@ -2100,7 +2145,8 @@ SDKROOT = appletvos; SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; SWIFT_OBJC_BRIDGING_HEADER = "MQTTClientTests/MQTTClientTests-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; @@ -2113,14 +2159,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -2157,14 +2209,20 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -2216,7 +2274,8 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "MQTTClientTests/MQTTClientTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; WRAPPER_EXTENSION = xctest; }; name = Debug; @@ -2249,7 +2308,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.gmail.cky6201.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "MQTTClientTests/MQTTClientTests-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.0; WRAPPER_EXTENSION = xctest; }; name = Release; diff --git a/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTClientOSXTests.xcscheme b/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTClientOSXTests.xcscheme index cddf8035..56f4a419 100644 --- a/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTClientOSXTests.xcscheme +++ b/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTClientOSXTests.xcscheme @@ -1,6 +1,6 @@ @@ -36,6 +37,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTFramework iOS.xcscheme b/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTFramework iOS.xcscheme index 50d78cfc..7bdd2d98 100644 --- a/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTFramework iOS.xcscheme +++ b/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTFramework iOS.xcscheme @@ -1,6 +1,6 @@ @@ -36,6 +37,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTFramework tvOS.xcscheme b/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTFramework tvOS.xcscheme index 5a0b1be9..24175fa9 100644 --- a/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTFramework tvOS.xcscheme +++ b/MQTTClient/MQTTClient.xcodeproj/xcshareddata/xcschemes/MQTTFramework tvOS.xcscheme @@ -1,6 +1,6 @@ @@ -36,6 +37,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/MQTTClient/MQTTClient/MQTTMessage.m b/MQTTClient/MQTTClient/MQTTMessage.m index 16137039..a1c321fb 100644 --- a/MQTTClient/MQTTClient/MQTTMessage.m +++ b/MQTTClient/MQTTClient/MQTTMessage.m @@ -632,7 +632,7 @@ + (MQTTMessage *)messageFromData:(NSData *)data protocolLevel:(MQTTProtocolVersi if (protocolLevel == MQTTProtocolVersion50) { if (message.data.length == 0) { message.properties = nil; - message.returnCode = MQTTSuccess; + message.returnCode = @(MQTTSuccess); } else if (message.data.length == 1) { message.properties = nil; const UInt8 *bytes = message.data.bytes; diff --git a/MQTTClient/MQTTClient/MQTTProperties.m b/MQTTClient/MQTTClient/MQTTProperties.m index 3acad8c6..9635f9df 100644 --- a/MQTTClient/MQTTClient/MQTTProperties.m +++ b/MQTTClient/MQTTClient/MQTTProperties.m @@ -9,6 +9,9 @@ #import "MQTTProperties.h" @implementation MQTTProperties +- (instancetype)init { + return [self initFromData:[[NSData alloc] init]]; +} - (instancetype)initFromData:(NSData *)data { self = [super init]; diff --git a/MQTTClient/MQTTClient/MQTTSession.m b/MQTTClient/MQTTClient/MQTTSession.m index 3da39b0b..cf8a834c 100644 --- a/MQTTClient/MQTTClient/MQTTSession.m +++ b/MQTTClient/MQTTClient/MQTTSession.m @@ -168,7 +168,8 @@ - (void)checkTopicFilters:(NSArray *)topicFilters { [topicFilter dataUsingEncoding:NSUTF8StringEncoding].length > 65535L) { NSException* myException = [NSException exceptionWithName:@"topicFilter may not be longer than 65535 bytes in UTF8 representation" - reason:[NSString stringWithFormat:@"topicFilter length = %lu", [topicFilter dataUsingEncoding:NSUTF8StringEncoding].length] + reason:[NSString stringWithFormat:@"topicFilter length = %lu", + (unsigned long)[topicFilter dataUsingEncoding:NSUTF8StringEncoding].length] userInfo:nil]; @throw myException; } @@ -334,7 +335,8 @@ - (UInt16)publishData:(NSData *)data [topic dataUsingEncoding:NSUTF8StringEncoding].length > 65535L) { NSException* myException = [NSException exceptionWithName:@"topic may not be longer than 65535 bytes in UTF8 representation" - reason:[NSString stringWithFormat:@"topic length = %lu", [topic dataUsingEncoding:NSUTF8StringEncoding].length] + reason:[NSString stringWithFormat:@"topic length = %lu", + (unsigned long)[topic dataUsingEncoding:NSUTF8StringEncoding].length] userInfo:nil]; @throw myException; } @@ -1424,7 +1426,8 @@ - (void)connect { !self.cleanSessionFlag) { NSException* myException = [NSException exceptionWithName:@"clientId must be at least 1 character long if cleanSessionFlag is off" - reason:[NSString stringWithFormat:@"clientId length = %lu", [self.clientId dataUsingEncoding:NSUTF8StringEncoding].length] + reason:[NSString stringWithFormat:@"clientId length = %lu", + (unsigned long)[self.clientId dataUsingEncoding:NSUTF8StringEncoding].length] userInfo:nil]; @throw myException; } @@ -1433,7 +1436,8 @@ - (void)connect { !self.clientId) { NSException* myException = [NSException exceptionWithName:@"clientId must not be nil" - reason:[NSString stringWithFormat:@"clientId length = %lu", [self.clientId dataUsingEncoding:NSUTF8StringEncoding].length] + reason:[NSString stringWithFormat:@"clientId length = %lu", + (unsigned long)[self.clientId dataUsingEncoding:NSUTF8StringEncoding].length] userInfo:nil]; @throw myException; } @@ -1442,7 +1446,8 @@ - (void)connect { [self.clientId dataUsingEncoding:NSUTF8StringEncoding].length > 65535L) { NSException* myException = [NSException exceptionWithName:@"clientId may not be longer than 65535 bytes in UTF8 representation" - reason:[NSString stringWithFormat:@"clientId length = %lu", [self.clientId dataUsingEncoding:NSUTF8StringEncoding].length] + reason:[NSString stringWithFormat:@"clientId length = %lu", + (unsigned long)[self.clientId dataUsingEncoding:NSUTF8StringEncoding].length] userInfo:nil]; @throw myException; } @@ -1460,7 +1465,8 @@ - (void)connect { [self.userName dataUsingEncoding:NSUTF8StringEncoding].length > 65535L) { NSException* myException = [NSException exceptionWithName:@"userName may not be longer than 65535 bytes in UTF8 representation" - reason:[NSString stringWithFormat:@"userName length = %lu", [self.userName dataUsingEncoding:NSUTF8StringEncoding].length] + reason:[NSString stringWithFormat:@"userName length = %lu", + (unsigned long)[self.userName dataUsingEncoding:NSUTF8StringEncoding].length] userInfo:nil]; @throw myException; } @@ -1570,7 +1576,8 @@ - (void)connect { [self.willTopic dataUsingEncoding:NSUTF8StringEncoding].length > 65535L) { NSException* myException = [NSException exceptionWithName:@"willTopic may not be longer than 65535 bytes in UTF8 representation" - reason:[NSString stringWithFormat:@"willTopic length = %lu", [self.willTopic dataUsingEncoding:NSUTF8StringEncoding].length] + reason:[NSString stringWithFormat:@"willTopic length = %lu", + (unsigned long)[self.willTopic dataUsingEncoding:NSUTF8StringEncoding].length] userInfo:nil]; @throw myException; } diff --git a/MQTTClient/MQTTClient/ReconnectTimer.h b/MQTTClient/MQTTClient/ReconnectTimer.h index da5cc08b..b4a9260b 100644 --- a/MQTTClient/MQTTClient/ReconnectTimer.h +++ b/MQTTClient/MQTTClient/ReconnectTimer.h @@ -12,7 +12,7 @@ - (instancetype)initWithRetryInterval:(NSTimeInterval)retryInterval maxRetryInterval:(NSTimeInterval)maxRetryInterval - reconnectBlock:(void (^)())block; + reconnectBlock:(void (^)(void))block; - (void)schedule; - (void)stop; - (void)resetRetryInterval; diff --git a/MQTTClient/MQTTClient/ReconnectTimer.m b/MQTTClient/MQTTClient/ReconnectTimer.m index 35afd9f5..a4b7905d 100644 --- a/MQTTClient/MQTTClient/ReconnectTimer.m +++ b/MQTTClient/MQTTClient/ReconnectTimer.m @@ -14,7 +14,7 @@ @interface ReconnectTimer() @property (assign, nonatomic) NSTimeInterval retryInterval; @property (assign, nonatomic) NSTimeInterval currentRetryInterval; @property (assign, nonatomic) NSTimeInterval maxRetryInterval; -@property (copy, nonatomic) void (^reconnectBlock)(); +@property (copy, nonatomic) void (^reconnectBlock)(void); @end @@ -22,7 +22,7 @@ @implementation ReconnectTimer - (instancetype)initWithRetryInterval:(NSTimeInterval)retryInterval maxRetryInterval:(NSTimeInterval)maxRetryInterval - reconnectBlock:(void (^)())block { + reconnectBlock:(void (^)(void))block { self = [super init]; if (self) { self.retryInterval = retryInterval; diff --git a/MQTTClient/MQTTClientTests/MQTTACLTests.m b/MQTTClient/MQTTClientTests/MQTTACLTests.m index 80733d4e..19caa8d0 100644 --- a/MQTTClient/MQTTClientTests/MQTTACLTests.m +++ b/MQTTClient/MQTTClientTests/MQTTACLTests.m @@ -139,7 +139,7 @@ - (void)test_connect_long_user_strict { while ([self.session.userName dataUsingEncoding:NSUTF8StringEncoding].length <= 65535L) { DDLogVerbose(@"userName length %lu", - [self.session.userName dataUsingEncoding:NSUTF8StringEncoding].length); + (unsigned long) [self.session.userName dataUsingEncoding:NSUTF8StringEncoding].length); self.session.userName = [self.session.userName stringByAppendingString:self.session.userName]; } @@ -163,19 +163,14 @@ - (void)test_connect_user_nonUTF8_strict { self.session = [MQTTTestHelpers session:parameters]; self.session.userName = @"user"; - NSData *data = [NSData dataWithBytes:"MQTTClient/abc\x9c\x9dxyz" length:19]; - NSString *stringWith9c = [[NSString alloc] initWithData:data encoding:NSISOLatin1StringEncoding]; - - NSString *stringWithD800 = [NSString stringWithFormat:@"%@/%C/%s", TOPIC, 0xD800, __FUNCTION__]; - - NSString *stringWithFEFF = [NSString stringWithFormat:@"%@<%C>/%s", TOPIC, 0xfeff, __FUNCTION__]; - - NSString *stringWithNull = [NSString stringWithFormat:@"%@/%C/%s", TOPIC, 0, __FUNCTION__]; - @try { + //NSString *stringWith9c = [[NSString alloc] initWithData:data encoding:NSISOLatin1StringEncoding]; //self.session.userName = stringWith9c; + NSString *stringWithD800 = [NSString stringWithFormat:@"%@/%C/%s", TOPIC, 0xD800, __FUNCTION__]; self.session.userName = stringWithD800; + //NSString *stringWithFEFF = [NSString stringWithFormat:@"%@<%C>/%s", TOPIC, 0xfeff, __FUNCTION__]; //self.session.userName = stringWithFEFF; + //NSString *stringWithNull = [NSString stringWithFormat:@"%@/%C/%s", TOPIC, 0, __FUNCTION__]; //self.session.userName = stringWithNull; [self.session connect]; } @catch (NSException *exception) { diff --git a/MQTTClient/MQTTClientTests/MQTTTestFlows.m b/MQTTClient/MQTTClientTests/MQTTTestFlows.m index 34950d5b..b15f6a33 100644 --- a/MQTTClient/MQTTClientTests/MQTTTestFlows.m +++ b/MQTTClient/MQTTClientTests/MQTTTestFlows.m @@ -76,7 +76,7 @@ - (void)sub:(MQTTQosLevel)qos { } - (void)pub:(MQTTQosLevel)qos count:(NSInteger)count { - NSString *message = [NSString stringWithFormat:@"data %5ld", count]; + NSString *message = [NSString stringWithFormat:@"data %5ld", (long)count]; UInt16 msgID = [self.session publishData:[message dataUsingEncoding:NSUTF8StringEncoding] onTopic:@"MQTTClient" retain:NO qos:qos]; if (qos == MQTTQosLevelAtMostOnce || msgID > 0) { self.publishedCounter++; @@ -136,7 +136,7 @@ - (BOOL)newMessageWithFeedback:(MQTTSession *)session data:(NSData *)data onTopi } - (void)handleEvent:(MQTTSession *)session event:(MQTTSessionEvent)eventCode error:(NSError *)error { - DDLogVerbose(@"handleEvent:%ld error:%@", eventCode, error); + DDLogVerbose(@"handleEvent:%ld error:%@", (long)eventCode, error); if (eventCode == MQTTSessionEventConnectionClosed || eventCode == MQTTSessionEventConnectionClosedByBroker) { self.closed = true; } diff --git a/MQTTClient/MQTTClientTests/MQTTTestSessionManager.m b/MQTTClient/MQTTClientTests/MQTTTestSessionManager.m index e96c7a7c..d7ed30fe 100644 --- a/MQTTClient/MQTTClientTests/MQTTTestSessionManager.m +++ b/MQTTClient/MQTTClientTests/MQTTTestSessionManager.m @@ -651,7 +651,7 @@ - (void)sessionManager:(MQTTSessionManager *)sessionManager onTopic:(NSString *)topic retained:(BOOL)retained { DDLogInfo(@"[MQTTSessionManager] didReceiveMessage (%lu) t:%@ r%d", - data.length, topic, retained); + (unsigned long)data.length, topic, retained); if ([topic isEqualToString:TOPIC]) { if (!retained && data.length) { self.received++; diff --git a/MQTTClient/MQTTClientTests/MQTTTestWebsockets.m b/MQTTClient/MQTTClientTests/MQTTTestWebsockets.m index 498d7103..87f6fb43 100644 --- a/MQTTClient/MQTTClientTests/MQTTTestWebsockets.m +++ b/MQTTClient/MQTTClientTests/MQTTTestWebsockets.m @@ -289,7 +289,7 @@ - (void)testWSLowLevel { - (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message { NSData *data = (NSData *)message; - DDLogVerbose(@"webSocket didReceiveMessage %ld", data.length); + DDLogVerbose(@"webSocket didReceiveMessage %ld", (unsigned long)data.length); self.next = true; } diff --git a/MQTTClient/Podfile.lock b/MQTTClient/Podfile.lock index 8440cf2a..1d88f2c9 100644 --- a/MQTTClient/Podfile.lock +++ b/MQTTClient/Podfile.lock @@ -1,9 +1,9 @@ PODS: - - CocoaLumberjack (3.2.0): - - CocoaLumberjack/Default (= 3.2.0) - - CocoaLumberjack/Extensions (= 3.2.0) - - CocoaLumberjack/Default (3.2.0) - - CocoaLumberjack/Extensions (3.2.0): + - CocoaLumberjack (3.2.1): + - CocoaLumberjack/Default (= 3.2.1) + - CocoaLumberjack/Extensions (= 3.2.1) + - CocoaLumberjack/Default (3.2.1) + - CocoaLumberjack/Extensions (3.2.1): - CocoaLumberjack/Default - MQTTClient/Manager (0.9.7): - MQTTClient/Min @@ -31,13 +31,13 @@ DEPENDENCIES: EXTERNAL SOURCES: MQTTClient: - :path: ".." + :path: .. SPEC CHECKSUMS: - CocoaLumberjack: 9b4aed7073d242f29cc2f62068d995faf67f703a + CocoaLumberjack: 2800c03334042fe80589423c8d80e582dcaec482 MQTTClient: 61317120e05c8d5543dc0ccad147e6985d874690 SocketRocket: d57c7159b83c3c6655745cd15302aa24b6bae531 PODFILE CHECKSUM: 40e36ed6f235775736189677995f0c7928d68fb5 -COCOAPODS: 1.2.0 +COCOAPODS: 1.3.1