bug-gnustep
[Top][All Lists]
Advanced

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

[bug #16068] negative integers in property lists (thus, user defaults) a


From: Wolfgang Sourdeau
Subject: [bug #16068] negative integers in property lists (thus, user defaults) are set to 0
Date: Sun, 12 Mar 2006 04:14:25 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=16068>

                 Summary: negative integers in property lists (thus, user
defaults) are set to 0
                 Project: GNUstep
            Submitted by: wolfgang
            Submitted on: dim 12.03.2006 à 04:14
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open

    _______________________________________________________

Details:

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')







    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: dim 12.03.2006 à 04:14  Name: NSPropertyList-fixed.patch  Size: 643o  
By: wolfgang
the patch mentioned above
<http://savannah.gnu.org/bugs/download.php?item_id=16068&item_file_id=3494>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=16068>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/





reply via email to

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