Differences From Artifact [1c7667e82c]:
- File src/OFArray.m — part of check-in [00476e4430] at 2017-10-11 20:53:10 on branch trunk — Fix shadowed variables and enable -Wshadow (user: js, size: 18605) [annotate] [blame] [check-ins using]
To Artifact [5414c26349]:
- File
src/OFArray.m
— part of check-in
[2f4e0df8be]
at
2017-10-17 00:33:37
on branch trunk
— Do not use implicit method return types
Instead, explicitly declare them, as OF_ASSUME_NONNULL_{BEGIN,END} does
not apply to implicit return types. This means that after this commit,
all init methods have a nonnull return type, as they should have. (user: js, size: 18865) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
42 43 44 45 46 47 48 | depth: (size_t)depth; @end @interface OFArray_placeholder: OFArray @end @implementation OFArray_placeholder | | | | | | | | | | | | | 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 | depth: (size_t)depth; @end @interface OFArray_placeholder: OFArray @end @implementation OFArray_placeholder - (instancetype)init { return (id)[[OFArray_adjacent alloc] init]; } - (instancetype)initWithObject: (id)object { return (id)[[OFArray_adjacent alloc] initWithObject: object]; } - (instancetype)initWithObjects: (id)firstObject, ... { id ret; va_list arguments; va_start(arguments, firstObject); ret = [[OFArray_adjacent alloc] initWithObject: firstObject arguments: arguments]; va_end(arguments); return ret; } - (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { return (id)[[OFArray_adjacent alloc] initWithObject: firstObject arguments: arguments]; } - (instancetype)initWithArray: (OFArray *)array { return (id)[[OFArray_adjacent alloc] initWithArray: array]; } - (instancetype)initWithObjects: (id const *)objects count: (size_t)count { return (id)[[OFArray_adjacent alloc] initWithObjects: objects count: count]; } - (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFArray_adjacent alloc] initWithSerialization: element]; } - (instancetype)retain { return self; } - (instancetype)autorelease { return self; } - (void)release { } |
︙ | ︙ | |||
116 117 118 119 120 121 122 | @implementation OFArray + (void)initialize { if (self == [OFArray class]) placeholder.isa = [OFArray_placeholder class]; } | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | @implementation OFArray + (void)initialize { if (self == [OFArray class]) placeholder.isa = [OFArray_placeholder class]; } + (instancetype)alloc { if (self == [OFArray class]) return (id)&placeholder; return [super alloc]; } |
︙ | ︙ | |||
159 160 161 162 163 164 165 | + (instancetype)arrayWithObjects: (id const *)objects count: (size_t)count { return [[[self alloc] initWithObjects: objects count: count] autorelease]; } | | | | | | > > > > > | > < < < < < < | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | + (instancetype)arrayWithObjects: (id const *)objects count: (size_t)count { return [[[self alloc] initWithObjects: objects count: count] autorelease]; } - (instancetype)init { if (object_getClass(self) == [OFArray class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; @throw e; } abort(); } return [super init]; } - (instancetype)initWithObject: (id)object { if (object == nil) { [self release]; @throw [OFInvalidArgumentException exception]; } return [self initWithObjects: object, nil]; } - (instancetype)initWithObjects: (id)firstObject, ... { id ret; va_list arguments; va_start(arguments, firstObject); ret = [self initWithObject: firstObject arguments: arguments]; va_end(arguments); return ret; } - (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { OF_INVALID_INIT_METHOD } - (instancetype)initWithArray: (OFArray *)array { OF_INVALID_INIT_METHOD } - (instancetype)initWithObjects: (id const *)objects count: (size_t)count { OF_INVALID_INIT_METHOD } - (instancetype)initWithSerialization: (OFXMLElement *)element { OF_INVALID_INIT_METHOD } - (size_t)count { OF_UNRECOGNIZED_SELECTOR |
︙ | ︙ | |||
249 250 251 252 253 254 255 | [self getObjects: buffer inRange: of_range(0, count)]; return buffer; } | | | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | [self getObjects: buffer inRange: of_range(0, count)]; return buffer; } - (id)copy { return [self retain]; } - (id)mutableCopy { return [[OFMutableArray alloc] initWithArray: self]; } - (id)objectAtIndex: (size_t)index { OF_UNRECOGNIZED_SELECTOR |
︙ | ︙ | |||
944 945 946 947 948 949 950 | return [current autorelease]; } #endif @end @implementation OFArrayEnumerator | | | | 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 | return [current autorelease]; } #endif @end @implementation OFArrayEnumerator - (instancetype)initWithArray: (OFArray *)array mutationsPtr: (unsigned long *)mutationsPtr { self = [super init]; _array = [array retain]; _count = [array count]; _mutations = (mutationsPtr != NULL ? *mutationsPtr : 0); _mutationsPtr = mutationsPtr; |
︙ | ︙ |