Differences From Artifact [a4f78a390c]:
- File src/OFArray.m — part of check-in [70a65567df] at 2009-04-25 12:48:28 on branch trunk — An item size of 0 is invalid for an array. (user: js, size: 4850) [annotate] [blame] [check-ins using]
To Artifact [91667fe0ee]:
- File
src/OFArray.m
— part of check-in
[e959fed010]
at
2009-04-26 12:44:20
on branch trunk
— A few renames in OFObject.
getMemWithSize: -> allocWithSize:
getMemForNItems:ofSize: -> allocNItems:withSize:
resizeMem:toNItems:ofSize: -> resizeMem:toNItems:withSize: (user: js, size: 4871) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
84 85 86 87 88 89 90 |
- add: (void*)item
{
if (SIZE_MAX - items < 1 || items + 1 > SIZE_MAX / itemsize)
@throw [OFOutOfRangeException newWithClass: isa];
data = [self resizeMem: data
toNItems: items + 1
| | | | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
- add: (void*)item
{
if (SIZE_MAX - items < 1 || items + 1 > SIZE_MAX / itemsize)
@throw [OFOutOfRangeException newWithClass: isa];
data = [self resizeMem: data
toNItems: items + 1
withSize: itemsize];
memcpy(data + items++ * itemsize, item, itemsize);
return self;
}
- addNItems: (size_t)nitems
fromCArray: (void*)carray
{
if (nitems > SIZE_MAX - items || items + nitems > SIZE_MAX / itemsize)
@throw [OFOutOfRangeException newWithClass: isa];
data = [self resizeMem: data
toNItems: items + nitems
withSize: itemsize];
memcpy(data + items * itemsize, carray, nitems * itemsize);
items += nitems;
return self;
}
- removeNItems: (size_t)nitems
{
if (nitems > items)
@throw [OFOutOfRangeException newWithClass: isa];
data = [self resizeMem: data
toNItems: items - nitems
withSize: itemsize];
items -= nitems;
return self;
}
- (id)copy
|
| ︙ | ︙ |