Index: TODO ================================================================== --- TODO +++ TODO @@ -1,5 +1,7 @@ +OFInteger + Tests for OFFile. OFBase64 OFDirectory Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -51,9 +51,9 @@ - add: (OFListObject*)obj; /** * Creates a new OFListObject and adds it to the OFList. * - * \param ptr Pointer to the data for the OFListObject which will be added + * \param obj A data object for the OFListObject which will be added */ -- addNew: (void*)ptr; +- addNew: (id)obj; @end Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -71,10 +71,10 @@ last = obj; return self; } -- addNew: (void*)ptr +- addNew: (id)obj { - return [self add: [OFListObject newWithData: ptr]]; + return [self add: [OFListObject newWithData: obj]]; } @end Index: src/OFListObject.h ================================================================== --- src/OFListObject.h +++ src/OFListObject.h @@ -14,38 +14,38 @@ /** * The OFListObject class is a class for objects to be stored in an OFObject. */ @interface OFListObject: OFObject { - void *data; + id data; OFListObject *next; OFListObject *prev; } /** - * \param The data the OFListObject should contain + * \param obj The data object the OFListObject should contain * \return A new OFListObject. */ -+ newWithData: (void*)ptr; ++ newWithData: (id)obj; /** * Initializes an already allocated OFListObjeect. * - * \param The data the OFListObject should contain + * \param obj The data object the OFListObject should contain * \return An initialized OFListObject. */ -- initWithData: (void*)ptr; +- initWithData: (id)obj; /** * Free the OFListObject and the data it contains. */ - freeIncludingData; /** - * \return The data included in the OFListObject + * \return The data object included in the OFListObject */ -- (void*)data; +- (id)data; /** * \return The next OFListObject in the OFList */ - (OFListObject*)next; Index: src/OFListObject.m ================================================================== --- src/OFListObject.m +++ src/OFListObject.m @@ -14,35 +14,35 @@ #import #import "OFListObject.h" @implementation OFListObject -+ newWithData: (void*)ptr ++ newWithData: (id)obj { - return [[self alloc] initWithData: ptr]; + return [[self alloc] initWithData: obj]; } -- initWithData: (void*)ptr +- initWithData: (id)obj { if ((self = [super init])) { next = nil; prev = nil; - data = ptr; + data = obj; } return self; } - freeIncludingData { - if (data != NULL) - free(data); + if (data != nil) + [data free]; return [super free]; } -- (void*)data +- (id)data { return data; } - (OFListObject*)next Index: tests/OFList/OFList.m ================================================================== --- tests/OFList/OFList.m +++ tests/OFList/OFList.m @@ -55,19 +55,19 @@ [list addNew: [OFString newFromCString: strings[0]]]; [list addNew: [OFString newFromCString: strings[1]]]; [list addNew: [OFString newFromCString: strings[2]]]; for (iter = [list first], i = 0; iter != nil; iter = [iter next], i++) - if (!strcmp([(OFString*)[iter data] cString], strings[i])) + if (!strcmp([[iter data] cString], strings[i])) SUCCESS else FAIL - CHECK(!strcmp([(OFString*)[[list first] data] cString], strings[0])) - CHECK(!strcmp([(OFString*)[[list last] data] cString], strings[2])) + CHECK(!strcmp([[[list first] data] cString], strings[0])) + CHECK(!strcmp([[[list last] data] cString], strings[2])) puts(""); [list freeIncludingData]; return 0; }