Differences From Artifact [47b9727f66]:
- File
src/OFSecureData.m
— part of check-in
[6ce0093f8d]
at
2023-04-10 19:22:32
on branch trunk
— Remove OFSerialization
While the idea sounds nice that the tag name is the class, this means the
serialization includes whether something is mutable or immutable. This means
doing as much as making something immutable changes the serialization, which
can then cause issues after being deserialized. (user: js, size: 14585) [annotate] [blame] [check-ins using] [more...]
To Artifact [a15fe6dfde]:
- File src/OFSecureData.m — part of check-in [91fa20d993] at 2023-08-07 18:20:48 on branch trunk — Make OFData a class cluster (user: js, size: 13395) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
335 336 337 338 339 340 341 | allowsSwappableMemory: (bool)allowsSwappableMemory { return [[[self alloc] initWithCount: count itemSize: itemSize allowsSwappableMemory: allowsSwappableMemory] autorelease]; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | allowsSwappableMemory: (bool)allowsSwappableMemory { return [[[self alloc] initWithCount: count itemSize: itemSize allowsSwappableMemory: allowsSwappableMemory] autorelease]; } - (instancetype)initWithCount: (size_t)count allowsSwappableMemory: (bool)allowsSwappableMemory { return [self initWithCount: count itemSize: 1 allowsSwappableMemory: allowsSwappableMemory]; |
︙ | ︙ | |||
461 462 463 464 465 466 467 | [self release]; @throw e; } return self; } | | | < < < < < < < < < < < < < < < < < | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | [self release]; @throw e; } return self; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)initWithItemSize: (size_t)itemSize { OF_INVALID_INIT_METHOD } #ifdef OF_HAVE_FILES - (instancetype)initWithContentsOfFile: (OFString *)path { |
︙ | ︙ | |||
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | freeMemory(_page, _items, _count * _itemSize); removePageIfEmpty(_page); } } #endif [super dealloc]; } - (void *)mutableItems { return _items; } - (void *)mutableItemAtIndex: (size_t)idx | > > > > > > > > > > > > > > > > > > | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | freeMemory(_page, _items, _count * _itemSize); removePageIfEmpty(_page); } } #endif if (_freeWhenDone) OFFreeMemory(_items); [super dealloc]; } - (size_t)count { return _count; } - (size_t)itemSize { return _itemSize; } - (const void *)items { return _items; } - (void *)mutableItems { return _items; } - (void *)mutableItemAtIndex: (size_t)idx |
︙ | ︙ | |||
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | return copy; } - (bool)isEqual: (id)object { OFData *otherData; unsigned char diff; if (object == self) return true; if (![object isKindOfClass: [OFData class]]) return false; otherData = object; | > > | | | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | return copy; } - (bool)isEqual: (id)object { OFData *otherData; const unsigned char *otherDataItems; unsigned char diff; if (object == self) return true; if (![object isKindOfClass: [OFData class]]) return false; otherData = object; otherDataItems = otherData.items; if (otherData.count != _count || otherData.itemSize != _itemSize) return false; diff = 0; for (size_t i = 0; i < _count * _itemSize; i++) diff |= otherDataItems[i] ^ _items[i]; return (diff == 0); } - (OFString *)description { return @"<OFSecureData>"; |
︙ | ︙ |