Committed by
GitHub
Merge pull request #1984 from dreampiggy/fix_unreachable_code
Fix unreachable code build warning on macOS
Showing
2 changed files
with
7 additions
and
4 deletions
@@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
21 | 21 | ||
22 | #if SD_MAC | 22 | #if SD_MAC |
23 | return [[UIImage alloc] initWithData:data]; | 23 | return [[UIImage alloc] initWithData:data]; |
24 | -#endif | 24 | +#else |
25 | 25 | ||
26 | CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); | 26 | CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); |
27 | 27 | ||
@@ -53,6 +53,7 @@ | @@ -53,6 +53,7 @@ | ||
53 | CFRelease(source); | 53 | CFRelease(source); |
54 | 54 | ||
55 | return staticImage; | 55 | return staticImage; |
56 | +#endif | ||
56 | } | 57 | } |
57 | 58 | ||
58 | - (BOOL)isGIF { | 59 | - (BOOL)isGIF { |
@@ -60,8 +60,8 @@ static void FreeImageData(void *info, const void *data, size_t size) { | @@ -60,8 +60,8 @@ static void FreeImageData(void *info, const void *data, size_t size) { | ||
60 | 60 | ||
61 | #if SD_UIKIT || SD_WATCH | 61 | #if SD_UIKIT || SD_WATCH |
62 | int loopCount = WebPDemuxGetI(demuxer, WEBP_FF_LOOP_COUNT); | 62 | int loopCount = WebPDemuxGetI(demuxer, WEBP_FF_LOOP_COUNT); |
63 | -#endif | ||
64 | int frameCount = WebPDemuxGetI(demuxer, WEBP_FF_FRAME_COUNT); | 63 | int frameCount = WebPDemuxGetI(demuxer, WEBP_FF_FRAME_COUNT); |
64 | +#endif | ||
65 | int canvasWidth = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_WIDTH); | 65 | int canvasWidth = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_WIDTH); |
66 | int canvasHeight = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_HEIGHT); | 66 | int canvasHeight = WebPDemuxGetI(demuxer, WEBP_FF_CANVAS_HEIGHT); |
67 | CGBitmapInfo bitmapInfo; | 67 | CGBitmapInfo bitmapInfo; |
@@ -78,8 +78,10 @@ static void FreeImageData(void *info, const void *data, size_t size) { | @@ -78,8 +78,10 @@ static void FreeImageData(void *info, const void *data, size_t size) { | ||
78 | } | 78 | } |
79 | 79 | ||
80 | NSMutableArray<UIImage *> *images = [NSMutableArray array]; | 80 | NSMutableArray<UIImage *> *images = [NSMutableArray array]; |
81 | +#if SD_UIKIT || SD_WATCH | ||
81 | NSTimeInterval totalDuration = 0; | 82 | NSTimeInterval totalDuration = 0; |
82 | int durations[frameCount]; | 83 | int durations[frameCount]; |
84 | +#endif | ||
83 | 85 | ||
84 | do { | 86 | do { |
85 | UIImage *image; | 87 | UIImage *image; |
@@ -97,7 +99,7 @@ static void FreeImageData(void *info, const void *data, size_t size) { | @@ -97,7 +99,7 @@ static void FreeImageData(void *info, const void *data, size_t size) { | ||
97 | 99 | ||
98 | #if SD_MAC | 100 | #if SD_MAC |
99 | break; | 101 | break; |
100 | -#endif | 102 | +#else |
101 | 103 | ||
102 | int duration = iter.duration; | 104 | int duration = iter.duration; |
103 | if (duration <= 10) { | 105 | if (duration <= 10) { |
@@ -108,7 +110,7 @@ static void FreeImageData(void *info, const void *data, size_t size) { | @@ -108,7 +110,7 @@ static void FreeImageData(void *info, const void *data, size_t size) { | ||
108 | totalDuration += duration; | 110 | totalDuration += duration; |
109 | size_t count = images.count; | 111 | size_t count = images.count; |
110 | durations[count - 1] = duration; | 112 | durations[count - 1] = duration; |
111 | - | 113 | +#endif |
112 | } while (WebPDemuxNextFrame(&iter)); | 114 | } while (WebPDemuxNextFrame(&iter)); |
113 | 115 | ||
114 | WebPDemuxReleaseIterator(&iter); | 116 | WebPDemuxReleaseIterator(&iter); |
-
Please register or login to post a comment