bug-gnustep
[Top][All Lists]
Advanced

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

[bug #30040] Portability issue with binary property list


From: Wolfgang Lux
Subject: [bug #30040] Portability issue with binary property list
Date: Wed, 02 Jun 2010 20:41:05 +0000
User-agent: Mozilla/5.0 (Macintosh; U; PowerPC Mac OS X 10_4_11; en-US) AppleWebKit/531.9+(KHTML, like Gecko, Safari/528.16) OmniWeb/v622.10.0

URL:
  <http://savannah.gnu.org/bugs/?30040>

                 Summary: Portability issue with binary property list
                 Project: GNUstep
            Submitted by: wlux
            Submitted on: Mi 02 Jun 2010 20:41:04 GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

During recent tests I noticed a portability issue where GNUstep writes binary
property lists that cannot be read back on OS X. The particular issue is that
GNUstep's property list generator unifies integer and floating point numbers
with the same numeric value, but OS X is more picky when reading numeric
values. E.g., given code like
  [aCoder encodeInt: 42 forKey: 'A'];
  [aCoder encodeFloat: 42 forKey: 'B'];
GNUstep writes only a single (integer) number to the archive. When reading
this archive on OS X with the code
  a = [aDecoder decodeIntForKey: 'A'];
  b = [aDecoder decodeFloatForKey: 'B'];
the program will report an exception during the second statement.

I've put together a little test case. Compile the attached producer on
GNUstep, run the program and copy the files archive1 and archive2 to OS X. On
OS X, compile and run the attached consumer (it expects the two archives in
the current directory). It will print the following exceptions:
  Reading archive1 ...
  Exception in consumer.m at line 23: *** -[NSKeyedUnarchiver
decodeIntForKey:]: value for key (A) is not an integer number
  Reading archive2 ...
  Exception in consumer.m at line 31: *** -[NSKeyedUnarchiver
decodeFloatForKey:]: value for key (A) is not a float number
  Done

A quick workaround would be to replace the two -indexOfObject: method calls
in NSPropertyList.m by -indexOfObjectIdenticalTo:, but this is going to
duplicate identical numbers unnecessarily  and may increase the size of saved
archives substantially (OS X doesn't seem to work this way).



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mi 02 Jun 2010 20:41:04 GMT  Name: producer.m  Size: 909B   By: wlux

<http://savannah.gnu.org/bugs/download.php?file_id=20678>
-------------------------------------------------------
Date: Mi 02 Jun 2010 20:41:04 GMT  Name: consumer.m  Size: 1kB   By: wlux

<http://savannah.gnu.org/bugs/download.php?file_id=20679>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30040>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/




reply via email to

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