From 177343a71431e4f8cb447f4a7088bdd66a2b153e Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Wed, 2 Oct 2019 17:00:47 +0800 Subject: [PATCH] Fix the warning of deprecated API `CGColorSpaceCreateWithICCProfile` --- .../project.pbxproj | 13 +++----- SDWebImageWebPCoder.xcodeproj/project.pbxproj | 33 +++++-------------- .../contents.xcworkspacedata | 4 +-- .../Classes/SDImageWebPCoder.m | 6 +++- 4 files changed, 19 insertions(+), 37 deletions(-) diff --git a/Example/SDWebImageWebPCoderExample.xcodeproj/project.pbxproj b/Example/SDWebImageWebPCoderExample.xcodeproj/project.pbxproj index c2aeafc..3daed9f 100644 --- a/Example/SDWebImageWebPCoderExample.xcodeproj/project.pbxproj +++ b/Example/SDWebImageWebPCoderExample.xcodeproj/project.pbxproj @@ -187,17 +187,12 @@ buildActionMask = 2147483647; files = ( ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderExample/Pods-SDWebImageWebPCoderExample-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", - "${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder/SDWebImageWebPCoder.framework", - "${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework", + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderExample/Pods-SDWebImageWebPCoderExample-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework", + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderExample/Pods-SDWebImageWebPCoderExample-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/SDWebImageWebPCoder.xcodeproj/project.pbxproj b/SDWebImageWebPCoder.xcodeproj/project.pbxproj index 88433c0..e6af427 100644 --- a/SDWebImageWebPCoder.xcodeproj/project.pbxproj +++ b/SDWebImageWebPCoder.xcodeproj/project.pbxproj @@ -491,17 +491,12 @@ buildActionMask = 2147483647; files = ( ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderTests/Pods-SDWebImageWebPCoderTests-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", - "${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder/SDWebImageWebPCoder.framework", - "${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework", + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderTests/Pods-SDWebImageWebPCoderTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework", + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderTests/Pods-SDWebImageWebPCoderTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -624,14 +619,8 @@ "DEBUG=1", "$(inherited)", ); - "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = ( - "WEBP_USE_INTRINSICS=1", - "$(inherited)", - ); - "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = ( - "WEBP_USE_INTRINSICS=1", - "$(inherited)", - ); + "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = "WEBP_USE_INTRINSICS=1 $(inherited)"; + "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = "WEBP_USE_INTRINSICS=1 $(inherited)"; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -699,14 +688,8 @@ GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; - "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = ( - "WEBP_USE_INTRINSICS=1", - "$(inherited)", - ); - "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = ( - "WEBP_USE_INTRINSICS=1", - "$(inherited)", - ); + "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = "WEBP_USE_INTRINSICS=1 $(inherited)"; + "GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = "WEBP_USE_INTRINSICS=1 $(inherited)"; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; diff --git a/SDWebImageWebPCoder.xcworkspace/contents.xcworkspacedata b/SDWebImageWebPCoder.xcworkspace/contents.xcworkspacedata index 92b2efd..5a37b76 100644 --- a/SDWebImageWebPCoder.xcworkspace/contents.xcworkspacedata +++ b/SDWebImageWebPCoder.xcworkspace/contents.xcworkspacedata @@ -5,10 +5,10 @@ location = "group:Example/SDWebImageWebPCoderExample.xcodeproj"> + location = "group:SDWebImageWebPCoder.xcodeproj"> + location = "group:Example/Pods/Pods.xcodeproj"> diff --git a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m index 617bdb2..1ff3b7a 100644 --- a/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m +++ b/SDWebImageWebPCoder/Classes/SDImageWebPCoder.m @@ -432,7 +432,11 @@ // See #2618, the `CGColorSpaceCreateWithICCProfile` does not copy ICC Profile data, it only retain `CFDataRef`. // When the libwebp `WebPDemuxer` dealloc, all chunks will be freed. So we must copy the ICC data (really cheap, less than 10KB) NSData *profileData = [NSData dataWithBytes:chunk_iter.chunk.bytes length:chunk_iter.chunk.size]; - colorSpaceRef = CGColorSpaceCreateWithICCProfile((__bridge CFDataRef)profileData); + if (@available(iOS 10, tvOS 10, macOS 10.12, watchOS 3, *)) { + colorSpaceRef = CGColorSpaceCreateWithICCData((__bridge CFDataRef)profileData); + } else { + colorSpaceRef = CGColorSpaceCreateWithICCProfile((__bridge CFDataRef)profileData); + } WebPDemuxReleaseChunkIterator(&chunk_iter); if (colorSpaceRef) { // We use RGB color model to decode WebP images currently, so we must filter out other colorSpace