Skip to content

Commit 10ff189

Browse files
author
Olivier Poitrey
committed
Merge pull request SDWebImage#624 from akhenakh/620_move_categories
refs SDWebImage#620 move NSData+ImageContenttype to the SDWebImage subdirectory
2 parents 4589e4a + edc1d88 commit 10ff189

File tree

3 files changed

+22
-26
lines changed

3 files changed

+22
-26
lines changed

SDWebImage.xcodeproj/project.pbxproj

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@
2222
/* End PBXAggregateTarget section */
2323

2424
/* Begin PBXBuildFile section */
25-
1797E364CA5D259B8CEDF8EE /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 1797E851007E466318B38B47 /* NSData+ImageContentType.h */; };
26-
1797E37E262405DB1BFEDFFC /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 1797E3D4E27D504ACD827BE1 /* NSData+ImageContentType.m */; };
27-
1797E59FBF11E6588BC89B66 /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 1797E851007E466318B38B47 /* NSData+ImageContentType.h */; };
28-
1797E75161F3C9E8494E43E6 /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 1797E851007E466318B38B47 /* NSData+ImageContentType.h */; };
29-
1797EBFB62F22E5C0A26A75D /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 1797E3D4E27D504ACD827BE1 /* NSData+ImageContentType.m */; };
30-
1797ED4CD80EA8BD405365C3 /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 1797E3D4E27D504ACD827BE1 /* NSData+ImageContentType.m */; };
3125
530E49E816464C25002868E7 /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E71646388E002868E7 /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
3226
530E49E916464C26002868E7 /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E71646388E002868E7 /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
3327
530E49EA16464C7C002868E7 /* SDWebImageDownloaderOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 530E49E316460AE2002868E7 /* SDWebImageDownloaderOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -187,6 +181,12 @@
187181
53EDFCFE17625F5F00698166 /* filters.c in Sources */ = {isa = PBXBuildFile; fileRef = 53EDFCFA17625F5F00698166 /* filters.c */; };
188182
53EDFD0217625F7900698166 /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 53EDFCFF17625F7900698166 /* thread.h */; };
189183
53EDFD0417625F7900698166 /* thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 53EDFD0017625F7900698166 /* thread.c */; };
184+
5D5B9142188EE8DD006D06BD /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D5B9140188EE8DD006D06BD /* NSData+ImageContentType.h */; };
185+
5D5B9143188EE8DD006D06BD /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D5B9140188EE8DD006D06BD /* NSData+ImageContentType.h */; };
186+
5D5B9144188EE8DD006D06BD /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D5B9140188EE8DD006D06BD /* NSData+ImageContentType.h */; };
187+
5D5B9145188EE8DD006D06BD /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D5B9141188EE8DD006D06BD /* NSData+ImageContentType.m */; };
188+
5D5B9146188EE8DD006D06BD /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D5B9141188EE8DD006D06BD /* NSData+ImageContentType.m */; };
189+
5D5B9147188EE8DD006D06BD /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D5B9141188EE8DD006D06BD /* NSData+ImageContentType.m */; };
190190
5DA509F4187B68E7002FEB5C /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = 5DA509F2187B68E7002FEB5C /* random.c */; };
191191
5DA509F5187B68E7002FEB5C /* random.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DA509F3187B68E7002FEB5C /* random.h */; };
192192
A18A6CC7172DC28500419892 /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = A18A6CC5172DC28500419892 /* UIImage+GIF.h */; };
@@ -206,8 +206,6 @@
206206
/* End PBXContainerItemProxy section */
207207

