23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
-
+
-
+
-
+
-
+
-
|
- (instancetype)initWithBytes: (const void *)bytes
objCType: (const char *)objCType
{
self = [super init];
@try {
_size = of_sizeof_type_encoding(objCType);
_size = OFSizeOfTypeEncoding(objCType);
_objCType = objCType;
_bytes = of_alloc(1, _size);
_bytes = OFAllocMemory(1, _size);
memcpy(_bytes, bytes, _size);
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
free(_bytes);
OFFreeMemory(_bytes);
[super dealloc];
}
- (void)getValue: (void *)value
- (void)getValue: (void *)value size: (size_t)size
size: (size_t)size
{
if (size != _size)
@throw [OFOutOfRangeException exception];
memcpy(value, _bytes, _size);
}
@end
|