Differences From Artifact [74dd1893f5]:
- File
src/OFData.m
— part of check-in
[56a18442e2]
at
2017-09-24 00:59:12
on branch trunk
— Make OFHTTPClient asynchronous
This does not make OFHTTPClientResponse completely asynchronous yet.
Since -[initWithURL:] does not work well with an asynchronous API, it no
longer supports HTTP URLs. However, a new, asynchronous API will be
added as a replacement later on. (user: js, size: 12198) [annotate] [blame] [check-ins using]
To Artifact [15a4b9e206]:
- File
src/OFData.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: 12374) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
110 111 112 113 114 115 116 | } + (instancetype)dataWithBase64EncodedString: (OFString *)string { return [[[self alloc] initWithBase64EncodedString: string] autorelease]; } | | | | | | | | 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 135 136 137 138 139 140 141 142 143 144 | } + (instancetype)dataWithBase64EncodedString: (OFString *)string { return [[[self alloc] initWithBase64EncodedString: string] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_init { return [super init]; } - (instancetype)initWithItems: (const void *)items count: (size_t)count { return [self initWithItems: items itemSize: 1 count: count]; } - (instancetype)initWithItems: (const void *)items itemSize: (size_t)itemSize count: (size_t)count { self = [super init]; @try { if (itemSize == 0) @throw [OFInvalidArgumentException exception]; |
︙ | ︙ | |||
152 153 154 155 156 157 158 | [self release]; @throw e; } return self; } | | | | | | | | | | 152 153 154 155 156 157 158 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 | [self release]; @throw e; } return self; } - (instancetype)initWithItemsNoCopy: (const void *)items count: (size_t)count freeWhenDone: (bool)freeWhenDone { return [self initWithItemsNoCopy: items itemSize: 1 count: count freeWhenDone: freeWhenDone]; } - (instancetype)initWithItemsNoCopy: (const void *)items itemSize: (size_t)itemSize count: (size_t)count freeWhenDone: (bool)freeWhenDone { self = [super init]; @try { if (itemSize == 0) @throw [OFInvalidArgumentException exception]; _items = (unsigned char *)items; _itemSize = itemSize; _count = count; _freeWhenDone = freeWhenDone; } @catch (id e) { [self release]; @throw e; } return self; } #ifdef OF_HAVE_FILES - (instancetype)initWithContentsOfFile: (OFString *)path { @try { of_offset_t size = [[OFFileManager defaultManager] sizeOfFileAtPath: path]; char *buffer; if (sizeof(of_offset_t) > sizeof(size_t) && |
︙ | ︙ | |||
229 230 231 232 233 234 235 | } return self; } #endif #if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | } return self; } #endif #if defined(OF_HAVE_FILES) || defined(OF_HAVE_SOCKETS) - (instancetype)initWithContentsOfURL: (OFURL *)URL { void *pool; OFString *scheme; pool = objc_autoreleasePoolPush(); scheme = [URL scheme]; |
︙ | ︙ | |||
251 252 253 254 255 256 257 | objc_autoreleasePoolPop(pool); return self; } #endif | | | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | objc_autoreleasePoolPop(pool); return self; } #endif - (instancetype)initWithStringRepresentation: (OFString *)string { self = [super init]; @try { size_t count = [string cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII]; const char *cString; |
︙ | ︙ | |||
305 306 307 308 309 310 311 | [self release]; @throw e; } return self; } | | | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | [self release]; @throw e; } return self; } - (instancetype)initWithBase64EncodedString: (OFString *)string { bool mutable = [self isKindOfClass: [OFMutableData class]]; if (!mutable) { [self release]; self = [OFMutableData alloc]; } |
︙ | ︙ | |||
333 334 335 336 337 338 339 | if (!mutable) [(OFMutableData *)self makeImmutable]; return self; } | | | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | if (!mutable) [(OFMutableData *)self makeImmutable]; return self; } - (instancetype)initWithSerialization: (OFXMLElement *)element { @try { void *pool = objc_autoreleasePoolPush(); OFString *stringValue; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) |
︙ | ︙ | |||
398 399 400 401 402 403 404 | { if (_items == NULL || _count == 0) return NULL; return _items + (_count - 1) * _itemSize; } | | | | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | { if (_items == NULL || _count == 0) return NULL; return _items + (_count - 1) * _itemSize; } - (id)copy { return [self retain]; } - (id)mutableCopy { return [[OFMutableData alloc] initWithItems: _items itemSize: _itemSize count: _count]; } - (bool)isEqual: (id)object |
︙ | ︙ |