︙ | | | ︙ | |
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"
#import "macros.h"
size_t alignofEncoding(const char **type, size_t *length, bool inStruct);
size_t sizeofEncoding(const char **type, size_t *length);
size_t
alignofArray(const char **type, size_t *length)
{
size_t align;
assert(*length > 0);
(*type)++;
|
|
|
|
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"
#import "macros.h"
static size_t alignofEncoding(const char **type, size_t *length, bool inStruct);
static size_t sizeofEncoding(const char **type, size_t *length);
static size_t
alignofArray(const char **type, size_t *length)
{
size_t align;
assert(*length > 0);
(*type)++;
|
︙ | | | ︙ | |
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
(*type)++;
(*length)--;
return align;
}
size_t
alignofStruct(const char **type, size_t *length)
{
size_t align = 0;
#if defined(OF_POWERPC) && defined(OF_MACOS)
bool first = true;
#endif
|
|
|
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
(*type)++;
(*length)--;
return align;
}
static size_t
alignofStruct(const char **type, size_t *length)
{
size_t align = 0;
#if defined(OF_POWERPC) && defined(OF_MACOS)
bool first = true;
#endif
|
︙ | | | ︙ | |
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
(*type)++;
(*length)--;
return align;
}
size_t
alignofUnion(const char **type, size_t *length)
{
size_t align = 0;
assert(*length > 0);
(*type)++;
|
|
|
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
(*type)++;
(*length)--;
return align;
}
static size_t
alignofUnion(const char **type, size_t *length)
{
size_t align = 0;
assert(*length > 0);
(*type)++;
|
︙ | | | ︙ | |
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
(*type)++;
(*length)--;
return align;
}
size_t
alignofEncoding(const char **type, size_t *length, bool inStruct)
{
size_t align;
if (*length == 0)
@throw [OFInvalidFormatException exception];
|
|
|
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
(*type)++;
(*length)--;
return align;
}
static size_t
alignofEncoding(const char **type, size_t *length, bool inStruct)
{
size_t align;
if (*length == 0)
@throw [OFInvalidFormatException exception];
|
︙ | | | ︙ | |
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
(*type)++;
(*length)--;
return align;
}
size_t
sizeofArray(const char **type, size_t *length)
{
size_t count = 0;
size_t size;
assert(*length > 0);
|
|
|
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
(*type)++;
(*length)--;
return align;
}
static size_t
sizeofArray(const char **type, size_t *length)
{
size_t count = 0;
size_t size;
assert(*length > 0);
|
︙ | | | ︙ | |
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
if (SIZE_MAX / count < size)
@throw [OFOutOfRangeException exception];
return count * size;
}
size_t
sizeofStruct(const char **type, size_t *length)
{
size_t size = 0;
const char *typeCopy = *type;
size_t lengthCopy = *length;
size_t alignment = alignofStruct(&typeCopy, &lengthCopy);
#if defined(OF_POWERPC) && defined(OF_MACOS)
|
|
|
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
if (SIZE_MAX / count < size)
@throw [OFOutOfRangeException exception];
return count * size;
}
static size_t
sizeofStruct(const char **type, size_t *length)
{
size_t size = 0;
const char *typeCopy = *type;
size_t lengthCopy = *length;
size_t alignment = alignofStruct(&typeCopy, &lengthCopy);
#if defined(OF_POWERPC) && defined(OF_MACOS)
|
︙ | | | ︙ | |
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
size += padding;
}
return size;
}
size_t
sizeofUnion(const char **type, size_t *length)
{
size_t size = 0;
assert(*length > 0);
(*type)++;
|
|
|
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
size += padding;
}
return size;
}
static size_t
sizeofUnion(const char **type, size_t *length)
{
size_t size = 0;
assert(*length > 0);
(*type)++;
|
︙ | | | ︙ | |
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
(*type)++;
(*length)--;
return size;
}
size_t
sizeofEncoding(const char **type, size_t *length)
{
size_t size;
if (*length == 0)
@throw [OFInvalidFormatException exception];
|
|
|
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
(*type)++;
(*length)--;
return size;
}
static size_t
sizeofEncoding(const char **type, size_t *length)
{
size_t size;
if (*length == 0)
@throw [OFInvalidFormatException exception];
|
︙ | | | ︙ | |