bugGNUstep - Bugs: bug #16068, negative integers in property...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #16068: negative integers in property lists (thus, user defaults) are set to 0

Submitted by:  Wolfgang Sourdeau <wolfgang>
Submitted on:  Sun 12 Mar 2006 09:14:24 AM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Sun 12 Mar 2006 10:59:15 AM UTC, comment #1:

Should be fixed in SVN.
Thanksver much.

Richard Frith-Macdonald <CaS>
Project Member
Sun 12 Mar 2006 09:14:24 AM UTC, original submission:

I have noticed that negative integers stored in the defaults db were encoded with surrounding quotes. This leads NSPropertyList:parsePlItem to not recognize the encoded value because those quotes are passed to atol().

I have not searched in the XML deserializer if this problem was present too but at least I have created a patch to solve that problem (also sent as a file for convenience):

$ diff -u NSPropertyList.m~ NSPropertyList.m
--- NSPropertyList.m~ Thu Feb 16 01:17:13 2006
+++ NSPropertyList.m Sun Mar 12 09:04:16 2006
@@ -714,9 +714,15 @@
if (type == 'I')
{
char buf[len+1];
+ unsigned offset;

- for (i = 0; i < len; i++) buf[i] = (char)ptr[i];
- buf[len] = '\0';
+ offset = 0;
+ for (i = 0; i < len; i++)
+ if ((char)ptr[i] == '"')
+ offset++;
+ else
+ buf[i-offset] = (char)ptr[i];
+ buf[len-offset] = '\0';
result = [[NSNumber alloc] initWithLong: atol(buf)];
}
else if (type == 'B')

Wolfgang Sourdeau <wolfgang>

 

Attached Files
file #1520:  NSPropertyList-fixed.patch added by wolfgang (643B - application/octet-stream - the patch mentioned above)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sun 12 Mar 2006 10:59:33 AM UTCCaSStatusNone=>Fixed
  Open/ClosedOpen=>Closed
Sun 12 Mar 2006 09:14:24 AM UTCwolfgangAttached File-=>Added NSPropertyList-fixed.patch, #3494

Back to the top


Powered by Savane 3.1-cleanup1