@@ -145,20 +145,23 @@ void CancelPreviewGeneration(void* thisInterface, QLPreviewRequestRef preview)
145
145
#pragma mark -
146
146
147
147
NSString *PreviewForSPF (NSURL *myURL, NSInteger *previewHeight) {
148
-
148
+ NSDictionary *spf = nil ;
149
149
NSError *readError = nil ;
150
- NSString *convError = nil ;
151
- NSPropertyListFormat format;
152
- NSString *html = nil ;
153
-
150
+
154
151
// Get spf data as dictionary
155
- NSData *pData = [NSData dataWithContentsOfFile: [myURL path ] options: NSUncachedRead error: &readError];
156
- NSDictionary *spf = [[NSPropertyListSerialization propertyListFromData: pData
157
- mutabilityOption: NSPropertyListImmutable
158
- format: &format
159
- errorDescription: &convError] retain ];
152
+ NSData *pData = [NSData dataWithContentsOfFile: [myURL path ]
153
+ options: NSUncachedRead
154
+ error: &readError];
155
+
156
+ if (pData && !readError) {
157
+ spf = [[NSPropertyListSerialization propertyListWithData: pData
158
+ options: NSPropertyListImmutable
159
+ format: NULL
160
+ error: &readError] retain ];
161
+ }
160
162
161
- if (!readError && spf && ![convError length ] && (format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
163
+ NSString *html = nil ;
164
+ if (!readError && spf) {
162
165
NSString *spfType = [spf objectForKey: SPFFormatKey];
163
166
NSString *(*fp)(NSDictionary *spf,NSURL *myURL, NSInteger *previewHeight) = NULL ;
164
167
// Dispatch different spf formats
@@ -378,16 +381,21 @@ static inline void CopyIf(NSDictionary *src,NSString *key,NSMutableDictionary *d
378
381
}
379
382
380
383
NSError *readError = nil ;
381
- NSString *convError = nil ;
382
- NSPropertyListFormat format;
383
384
NSDictionary *spf = nil ;
384
385
385
386
// Get info.plist data as dictionary
386
- NSData *pData = [NSData dataWithContentsOfFile: [NSString stringWithFormat: @" %@ /info.plist" , [myURL path ]] options: NSUncachedRead error: &readError];
387
- spf = [[NSPropertyListSerialization propertyListFromData: pData
388
- mutabilityOption: NSPropertyListImmutable format: &format errorDescription: &convError] retain ];
387
+ NSData *pData = [NSData dataWithContentsOfFile: [[myURL path ] stringByAppendingPathComponent: @" info.plist" ]
388
+ options: NSUncachedRead
389
+ error: &readError];
390
+
391
+ if (pData && !readError) {
392
+ spf = [[NSPropertyListSerialization propertyListWithData: pData
393
+ options: NSPropertyListImmutable
394
+ format: NULL
395
+ error: &readError] retain ];
396
+ }
389
397
390
- if (!spf || readError != nil || [convError length ] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0) ) {
398
+ if (!spf || readError) {
391
399
[spf release ];
392
400
return nil ;
393
401
}
@@ -434,14 +442,19 @@ static inline void CopyIf(NSDictionary *src,NSString *key,NSMutableDictionary *d
434
442
continue ;
435
443
}
436
444
// Get info.plist data as dictionary
437
- NSDictionary *sessionSpf;
445
+ NSDictionary *sessionSpf = nil ;
438
446
pData = [NSData dataWithContentsOfFile: spfPath options: NSUncachedRead error: &readError];
439
- sessionSpf = [[NSPropertyListSerialization propertyListFromData: pData
440
- mutabilityOption: NSPropertyListImmutable format: &format errorDescription: &convError] retain ];
447
+ if (pData && !readError) {
448
+ sessionSpf = [[NSPropertyListSerialization propertyListWithData: pData
449
+ options: NSPropertyListImmutable
450
+ format: NULL
451
+ error: &readError] retain ];
452
+ }
441
453
442
- if (!sessionSpf || readError != nil || [convError length ] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0) ) {
454
+ if (!sessionSpf || readError) {
443
455
[spfsHTML appendFormat: @" %@ ∅" , [tab objectForKey: @" path" ]];
444
- } else {
456
+ }
457
+ else {
445
458
446
459
NSString *name = @" ••••" ;
447
460
NSString *host = @" ••••" ;
0 commit comments