124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
intoBuffer: (uint8_t*)buf
{
return [self readNItems: size
ofSize: 1
intoBuffer: buf];
}
- (uint8_t*)readNItems: (size_t)nitems
ofSize: (size_t)size
{
uint8_t *ret;
ret = [self getMemForNItems: nitems
ofSize: size];
@try {
[self readNItems: nitems
ofSize: size
intoBuffer: ret];
} @catch (id exception) {
[self freeMem: ret];
@throw exception;
}
return ret;
}
- (uint8_t*)readNBytes: (size_t)size
{
return [self readNItems: size
ofSize: 1];
}
- (size_t)writeNItems: (size_t)nitems
ofSize: (size_t)size
fromBuffer: (const uint8_t*)buf
{
size_t ret;
if ((ret = fwrite(buf, size, nitems, fp)) == 0 &&
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
intoBuffer: (uint8_t*)buf
{
return [self readNItems: size
ofSize: 1
intoBuffer: buf];
}
- (size_t)writeNItems: (size_t)nitems
ofSize: (size_t)size
fromBuffer: (const uint8_t*)buf
{
size_t ret;
if ((ret = fwrite(buf, size, nitems, fp)) == 0 &&
|