Skip to content

Commit 0018e13

Browse files
errnull崔 明辉
authored andcommitted
fix: Correct file tag des hit target.
1 parent efa4dd9 commit 0018e13

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Source/SVGAParser.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ - (void)parseWithData:(nonnull NSData *)data
193193
return;
194194
}
195195
NSData *tag = [data subdataWithRange:NSMakeRange(0, 4)];
196-
if (![[tag description] isEqualToString:@"<504b0304>"]) {
196+
NSString *fileTagDes = [tag description];
197+
if (![fileTagDes containsString:@"504b0304"]) {
197198
// Maybe is SVGA 2.0.0
198199
[parseQueue addOperationWithBlock:^{
199200
NSData *inflateData = [self zlibInflate:data];

Source/SVGAVideoEntity.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject {
140140
if (fileName != nil) {
141141
NSString *filePath = [self.cacheDir stringByAppendingFormat:@"/%@.png", fileName];
142142
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
143-
filePath = [self.cacheDir stringByAppendingFormat:@"/%@", fileName];
143+
filePath = [self.cacheDir stringByAppendingFormat:@"/%@", fileName];
144144
}
145145
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
146146
NSData *imageData = [NSData dataWithContentsOfFile:filePath];
@@ -154,11 +154,11 @@ - (void)resetImagesWithProtoObject:(SVGAProtoMovieEntity *)protoObject {
154154
}
155155
else if ([protoImages[key] isKindOfClass:[NSData class]]) {
156156
NSData *fileTag = [protoImages[key] subdataWithRange:NSMakeRange(0, 4)];
157-
if (![[fileTag description] isEqualToString:@"<89504e47>"]) {
157+
NSString *fileTagDes = [fileTag description];
158+
if (![fileTagDes containsString:@"89504e47"]) {
158159
// mp3
159160
[audiosData setObject:protoImages[key] forKey:key];
160-
}
161-
else {
161+
} else {
162162
UIImage *image = [[UIImage alloc] initWithData:protoImages[key] scale:2.0];
163163
if (image != nil) {
164164
[images setObject:image forKey:key];
@@ -181,7 +181,7 @@ - (void)resetSpritesWithProtoObject:(SVGAProtoMovieEntity *)protoObject {
181181
}];
182182
self.sprites = sprites;
183183
}
184-
184+
185185
- (void)resetAudiosWithProtoObject:(SVGAProtoMovieEntity *)protoObject {
186186
NSMutableArray<SVGAAudioEntity *> *audios = [[NSMutableArray alloc] init];
187187
NSArray *protoAudios = [protoObject.audiosArray copy];

0 commit comments

Comments
 (0)