bugGNUstep - Bugs: bug #21133, NSKeyedArchiver doesn't encode...

 
 

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

bug #21133: NSKeyedArchiver doesn't encode NSData correctly

Submitted by:  Pauli Ojala <pojala>
Submitted on:  Fri 21 Sep 2007 09:01:52 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri 30 Jan 2009 07:31:00 PM UTC, comment #2:

fixed

Richard Frith-Macdonald <CaS>
Project Member
Wed 03 Oct 2007 05:37:42 AM UTC, comment #1:

I think the actual problem was with NSData returning the wrong value in the classForCoder: method.
I've corrected that ... please could you test and confirm that it works.

Richard Frith-Macdonald <CaS>
Project Member
Fri 21 Sep 2007 09:01:52 PM UTC, original submission:

NSKeyedArchiver doesn't properly encode an NSData object's contents as a data block. The reason for this appears to be that NSData is a class cluster but NSKeyedArchiver fails to check for NSData's concrete subclasses (e.g. NSDataMalloc) when encoding.

On line 248 in NSKeyedArchiver.m, the following check is performed to determine if an object is stored directly:

if (c == [NSString class]
|| c == [NSNumber class]
|| c == [NSDate class]
|| c == [NSData class]
)

Adding the following additional conditions resolved the problem for me:

|| [c isSubclassOfClass:[NSString class]]
|| [c isSubclassOfClass:[NSNumber class]]
|| [c isSubclassOfClass:[NSDate class]]
|| [c isSubclassOfClass:[NSData class]]

Pauli Ojala <pojala>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by pojala
  • -unavailable- added by pojala (Submitted the item)
  •  

    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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 30 Jan 2009 07:31:00 PM UTCCaSOpen/ClosedIn Test=>Closed
    Wed 03 Oct 2007 05:37:42 AM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>In Test
    Fri 21 Sep 2007 09:01:52 PM UTCpojalaCarbon-Copy-=>Added pojala

    Back to the top


    Powered by Savane 3.1-cleanup1