208208
/* Begin PBXFileReference section */
209-
1797E3D4E27D504ACD827BE1 /* NSData+ImageContentType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+ImageContentType.m"; sourceTree = SOURCE_ROOT; };
210-
1797E851007E466318B38B47 /* NSData+ImageContentType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+ImageContentType.h"; sourceTree = SOURCE_ROOT; };
211209
530E49E316460AE2002868E7 /* SDWebImageDownloaderOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDWebImageDownloaderOperation.h; sourceTree = "<group>"; };
212210
530E49E416460AE2002868E7 /* SDWebImageDownloaderOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDWebImageDownloaderOperation.m; sourceTree = "<group>"; };
213211
530E49E71646388E002868E7 /* SDWebImageOperation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDWebImageOperation.h; sourceTree = "<group>"; };
@@ -279,6 +277,8 @@
279277
53EDFD0017625F7900698166 /* thread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = thread.c; path = Vendors/libwebp/src/utils/thread.c; sourceTree = "<group>"; };
280278
53FB893F14D35D1A0020B787 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
281279
53FB894814D35E9E0020B787 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
280+
5D5B9140188EE8DD006D06BD /* NSData+ImageContentType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+ImageContentType.h"; sourceTree = "<group>"; };
281+
5D5B9141188EE8DD006D06BD /* NSData+ImageContentType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+ImageContentType.m"; sourceTree = "<group>"; };
282282
5DA509F2187B68E7002FEB5C /* random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = random.c; path = Vendors/libwebp/src/utils/random.c; sourceTree = "<group>"; };
283283
5DA509F3187B68E7002FEB5C /* random.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = random.h; path = Vendors/libwebp/src/utils/random.h; sourceTree = "<group>"; };
284284
A18A6CC5172DC28500419892 /* UIImage+GIF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+GIF.h"; sourceTree = "<group>"; };
@@ -367,6 +367,8 @@
367367
53922DA9148C562D0056699D /* Categories */ = {
368368
isa = PBXGroup;
369369
children = (
370+
5D5B9140188EE8DD006D06BD /* NSData+ImageContentType.h */,
371+
5D5B9141188EE8DD006D06BD /* NSData+ImageContentType.m */,
370372
53EDFB8817623F7C00698166 /* UIImage+MultiFormat.h */,
371373
53EDFB8917623F7C00698166 /* UIImage+MultiFormat.m */,
372374
A18A6CC5172DC28500419892 /* UIImage+GIF.h */,
@@ -379,8 +381,6 @@
379381
53922D94148C56230056699D /* UIButton+WebCache.m */,
380382
53922D95148C56230056699D /* UIImageView+WebCache.h */,
381383
53922D96148C56230056699D /* UIImageView+WebCache.m */,
382-
1797E851007E466318B38B47 /* NSData+ImageContentType.h */,
383-
1797E3D4E27D504ACD827BE1 /* NSData+ImageContentType.m */,
384384
);
385385
name = Categories;
386386
sourceTree = "<group>";
@@ -523,11 +523,11 @@
523523
53EDFCCC17625DD700698166 /* color_cache.h in Headers */,
524524
53EDFCD217625DFA00698166 /* lossless.h in Headers */,
525525
53EDFCE417625EB100698166 /* yuv.h in Headers */,
526+
5D5B9144188EE8DD006D06BD /* NSData+ImageContentType.h in Headers */,
526527
53EDFCF017625F1D00698166 /* rescaler.h in Headers */,
527528
53EDFCF617625F4100698166 /* utils.h in Headers */,
528529
53EDFCFC17625F5F00698166 /* filters.h in Headers */,
529530
53EDFD0217625F7900698166 /* thread.h in Headers */,
530-
1797E75161F3C9E8494E43E6 /* NSData+ImageContentType.h in Headers */,
531531
);
532532
runOnlyForDeploymentPostprocessing = 0;
533533
};
@@ -536,6 +536,7 @@
536536
buildActionMask = 2147483647;
537537
files = (
538538
53761316155AD0D5005750A4 /* SDImageCache.h in Headers */,
539+
5D5B9142188EE8DD006D06BD /* NSData+ImageContentType.h in Headers */,
539540
53761318155AD0D5005750A4 /* SDWebImageCompat.h in Headers */,
540541
53761319155AD0D5005750A4 /* SDWebImageDecoder.h in Headers */,
541542
5376131A155AD0D5005750A4 /* SDWebImageDownloader.h in Headers */,
@@ -547,7 +548,6 @@
547548
530E49EA16464C7C002868E7 /* SDWebImageDownloaderOperation.h in Headers */,
548549
A18A6CC7172DC28500419892 /* UIImage+GIF.h in Headers */,
549550
53EDFB8A17623F7C00698166 /* UIImage+MultiFormat.h in Headers */,
550-
1797E59FBF11E6588BC89B66 /* NSData+ImageContentType.h in Headers */,
551551
);
552552
runOnlyForDeploymentPostprocessing = 0;
553553
};
@@ -580,11 +580,11 @@
580580
537D95B717ECC1FE0097C263 /* alpha_processing.h in Headers */,
581581
5DA509F5187B68E7002FEB5C /* random.h in Headers */,
582582
537D95B817ECC1FE0097C263 /* yuv.h in Headers */,
583+
5D5B9143188EE8DD006D06BD /* NSData+ImageContentType.h in Headers */,
583584
537D95B917ECC1FE0097C263 /* rescaler.h in Headers */,
584585
537D95BA17ECC1FE0097C263 /* utils.h in Headers */,
585586
537D95BB17ECC1FE0097C263 /* filters.h in Headers */,
586587
537D95BC17ECC1FE0097C263 /* thread.h in Headers */,
587-
1797E364CA5D259B8CEDF8EE /* NSData+ImageContentType.h in Headers */,
588588
);
589589
runOnlyForDeploymentPostprocessing = 0;
590590
};
@@ -755,12 +755,12 @@
755755
53EDFCE017625E8D00698166 /* upsampling.c in Sources */,
756756
53EDFCE617625EB100698166 /* yuv.c in Sources */,
757757
53EDFCE917625EC800698166 /* io.c in Sources */,
758+
5D5B9147188EE8DD006D06BD /* NSData+ImageContentType.m in Sources */,
758759
53EDFCEC17625EE200698166 /* upsampling_sse2.c in Sources */,
759760
53EDFCF217625F1D00698166 /* rescaler.c in Sources */,
760761
53EDFCF817625F4100698166 /* utils.c in Sources */,
761762
53EDFCFE17625F5F00698166 /* filters.c in Sources */,
762763
53EDFD0417625F7900698166 /* thread.c in Sources */,
763-
1797EBFB62F22E5C0A26A75D /* NSData+ImageContentType.m in Sources */,
764764
);
765765
runOnlyForDeploymentPostprocessing = 0;
766766
};
@@ -778,8 +778,8 @@
778778
530E49EC16464C84002868E7 /* SDWebImageDownloaderOperation.m in Sources */,
779779
53406750167780C40042B59E /* SDWebImageCompat.m in Sources */,
780780
A18A6CC9172DC28500419892 /* UIImage+GIF.m in Sources */,
781+
5D5B9145188EE8DD006D06BD /* NSData+ImageContentType.m in Sources */,
781782
53EDFB8C17623F7C00698166 /* UIImage+MultiFormat.m in Sources */,
782-
1797E37E262405DB1BFEDFFC /* NSData+ImageContentType.m in Sources */,
783783
);
784784
runOnlyForDeploymentPostprocessing = 0;
785785
};
@@ -803,6 +803,7 @@
803803
537D958217ECC1FE0097C263 /* webp.c in Sources */,
804804
537D958317ECC1FE0097C263 /* vp8l.c in Sources */,
805805
537D958417ECC1FE0097C263 /* vp8.c in Sources */,
806+
5D5B9146188EE8DD006D06BD /* NSData+ImageContentType.m in Sources */,
806807
537D958517ECC1FE0097C263 /* huffman.c in Sources */,
807808
537D958617ECC1FE0097C263 /* frame.c in Sources */,
808809
537D958717ECC1FE0097C263 /* alpha.c in Sources */,
@@ -825,7 +826,6 @@
825826
537D959817ECC1FE0097C263 /* utils.c in Sources */,
826827
537D959917ECC1FE0097C263 /* filters.c in Sources */,
827828
537D959A17ECC1FE0097C263 /* thread.c in Sources */,
828-
1797ED4CD80EA8BD405365C3 /* NSData+ImageContentType.m in Sources */,
829829
);
830830
runOnlyForDeploymentPostprocessing = 0;
831831
};
File renamed without changes.

NSData+ImageContentType.m renamed to SDWebImage/NSData+ImageContentType.m

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88

99
@implementation NSData (ImageContentType)
1010

11-
+ (NSString *)contentTypeForImageData:(NSData *)data
12-
{
11+
+ (NSString *)contentTypeForImageData:(NSData *)data {
1312
uint8_t c;
1413
[data getBytes:&c length:1];
15-
switch (c)
16-
{
14+
switch (c) {
1715
case 0xFF:
1816
return @"image/jpeg";
1917
case 0x89:
@@ -25,17 +23,15 @@ + (NSString *)contentTypeForImageData:(NSData *)data
2523
return @"image/tiff";
2624
case 0x52:
2725
// R as RIFF for WEBP
28-
if ([data length] < 12)
29-
{
26+
if ([data length] < 12) {
3027
return nil;
3128
}
32-
29+
3330
NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding];
34-
if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"])
35-
{
31+
if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) {
3632
return @"image/webp";
3733
}
38-
34+
3935
return nil;
4036
}
4137
return nil;

0 commit comments

Comments
 (0)