Differences From Artifact [bd2dcff559]:
- File src/OFDictionary.m — part of check-in [c8f7b90082] at 2017-07-22 20:50:27 on branch trunk — Split OFDataArray into OFData and OFMutableData (user: js, size: 16925) [annotate] [blame] [check-ins using] [more...]
To Artifact [21f0c3f7c0]:
- File
src/OFDictionary.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: 17199) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
40 41 42 43 44 45 46 | depth: (size_t)depth; @end @interface OFDictionary_placeholder: OFDictionary @end @implementation OFDictionary_placeholder | | | | | | | | | | | | | | | | | 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 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 109 110 111 112 113 114 115 116 117 118 119 | depth: (size_t)depth; @end @interface OFDictionary_placeholder: OFDictionary @end @implementation OFDictionary_placeholder - (instancetype)init { return (id)[[OFDictionary_hashtable alloc] init]; } - (instancetype)initWithDictionary: (OFDictionary *)dictionary { return (id)[[OFDictionary_hashtable alloc] initWithDictionary: dictionary]; } - (instancetype)initWithObject: (id)object forKey: (id)key { return (id)[[OFDictionary_hashtable alloc] initWithObject: object forKey: key]; } - (instancetype)initWithObjects: (OFArray *)objects forKeys: (OFArray *)keys { return (id)[[OFDictionary_hashtable alloc] initWithObjects: objects forKeys: keys]; } - (instancetype)initWithObjects: (id const *)objects forKeys: (id const *)keys count: (size_t)count { return (id)[[OFDictionary_hashtable alloc] initWithObjects: objects forKeys: keys count: count]; } - (instancetype)initWithKeysAndObjects: (id <OFCopying>)firstKey, ... { id ret; va_list arguments; va_start(arguments, firstKey); ret = [[OFDictionary_hashtable alloc] initWithKey: firstKey arguments: arguments]; va_end(arguments); return ret; } - (instancetype)initWithKey: (id <OFCopying>)firstKey arguments: (va_list)arguments { return (id)[[OFDictionary_hashtable alloc] initWithKey: firstKey arguments: arguments]; } - (instancetype)initWithSerialization: (OFXMLElement *)element { return (id)[[OFDictionary_hashtable alloc] initWithSerialization: element]; } - (instancetype)retain { return self; } - (instancetype)autorelease { return self; } - (void)release { } |
︙ | ︙ | |||
127 128 129 130 131 132 133 | @implementation OFDictionary + (void)initialize { if (self == [OFDictionary class]) placeholder.isa = [OFDictionary_placeholder class]; } | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | @implementation OFDictionary + (void)initialize { if (self == [OFDictionary class]) placeholder.isa = [OFDictionary_placeholder class]; } + (instancetype)alloc { if (self == [OFDictionary class]) return (id)&placeholder; return [super alloc]; } |
︙ | ︙ | |||
181 182 183 184 185 186 187 | ret = [[[self alloc] initWithKey: firstKey arguments: arguments] autorelease]; va_end(arguments); return ret; } | | | | | | | | 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 | ret = [[[self alloc] initWithKey: firstKey arguments: arguments] autorelease]; va_end(arguments); return ret; } - (instancetype)init { if (object_getClass(self) == [OFDictionary class]) { @try { [self doesNotRecognizeSelector: _cmd]; } @catch (id e) { [self release]; @throw e; } abort(); } return [super init]; } - (instancetype)initWithDictionary: (OFDictionary *)dictionary { OF_INVALID_INIT_METHOD } - (instancetype)initWithObject: (id)object forKey: (id)key { if (key == nil || object == nil) @throw [OFInvalidArgumentException exception]; return [self initWithKeysAndObjects: key, object, nil]; } - (instancetype)initWithObjects: (OFArray *)objects_ forKeys: (OFArray *)keys_ { id const *objects, *keys; size_t count; @try { count = [objects_ count]; |
︙ | ︙ | |||
235 236 237 238 239 240 241 | } return [self initWithObjects: objects forKeys: keys count: count]; } | | | | | | | | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | } return [self initWithObjects: objects forKeys: keys count: count]; } - (instancetype)initWithObjects: (id const *)objects forKeys: (id const *)keys count: (size_t)count { OF_INVALID_INIT_METHOD } - (instancetype)initWithKeysAndObjects: (id)firstKey, ... { id ret; va_list arguments; va_start(arguments, firstKey); ret = [self initWithKey: firstKey arguments: arguments]; va_end(arguments); return ret; } - (instancetype)initWithKey: (id)firstKey arguments: (va_list)arguments { OF_INVALID_INIT_METHOD } - (instancetype)initWithSerialization: (OFXMLElement *)element { OF_INVALID_INIT_METHOD } - (id)objectForKey: (id)key { OF_UNRECOGNIZED_SELECTOR |
︙ | ︙ | |||
321 322 323 324 325 326 327 | } - (size_t)count { OF_UNRECOGNIZED_SELECTOR } | | | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | } - (size_t)count { OF_UNRECOGNIZED_SELECTOR } - (id)copy { return [self retain]; } - (id)mutableCopy { return [[OFMutableDictionary alloc] initWithDictionary: self]; } - (bool)isEqual: (id)object { OFDictionary *otherDictionary; |
︙ | ︙ |