Revision: 12904
          http://sourceforge.net/p/skim-app/code/12904
Author:   hofman
Date:     2022-05-09 15:07:07 +0000 (Mon, 09 May 2022)
Log Message:
-----------
check 9th byte of data to decide howto interpret notes for ql generator

Modified Paths:
--------------
    trunk/QuickLook-Skim/SKQLConverter.m

Modified: trunk/QuickLook-Skim/SKQLConverter.m
===================================================================
--- trunk/QuickLook-Skim/SKQLConverter.m        2022-05-09 09:43:24 UTC (rev 
12903)
+++ trunk/QuickLook-Skim/SKQLConverter.m        2022-05-09 15:07:07 UTC (rev 
12904)
@@ -166,10 +166,16 @@
 + (NSArray *)notesWithData:(NSData *)data;
 {
     NSArray *notes = nil;
-    @try { notes = [NSKeyedUnarchiver unarchiveObjectWithData:data]; }
-    @catch (id e) {}
-    if (notes == nil)
+    unsigned char ch = 0;
+    if ([data length] > 8)
+        [data getBytes:&ch range:NSMakeRange(8, 1)];
+    ch >>= 4;
+    if (ch == 0xD) {
+        @try { notes = [NSKeyedUnarchiver unarchiveObjectWithData:data]; }
+        @catch (id e) {}
+    } else if (ch == 0xA) {
         notes = [NSPropertyListSerialization propertyListWithData:data 
options:NSPropertyListImmutable format:NULL error:NULL];
+    }
     return notes;
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to