Skip to content

Commit ee74989

Browse files
authored
Merge pull request #24 from SDWebImage/fix_warnings
Fix the warning of deprecated API `CGColorSpaceCreateWithICCProfile`
2 parents d53b482 + 177343a commit ee74989

File tree

4 files changed

+19
-37
lines changed

4 files changed

+19
-37
lines changed

Example/SDWebImageWebPCoderExample.xcodeproj/project.pbxproj

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,12 @@
187187
buildActionMask = 2147483647;
188188
files = (
189189
);
190-
inputPaths = (
191-
"${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderExample/Pods-SDWebImageWebPCoderExample-frameworks.sh",
192-
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
193-
"${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder/SDWebImageWebPCoder.framework",
194-
"${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework",
190+
inputFileListPaths = (
191+
"${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderExample/Pods-SDWebImageWebPCoderExample-frameworks-${CONFIGURATION}-input-files.xcfilelist",
195192
);
196193
name = "[CP] Embed Pods Frameworks";
197-
outputPaths = (
198-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
199-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework",
200-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework",
194+
outputFileListPaths = (
195+
"${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderExample/Pods-SDWebImageWebPCoderExample-frameworks-${CONFIGURATION}-output-files.xcfilelist",
201196
);
202197
runOnlyForDeploymentPostprocessing = 0;
203198
shellPath = /bin/sh;

SDWebImageWebPCoder.xcodeproj/project.pbxproj

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -491,17 +491,12 @@
491491
buildActionMask = 2147483647;
492492
files = (
493493
);
494-
inputPaths = (
495-
"${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderTests/Pods-SDWebImageWebPCoderTests-frameworks.sh",
496-
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
497-
"${BUILT_PRODUCTS_DIR}/SDWebImageWebPCoder/SDWebImageWebPCoder.framework",
498-
"${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework",
494+
inputFileListPaths = (
495+
"${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderTests/Pods-SDWebImageWebPCoderTests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
499496
);
500497
name = "[CP] Embed Pods Frameworks";
501-
outputPaths = (
502-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
503-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageWebPCoder.framework",
504-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework",
498+
outputFileListPaths = (
499+
"${PODS_ROOT}/Target Support Files/Pods-SDWebImageWebPCoderTests/Pods-SDWebImageWebPCoderTests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
505500
);
506501
runOnlyForDeploymentPostprocessing = 0;
507502
shellPath = /bin/sh;
@@ -624,14 +619,8 @@
624619
"DEBUG=1",
625620
"$(inherited)",
626621
);
627-
"GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = (
628-
"WEBP_USE_INTRINSICS=1",
629-
"$(inherited)",
630-
);
631-
"GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = (
632-
"WEBP_USE_INTRINSICS=1",
633-
"$(inherited)",
634-
);
622+
"GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = "WEBP_USE_INTRINSICS=1 $(inherited)";
623+
"GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = "WEBP_USE_INTRINSICS=1 $(inherited)";
635624
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
636625
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
637626
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -699,14 +688,8 @@
699688
GCC_C_LANGUAGE_STANDARD = gnu11;
700689
GCC_NO_COMMON_BLOCKS = YES;
701690
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
702-
"GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = (
703-
"WEBP_USE_INTRINSICS=1",
704-
"$(inherited)",
705-
);
706-
"GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = (
707-
"WEBP_USE_INTRINSICS=1",
708-
"$(inherited)",
709-
);
691+
"GCC_PREPROCESSOR_DEFINITIONS[sdk=watchos*]" = "WEBP_USE_INTRINSICS=1 $(inherited)";
692+
"GCC_PREPROCESSOR_DEFINITIONS[sdk=watchsimulator*]" = "WEBP_USE_INTRINSICS=1 $(inherited)";
710693
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
711694
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
712695
GCC_WARN_UNDECLARED_SELECTOR = YES;

SDWebImageWebPCoder.xcworkspace/contents.xcworkspacedata

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SDWebImageWebPCoder/Classes/SDImageWebPCoder.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,11 @@ - (nonnull CGColorSpaceRef)sd_colorSpaceWithDemuxer:(nonnull WebPDemuxer *)demux
432432
// See #2618, the `CGColorSpaceCreateWithICCProfile` does not copy ICC Profile data, it only retain `CFDataRef`.
433433
// When the libwebp `WebPDemuxer` dealloc, all chunks will be freed. So we must copy the ICC data (really cheap, less than 10KB)
434434
NSData *profileData = [NSData dataWithBytes:chunk_iter.chunk.bytes length:chunk_iter.chunk.size];
435-
colorSpaceRef = CGColorSpaceCreateWithICCProfile((__bridge CFDataRef)profileData);
435+
if (@available(iOS 10, tvOS 10, macOS 10.12, watchOS 3, *)) {
436+
colorSpaceRef = CGColorSpaceCreateWithICCData((__bridge CFDataRef)profileData);
437+
} else {
438+
colorSpaceRef = CGColorSpaceCreateWithICCProfile((__bridge CFDataRef)profileData);
439+
}
436440
WebPDemuxReleaseChunkIterator(&chunk_iter);
437441
if (colorSpaceRef) {
438442
// We use RGB color model to decode WebP images currently, so we must filter out other colorSpace

0 commit comments

Comments
 (0)