bugGNUstep - Bugs: bug #12801, string starting with '{' in a PL...

Group
 
 

bug #12801: string starting with '{' in a PL is read as dictionary

Submitter:  Benhur Stein <benhur>
Submitted:  Mon 25 Apr 2005 01:23:43 PM UTC
   
 
Category:  Base/Foundation Severity:  2 - Minor
Item Group:  Bug Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 03 Jun 2005 12:45:34 PM UTC, comment #3: 

There was a bug in the defaults program which prevented entry of strings containing '{'.  This is fixed in CVS.

Richard Frith-Macdonald <CaS>
Group Member
Mon 25 Apr 2005 03:01:32 PM UTC, comment #2: 

You are right, I updated base and it works OK.
However, how can I insert a string like this with the "defaults" program?

Thanks,
Benhur

Benhur Stein <benhur>
Mon 25 Apr 2005 02:04:12 PM UTC, comment #1: 

I tried your code with the current gnustep (from CVS) and was unable to reproduce the problem ... ie the value decoded from the defaults system as a string.

Can you produce a test program to demonstrate the problem with the current base library?

Richard Frith-Macdonald <CaS>
Group Member
Mon 25 Apr 2005 01:23:43 PM UTC, original submission:  

If a string starting with the '{' character is stored in a property list, it is read as a dictionary, not as a string.
The following code does not work, cellSizeString is read as nil:

    [[NSUserDefaults standardUserDefaults]
                      setObject:NSStringFromSize(cellSize)
                         forKey:@"StatViewerCellSize"];

    /* ... */
    cellSizeString = [[NSUserDefaults standardUserDefaults]
                            stringForKey:@"StatViewerCellSize"];
    if (cellSizeString != nil) {
        cellSize = NSSizeFromString(cellSizeString);
    }


When looking at the .GNUstepDefaults file, this string is properly written surrounded by quotes, while dictionaries are written without the quotes.
A similar problem probably exists with arrays and data.
Not sure how to make the distinction when writing a default value using the "defaults" tool, though.

Benhur

Benhur Stein <benhur>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 2 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-06-03 CaS Open/ClosedOpen Closed
2005-04-25 CaS StatusNone Works For Me

Back to the top

Powered by Savane 3.13-3230.
Corresponding source code