Differences From Artifact [f8e15d9a7d]:
- File
src/OFData.m
— part of check-in
[dae363ef82]
at
2018-02-16 22:25:08
on branch trunk
— Remove OF_UNAVAILABLE from two -[init] methods
These were unavailable in the immutable class, but available in the
mutable subclass. However, Clang 3.4 does not support this. (user: js, size: 14276) [annotate] [blame] [check-ins using]
To Artifact [8d40ffbf81]:
- File
src/OFData.m
— part of check-in
[81156ee75a]
at
2018-02-25 17:16:23
on branch trunk
— No self = [self init…] with self-releasing @catch
When using self = [self init…], this already releases self on an
exception, so using it inside of a @try / @catch block that releases
self would lead to a double-release. (user: js, size: 14287) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
178 179 180 181 182 183 184 185 | return self; } #ifdef OF_HAVE_FILES - (instancetype)initWithContentsOfFile: (OFString *)path { @try { | > > > > > | < | < < | | | | | | | | > > > > > > > | | | | | < < < < | 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 230 | return self; } #ifdef OF_HAVE_FILES - (instancetype)initWithContentsOfFile: (OFString *)path { char *buffer = NULL; uintmax_t size; @try { OFFile *file; size = [[[OFFileManager defaultManager] attributesOfItemAtPath: path] fileSize]; # if UINTMAX_MAX > SIZE_MAX if (size > SIZE_MAX) @throw [OFOutOfRangeException exception]; # endif if ((buffer = malloc((size_t)size)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: (size_t)size]; file = [[OFFile alloc] initWithPath: path mode: @"r"]; @try { [file readIntoBuffer: buffer exactLength: (size_t)size]; } @finally { [file release]; } } @catch (id e) { free(buffer); [self release]; @throw e; } @try { self = [self initWithItemsNoCopy: buffer count: (size_t)size freeWhenDone: true]; } @catch (id e) { free(buffer); @throw e; } return self; } #endif |
︙ | ︙ | |||
349 350 351 352 353 354 355 | [(OFMutableData *)self makeImmutable]; return self; } - (instancetype)initWithSerialization: (OFXMLElement *)element { | < | | > < < < < > > > > | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | [(OFMutableData *)self makeImmutable]; return self; } - (instancetype)initWithSerialization: (OFXMLElement *)element { void *pool = objc_autoreleasePoolPush(); OFString *stringValue; @try { if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException exception]; stringValue = [element stringValue]; } @catch (id e) { [self release]; @throw e; } self = [self initWithBase64EncodedString: stringValue]; objc_autoreleasePoolPop(pool); return self; } - (void)dealloc { if (_freeWhenDone) |
︙ | ︙ |