• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: setPropertyList forType / propertyListForType problem on 10.2.8
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setPropertyList forType / propertyListForType problem on 10.2.8


  • Subject: Re: setPropertyList forType / propertyListForType problem on 10.2.8
  • From: Ryuichi MIZUNO <email@hidden>
  • Date: Fri, 24 Oct 2003 23:42:33 +0900

On 2003.10.18, at 02:55 AM, Ryuichi MIZUNO wrote:

Hi All,

on 10.2.8, NSPasteboard's read/write method pair for propertyList has a serious problem about NSDictionary
which has NSDecimalNumber type value.
NSDecimalNumber value cannot be retrieved correctly through pasteboard using this method pair.


The same problem about NSDecimalNumber value can be seen in NSPropertyListSerialization itself

pList = [self getPList];
data = [NSPropertyListSerialization dataFromPropertyList:pList
format:NSPropertyListXMLFormat_v1_0
errorDescription:NULL];

string = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
NSLog(@"string = %@",string);

XML format property List is

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
<key>1-INT</key>
<integer>1</integer>
<key>2-FLOAT</key>
<real>2.0999999046325684</real>
<key>3-DOUBLE</key>
<real>0.00031399999999999999</real>

<key>4-DECIMAL-INT</key>
<real>7.7028447212039385e-312</real> // !!!!!!!!!! should be 4
<key>5-DECIMAL-FLOAT</key>
<real>9.1033619432410182e-312</real> // !!!!!!!!!! 5.1
<key>6-DECIMAL-LONGINT</key>
<real>1.0546319081097403e-311</real> // !!!!!!!!!! 67890123456789
</dict>
</plist>

and

pList2 = [string propertyList];
NSLog(@"pList2 = %@",pList2);

<CFDictionary 0x1464640 [0xa01303fc]>{type = mutable, count = 6, capacity = 11, pairs = (
3 : <CFString 0x1461e00 [0xa01303fc]>{contents = "3-DOUBLE"} = <CFNumber 0x1461e50 [0xa01303fc]>{value = +0.00031399999999999999, type = kCFNumberFloat64Type}
5 : <CFString 0x1461e70 [0xa01303fc]>{contents = "4-DECIMAL-INT"} = <CFNumber 0x1461ec0 [0xa01303fc]>{value = +0.00000000000000000000, type = kCFNumberFloat64Type}
10 : <CFString 0x1461ee0 [0xa01303fc]>{contents = "5-DECIMAL-FLOAT"} = <CFNumber 0x1461f00 [0xa01303fc]>{value = +0.00000000000000000000, type = kCFNumberFloat64Type}
12 : <CFString 0x1464480 [0xa01303fc]>{contents = "2-FLOAT"} = <CFNumber 0x1461de0 [0xa01303fc]>{value = +2.09999990463256835938, type = kCFNumberFloat64Type}
14 : <CFString 0x1465640 [0xa01303fc]>{contents = "1-INT"} = <CFNumber 0x1464460 [0xa01303fc]>{value = +1, type = kCFNumberSInt64Type}
15 : <CFString 0x14642b0 [0xa01303fc]>{contents = "6-DECIMAL-LONGINT"} = <CFNumber 0x1464300 [0xa01303fc]>{value = +0.00000000000000000000, type = kCFNumberFloat64Type}
)}


I guess somewhere of NSDecimalNumber is broken.



and more ....
in the case I am testing ...
other side pair method call will casue a termination by signal 10(SIGBUS)
in CFPropertyListCreateFromXMLData.


// string = [pb stringForType:NSStringPboardType];
// NSLog(@"string = %@",string);
string = .... the same one ...

data = [string dataUsingEncoding:NSUTF8StringEncoding];

// this test app will crash in the next methd call
pList = [NSPropertyListSerialization propertyListFromData:data
mutabilityOption:NSPropertyListImmutable
format:NSPropertyListXMLFormat_v1_0
errorDescription:NULL];



NSPropertyListSerialization doesn't work well with NSDecimalNumber.

---
Ryuichi MIZUNO (Cyber Laboratory Inc.)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >setPropertyList forType / propertyListForType problem on 10.2.8 (From: Ryuichi MIZUNO <email@hidden>)

  • Prev by Date: Re: unconnected TextFields
  • Next by Date: Re: NSTask and Notification?
  • Previous by thread: setPropertyList forType / propertyListForType problem on 10.2.8
  • Next by thread: Creating an Alert pop-up from a tool/service?
  • Index(es):
    • Date
    • Thread