Authored by Olivier Poitrey

Do not enable webp when not explicitly activated by a macro (fix #415)

@@ -806,6 +806,7 @@ @@ -806,6 +806,7 @@
806 GCC_OPTIMIZATION_LEVEL = 0; 806 GCC_OPTIMIZATION_LEVEL = 0;
807 GCC_PREPROCESSOR_DEFINITIONS = ( 807 GCC_PREPROCESSOR_DEFINITIONS = (
808 "DEBUG=1", 808 "DEBUG=1",
  809 + "SD_WEBP=1",
809 "$(inherited)", 810 "$(inherited)",
810 ); 811 );
811 GCC_SYMBOLS_PRIVATE_EXTERN = NO; 812 GCC_SYMBOLS_PRIVATE_EXTERN = NO;
@@ -837,6 +838,7 @@ @@ -837,6 +838,7 @@
837 ALWAYS_SEARCH_USER_PATHS = NO; 838 ALWAYS_SEARCH_USER_PATHS = NO;
838 ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 839 ARCHS = "$(ARCHS_STANDARD_32_BIT)";
839 COPY_PHASE_STRIP = YES; 840 COPY_PHASE_STRIP = YES;
  841 + GCC_PREPROCESSOR_DEFINITIONS = "SD_WEBP=1";
840 GCC_TREAT_WARNINGS_AS_ERRORS = YES; 842 GCC_TREAT_WARNINGS_AS_ERRORS = YES;
841 GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 843 GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
842 GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; 844 GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
@@ -25,10 +25,12 @@ @@ -25,10 +25,12 @@
25 image = [[UIImage alloc] initWithData:data]; 25 image = [[UIImage alloc] initWithData:data];
26 } 26 }
27 27
  28 +#ifdef SD_WEBP
28 if (!image) // TODO: detect webp signature 29 if (!image) // TODO: detect webp signature
29 { 30 {
30 image = [UIImage sd_imageWithWebPData:data]; 31 image = [UIImage sd_imageWithWebPData:data];
31 } 32 }
  33 +#endif
32 34
33 return image; 35 return image;
34 } 36 }
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 // Copyright (c) 2013 Dailymotion. All rights reserved. 6 // Copyright (c) 2013 Dailymotion. All rights reserved.
7 // 7 //
8 8
  9 +#ifdef SD_WEBP
9 #import <UIKit/UIKit.h> 10 #import <UIKit/UIKit.h>
10 11
11 @interface UIImage (WebP) 12 @interface UIImage (WebP)
@@ -13,3 +14,4 @@ @@ -13,3 +14,4 @@
13 + (UIImage *)sd_imageWithWebPData:(NSData *)data; 14 + (UIImage *)sd_imageWithWebPData:(NSData *)data;
14 15
15 @end 16 @end
  17 +#endif
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 // Copyright (c) 2013 Dailymotion. All rights reserved. 6 // Copyright (c) 2013 Dailymotion. All rights reserved.
7 // 7 //
8 8
  9 +#ifdef SD_WEBP
9 #import "UIImage+WebP.h" 10 #import "UIImage+WebP.h"
10 #import "webp/decode.h" 11 #import "webp/decode.h"
11 12
@@ -60,3 +61,4 @@ static void FreeImageData(void *info, const void *data, size_t size) @@ -60,3 +61,4 @@ static void FreeImageData(void *info, const void *data, size_t size)
60 } 61 }
61 62
62 @end 63 @end
  64 +#endif