erdemolkun / plist

Automatically exported from code.google.com/p/plist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix for negative INTEGER values problem in binary format

GoogleCodeExporter opened this issue · comments

Hi,

I've attached a patch that fixes a problem with negative integer NSNumbers 
(there already was a remark in the code). In Java, all int and long values are 
signed. Therefore, the simple test, e.g. "<256" for a 1-byte-representation is 
not sufficient. Instead, all negative values have to be stored in 8 bytes since 
the most significant bit (the sign) is is set.

Similarily, BinaryPropertyListWriter.writeIntHeader(int) can not handle 
negative values. Instead of correcting this, I've only added an assertion. This 
is because any use of that method only deals with sizes of objects, which are 
>= 0 by nature.

Please consider to apply this patch.

Have fun!


PS: Small copy-and-paste-bug on the example Wiki page: When adding "Lisa", you 
should consistently use "person2"...

Original issue reported on code.google.com by volker.r...@gmail.com on 18 Aug 2011 at 12:48

Attachments:

Thanks for the patch, fixed with r42.

Original comment by kei...@alum.mit.edu on 23 Aug 2011 at 6:49

  • Changed state: Fixed