Overview
Comment: | OFMethodSignature: Add frame length and offsets |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3c740455b59e6131fc9a3286f38fa857 |
User & Date: | js on 2017-09-10 00:45:44 |
Other Links: | manifest | tags |
Context
2017-09-10
| ||
20:39 | Add of_{sizeof,alignof}_type_encoding() check-in: b03cff2f49 user: js tags: trunk | |
00:45 | OFMethodSignature: Add frame length and offsets check-in: 3c740455b5 user: js tags: trunk | |
2017-09-09
| ||
22:21 | src/encodings: Rename a few files check-in: da8cd1c0ad user: js tags: trunk | |
Changes
Modified src/OFMethodSignature.h from [c5568c9fc1] to [009831faed].
︙ | |||
24 25 26 27 28 29 30 | 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 | - + + + + + + + + | * @class OFMethodSignature OFMethodSignature.h ObjFW/OFMethodSignature.h * * @brief A class for parsing type encodings and accessing them. */ @interface OFMethodSignature: OFObject { char *_types; |
︙ | |||
58 59 60 61 62 63 64 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - + + + + + + + + + + + + + | * @return An Initialized OFMethodSignature */ - initWithObjCTypes: (const char *)types; /*! * @brief Returns the ObjC type for the argument at the specified index. * |
Modified src/OFMethodSignature.m from [6d6b60fdc0] to [81cb0b1392].
︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | + + + + - + + + + | @throw [OFInvalidFormatException exception]; _types = [self allocMemoryWithSize: length + 1]; memcpy(_types, types, length); _typesPointers = [[OFMutableData alloc] initWithItemSize: sizeof(char *)]; _offsets = [[OFMutableData alloc] initWithItemSize: sizeof(size_t)]; last = _types; for (size_t i = 0; i < length; i++) { if (isdigit(_types[i])) { size_t offset = _types[i] - '0'; if (last == _types + i) @throw [OFInvalidFormatException exception]; _types[i] = '\0'; [_typesPointers addItem: &last]; i++; |
︙ | |||
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | 116 117 118 119 120 121 122 123 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 | + + + + + + + + + + + | return self; } - (void)dealloc { [_typesPointers release]; [_offsets release]; [super dealloc]; } - (size_t)numberOfArguments { return [_typesPointers count] - 1; } - (const char *)methodReturnType { return *(const char **)[_typesPointers firstItem]; } - (size_t)frameLength { return *(size_t *)[_offsets firstItem]; } - (const char *)argumentTypeAtIndex: (size_t)index { return *(const char **)[_typesPointers itemAtIndex: index + 1]; } - (size_t)argumentOffsetAtIndex: (size_t)index { return *(size_t *)[_offsets itemAtIndex: index + 1]; } @end |
Modified tests/OFMethodSignatureTests.m from [893652a1f7] to [92ff74642f].
︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - + + + + + - + + + + | TEST(@"-[:signatureWithObjCTypes:] #1", (ms = [OFMethodSignature signatureWithObjCTypes: "i28@0:8S16*20"]) && [ms numberOfArguments] == 4 && strcmp([ms methodReturnType], "i") == 0 && strcmp([ms argumentTypeAtIndex: 0], "@") == 0 && strcmp([ms argumentTypeAtIndex: 1], ":") == 0 && strcmp([ms argumentTypeAtIndex: 2], "S") == 0 && |
︙ |