discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNUStep parsing OSX binary plist changed?


From: Fred Kiefer
Subject: Re: GNUStep parsing OSX binary plist changed?
Date: Sat, 30 Jan 2010 14:01:18 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.5) Gecko/20091130 SUSE/3.0.0-1.1.1 Thunderbird/3.0

Thank you for providing an example file. This showed that the GNUstep
parsing code processed the file correctly, but returned the wrong object
as the root. This was caused by our code expecting the root object to
always be the first one in the file (index 0). This wasn't true for your
example. And it was obvious that the index of the root object had to be
encoded in the trailer of this file and clearly there was the value 0F
at index D4.
Our binary property list parsing code has been reverse engineered by
only looking at property list files and yours was the first file where
the root object wasn't at index 0. To change the code was easy now and I
fixed a few minor issues with our code while doing this.
I also double checked with Nikolaus binary property list parsing code,
his implementation is based on documentation published by Apple. And we
seem to be very similar now in the handling of the root object. What
GNUstep doesn't support are full 8 byte values in the trailer. So we
will fail for huge property lists.

Please try again with current SVN code for base.
Fred


Am 29.01.2010 19:28, schrieb L Zee:
> Thanks for responding and clarifying it is printing the class of the object. 
> I am expecting the object to be a NSDicrionary object.
> I have attached the History.plist file, and additional info on the the 
> results using this file.
> 
> 
> The below code on Linux w/GNUStep (native Ubuntu 9.04)
> $>md5sum ~/Desktop/History.plist
> 
> 656ce0c8705d8c38b95a22356b6cfd9a
> 
> $> ./test ~/Desktop/History.plist
> 
> 
> 2010-01-29 13:15:26.594 safari_hist[3276] WebHistoryFileVersion
> 2010-01-29 13:15:26.604 safari_hist[3276] Detected format as GSCBufferString
> Aborted
> 
> 
> The same code (below) on OSX with the same History.plist file
> 
> maccy$ md5 ~Desktop/History.plist
> 
> MD5 (History.plist) = 656ce0c8705d8c38b95a22356b6cfd9a
> 
> 
> 
> maccy$ ./test ~/Desktop/History.plist
> 
> 2010-01-29 13:17:30.132 test[1019] {
> 
>     WebHistoryDates = (
> 
>         {
> 
>             "" = "http://www.apple.com/startpage/";;
> 
>             D = (2);
> 
>             lastVisitedDate = "286477969.8";
> 
>             title = "Apple - Start";
> 
>             visitCount = 2;
> 
>         }
> 
>     );
> 
>     WebHistoryFileVersion = 1;
> 
> }
> 
> 2010-01-29 13:17:30.133 test[1019] Detected format as NSCFDictionary
> 
> 2010-01-29 13:17:30.133 test[1019] 1
> 
> Thanks for your help.
> 
>  
>> Date: Thu, 28 Jan 2010 16:26:57 +0100
>> From: fredkiefer@gmx.de
>> To: casasearch@hotmail.com
>> CC: discuss-gnustep@gnu.org
>> Subject: Re: GNUStep parsing OSX binary plist changed?
>>
>> Your code is not printing the actual format of the plist, rather it
>> prints the class of the extracted object. And if this is a string in
>> GNUstep then the call to objectForKey: is bound to fail.
>>
>> Most likely the plist format used by Safari has changed or your aren't
>> looking at the same file in both cases.
>>
>> This could be easily investigated if you mail the plist in question (or
>> even better a very simple one that reproduces the problem). I tried to
>> find the History.plist on my Mac, but failed. The only thing I found was
>> a History directory for Safari with plenty of files in it. All of them
>> looked like normal plists to me.
>>
>> Fred
>>
>> Am 28.01.2010 02:30, schrieb L Zee:
>>> I recently discovered that a one of my GNUStep programs that parses
>>> Safari History.plist files can't parse the files in new versions of
>>> safari.
>>>
>>> As a test ,when I compile and run the following code on OSX using a
>>> plist file, it tells me the "plist class" of the plist is "Detected
>>> format as NSCFDictionary".
>>>
>>> When I run the same code compiled on GNUStep that's bundled with
>>> ubuntu 9.04, using the same plist file, it tells me the "plist class"
>>> is "Detected format as GSCBufferString" and the program aborts.
>>>
>>> Any ideas on how I can continue to parse these files using GNUstep?
>>>
>>> Thanks
>>>
>>> ----------------------------------
>>>
>>>
>>> #include <Foundation/Foundation.h>
>>>
>>> // MAIN int main (int argc, const char * argv[]) {
>>>
>>> // Defs. NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]
>>> init]; NSData *plistData; NSString *error; NSPropertyListFormat
>>> format; id plist; id dict_val;
>>>
>>>
>>> plistData = [NSData dataWithContentsOfFile: [NSString
>>> stringWithCString: argv[1]]];
>>>
>>> plist = [NSPropertyListSerialization propertyListFromData:plistData 
>>> mutabilityOption:NSPropertyListMutableContainers format:&format 
>>> errorDescription:&error];
>>>
>>> NSLog(@"%@",plist); NSLog(@"Detected format as %@", [plist
>>> class],plist) ;
>>>
>>>
>>> dict_val = [plist objectForKey: @"WebHistoryDates"];
>>>
>>> NSLog(@"%@",dict_val);
>>>
>>>
>>> [pool release]; return 0; }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]