discuss-gnustep
[Top][All Lists]
Advanced

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

Probably bug in NSNumber


From: UBoss UBoss
Subject: Probably bug in NSNumber
Date: Tue, 17 Oct 2006 09:00:33 +0000

Hi all,
maybe there is a bug in saving NSNumber
here is piece of code
//---------------------------------------
    NSMutableDictionary *dcit = [NSMutableDictionary dictionary];
    [dcit setObject:[NSNumber numberWithBool :YES] forKey:@"BoolYES"];
    [dcit setObject:[NSNumber numberWithBool :NO] forKey:@"BoolNO"];
    [dcit setObject:[NSNumber numberWithInt :10] forKey:@"IntPlus"];
    [dcit setObject:[NSNumber numberWithInt :-10] forKey:@"IntMinus"];
    [dcit setObject:[NSNumber numberWithFloat :25.5] forKey:@"RealPlus"];
    [dcit setObject:[NSNumber numberWithFloat :-25.5] forKey:@"RealMinus"];
    [dcit writeToFile:@"/tmp/numbers.dct" atomically:YES];
//---------------------------------------
and the file numbers.dct is

{
    BoolNO = <*BN>;
    BoolYES = <*BY>;
    IntMinus = <*I"-10">;
    IntPlus = <*I10>;
    RealMinus = <*R"-25.5">;
    RealPlus = <*R25.5>;
}

when reading back to NSDictionary
//---------------------------------------------------------------------------
    NSMutableDictionary *dcit = [NSMutableDictionary dictionaryWithContentsOfFile:@"/tmp/cisla
.dct"];
    NSLog(@"BY %@",[dcit objectForKey:@"BoolYES"]);
    NSLog(@"BN %@",[dcit objectForKey:@"BoolNO"]);
    NSLog(@"IP %@",[dcit objectForKey:@"IntPlus"]);
    NSLog(@"IM %@",[dcit objectForKey:@"IntMinus"]);
    NSLog(@"RP %@",[dcit objectForKey:@"RealPlus"]);
    NSLog(@"RM %@",[dcit objectForKey:@"RealMinus"]);
//------------------------------------------------------------

2006-10-17 07:35:53.781 gui2[10550] BY YES
2006-10-17 07:35:53.781 gui2[10550] BN NO
2006-10-17 07:35:53.781 gui2[10550] IP 10
2006-10-17 07:35:53.781 gui2[10550] IN 0
2006-10-17 07:35:53.781 gui2[10550] RP 25.5
2006-10-17 07:35:53.781 gui2[10550] RN 0

IntMinus and RealMinus is wrong
after modifi numbers.dct to this

{
    BoolNO = <*BN>;
    BoolYES = <*BY>;
    IntMinus = <*I-10>;
    IntPlus = <*I10>;
    RealMinus = <*R-25.5>;
    RealPlus = <*R25.5>;
}

result is OK
2006-10-17 07:35:53.782 gui2[10550] BY YES
2006-10-17 07:35:53.782 gui2[10550] BN NO
2006-10-17 07:35:53.782 gui2[10550] IP 10
2006-10-17 07:35:53.782 gui2[10550] IM -10
2006-10-17 07:35:53.782 gui2[10550] RP 25.5
2006-10-17 07:35:53.782 gui2[10550] RM -25.5

so maybe is bug in saving NSNumber  (ie the quotes around <*I"-10"> and <*R"-25.5">)

currently using gnustep-base 1.8.0

for now i can't test it with current SVN version so if someone could test it if this still ocurs or if already repaired.
thanks


reply via email to

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