Index: src/Makefile ================================================================== --- src/Makefile +++ src/Makefile @@ -174,28 +174,28 @@ platform.h \ ${USE_INCLUDES_ATOMIC} SRCS += OFASPrintF.m \ OFAdjacentArray.m \ + OFAdjacentData.m \ OFAdjacentSubarray.m \ OFArchiveIRIHandler.m \ OFBase64.m \ OFBitSetCharacterSet.m \ OFBytesValue.m \ OFCRC16.m \ OFCRC32.m \ - OFConcreteData.m \ OFCountedMapTableSet.m \ OFEmbeddedIRIHandler.m \ OFHuffmanTree.m \ OFINIFileSettings.m \ OFInvertedCharacterSet.m \ OFLHADecompressingStream.m \ OFMapTableDictionary.m \ OFMapTableSet.m \ OFMutableAdjacentArray.m \ - OFMutableConcreteData.m \ + OFMutableAdjacentData.m \ OFMutableMapTableDictionary.m \ OFMutableMapTableSet.m \ OFMutableUTF8String.m \ OFNonretainedObjectValue.m \ OFPointValue.m \ ADDED src/OFAdjacentData.h Index: src/OFAdjacentData.h ================================================================== --- src/OFAdjacentData.h +++ src/OFAdjacentData.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFData.h" + +OF_ASSUME_NONNULL_BEGIN + +@interface OFAdjacentData: OFData +{ + unsigned char *_Nullable _items; + size_t _capacity, _count, _itemSize; + bool _freeWhenDone; + OFData *_Nullable _parentData; +} +@end + +OF_ASSUME_NONNULL_END ADDED src/OFAdjacentData.m Index: src/OFAdjacentData.m ================================================================== --- src/OFAdjacentData.m +++ src/OFAdjacentData.m @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#include +#include + +#import "OFAdjacentData.h" + +#import "OFInvalidArgumentException.h" +#import "OFOutOfRangeException.h" + +@implementation OFAdjacentData +- (instancetype)init +{ + return [self initWithItemSize: 1]; +} + +- (instancetype)initWithItemSize: (size_t)itemSize +{ + self = [super init]; + + @try { + if (itemSize == 0) + @throw [OFInvalidArgumentException exception]; + + _itemSize = itemSize; + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + +- (instancetype)initWithItems: (const void *)items + count: (size_t)count + itemSize: (size_t)itemSize +{ + self = [super init]; + + @try { + if (itemSize == 0) + @throw [OFInvalidArgumentException exception]; + + _items = OFAllocMemory(count, itemSize); + _capacity = _count = count; + _itemSize = itemSize; + _freeWhenDone = true; + + memcpy(_items, items, count * itemSize); + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + +- (instancetype)initWithItemsNoCopy: (void *)items + count: (size_t)count + itemSize: (size_t)itemSize + freeWhenDone: (bool)freeWhenDone +{ + self = [super init]; + + @try { + if (itemSize == 0) + @throw [OFInvalidArgumentException exception]; + + _items = (unsigned char *)items; + _capacity = _count = count; + _itemSize = itemSize; + _freeWhenDone = freeWhenDone; + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + +- (void)dealloc +{ + if (_freeWhenDone) + OFFreeMemory(_items); + + [_parentData release]; + + [super dealloc]; +} + +- (size_t)count +{ + return _count; +} + +- (size_t)itemSize +{ + return _itemSize; +} + +- (const void *)items +{ + return _items; +} + +- (OFData *)subdataWithRange: (OFRange)range +{ + OFAdjacentData *ret; + + if (range.length > SIZE_MAX - range.location || + range.location + range.length > _count) + @throw [OFOutOfRangeException exception]; + + ret = [OFAdjacentData + dataWithItemsNoCopy: _items + (range.location * _itemSize) + count: range.length + itemSize: _itemSize + freeWhenDone: false]; + ret->_parentData = [(_parentData != nil ? _parentData : self) copy]; + + return ret; +} +@end DELETED src/OFConcreteData.h Index: src/OFConcreteData.h ================================================================== --- src/OFConcreteData.h +++ src/OFConcreteData.h @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#import "OFData.h" - -OF_ASSUME_NONNULL_BEGIN - -@interface OFConcreteData: OFData -{ - unsigned char *_Nullable _items; - size_t _capacity, _count, _itemSize; - bool _freeWhenDone; - OFData *_Nullable _parentData; -} -@end - -OF_ASSUME_NONNULL_END DELETED src/OFConcreteData.m Index: src/OFConcreteData.m ================================================================== --- src/OFConcreteData.m +++ src/OFConcreteData.m @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -#include -#include - -#import "OFConcreteData.h" - -#import "OFInvalidArgumentException.h" -#import "OFOutOfRangeException.h" - -@implementation OFConcreteData -- (instancetype)init -{ - return [self initWithItemSize: 1]; -} - -- (instancetype)initWithItemSize: (size_t)itemSize -{ - self = [super init]; - - @try { - if (itemSize == 0) - @throw [OFInvalidArgumentException exception]; - - _itemSize = itemSize; - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (instancetype)initWithItems: (const void *)items - count: (size_t)count - itemSize: (size_t)itemSize -{ - self = [super init]; - - @try { - if (itemSize == 0) - @throw [OFInvalidArgumentException exception]; - - _items = OFAllocMemory(count, itemSize); - _capacity = _count = count; - _itemSize = itemSize; - _freeWhenDone = true; - - memcpy(_items, items, count * itemSize); - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (instancetype)initWithItemsNoCopy: (void *)items - count: (size_t)count - itemSize: (size_t)itemSize - freeWhenDone: (bool)freeWhenDone -{ - self = [super init]; - - @try { - if (itemSize == 0) - @throw [OFInvalidArgumentException exception]; - - _items = (unsigned char *)items; - _capacity = _count = count; - _itemSize = itemSize; - _freeWhenDone = freeWhenDone; - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (void)dealloc -{ - if (_freeWhenDone) - OFFreeMemory(_items); - - [_parentData release]; - - [super dealloc]; -} - -- (size_t)count -{ - return _count; -} - -- (size_t)itemSize -{ - return _itemSize; -} - -- (const void *)items -{ - return _items; -} - -- (OFData *)subdataWithRange: (OFRange)range -{ - OFConcreteData *ret; - - if (range.length > SIZE_MAX - range.location || - range.location + range.length > _count) - @throw [OFOutOfRangeException exception]; - - ret = [OFConcreteData - dataWithItemsNoCopy: _items + (range.location * _itemSize) - count: range.length - itemSize: _itemSize - freeWhenDone: false]; - ret->_parentData = [(_parentData != nil ? _parentData : self) copy]; - - return ret; -} -@end Index: src/OFData.m ================================================================== --- src/OFData.m +++ src/OFData.m @@ -18,12 +18,12 @@ #include #include #include #import "OFData.h" +#import "OFAdjacentData.h" #import "OFBase64.h" -#import "OFConcreteData.h" #import "OFDictionary.h" #ifdef OF_HAVE_FILES # import "OFFile.h" # import "OFFileManager.h" #endif @@ -57,73 +57,73 @@ } @implementation OFDataPlaceholder - (instancetype)init { - return (id)[[OFConcreteData alloc] init]; + return (id)[[OFAdjacentData alloc] init]; } - (instancetype)initWithItemSize: (size_t)itemSize { - return (id)[[OFConcreteData alloc] initWithItemSize: itemSize]; + return (id)[[OFAdjacentData alloc] initWithItemSize: itemSize]; } - (instancetype)initWithItems: (const void *)items count: (size_t)count { - return (id)[[OFConcreteData alloc] initWithItems: items count: count]; + return (id)[[OFAdjacentData alloc] initWithItems: items count: count]; } - (instancetype)initWithItems: (const void *)items count: (size_t)count itemSize: (size_t)itemSize { - return (id)[[OFConcreteData alloc] initWithItems: items + return (id)[[OFAdjacentData alloc] initWithItems: items count: count itemSize: itemSize]; } - (instancetype)initWithItemsNoCopy: (void *)items count: (size_t)count freeWhenDone: (bool)freeWhenDone { - return (id)[[OFConcreteData alloc] initWithItemsNoCopy: items + return (id)[[OFAdjacentData alloc] initWithItemsNoCopy: items count: count freeWhenDone: freeWhenDone]; } - (instancetype)initWithItemsNoCopy: (void *)items count: (size_t)count itemSize: (size_t)itemSize freeWhenDone: (bool)freeWhenDone { - return (id)[[OFConcreteData alloc] initWithItemsNoCopy: items + return (id)[[OFAdjacentData alloc] initWithItemsNoCopy: items count: count itemSize: itemSize freeWhenDone: freeWhenDone]; } #ifdef OF_HAVE_FILES - (instancetype)initWithContentsOfFile: (OFString *)path { - return (id)[[OFConcreteData alloc] initWithContentsOfFile: path]; + return (id)[[OFAdjacentData alloc] initWithContentsOfFile: path]; } #endif - (instancetype)initWithContentsOfIRI: (OFIRI *)IRI { - return (id)[[OFConcreteData alloc] initWithContentsOfIRI: IRI]; + return (id)[[OFAdjacentData alloc] initWithContentsOfIRI: IRI]; } - (instancetype)initWithStringRepresentation: (OFString *)string { - return (id)[[OFConcreteData alloc] + return (id)[[OFAdjacentData alloc] initWithStringRepresentation: string]; } - (instancetype)initWithBase64EncodedString: (OFString *)string { - return (id)[[OFConcreteData alloc] initWithBase64EncodedString: string]; + return (id)[[OFAdjacentData alloc] initWithBase64EncodedString: string]; } @end @implementation OFData + (void)initialize ADDED src/OFMutableAdjacentData.h Index: src/OFMutableAdjacentData.h ================================================================== --- src/OFMutableAdjacentData.h +++ src/OFMutableAdjacentData.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFMutableData.h" + +OF_ASSUME_NONNULL_BEGIN + +@interface OFMutableAdjacentData: OFMutableData +{ + unsigned char *_Nullable _items; + size_t _capacity, _count, _itemSize; + bool _freeWhenDone; + OFData *_Nullable _parentData; +} +@end + +OF_ASSUME_NONNULL_END ADDED src/OFMutableAdjacentData.m Index: src/OFMutableAdjacentData.m ================================================================== --- src/OFMutableAdjacentData.m +++ src/OFMutableAdjacentData.m @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2008-2023 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#include +#include + +#import "OFMutableAdjacentData.h" +#import "OFAdjacentData.h" + +#import "OFInvalidArgumentException.h" +#import "OFOutOfMemoryException.h" +#import "OFOutOfRangeException.h" + +@implementation OFMutableAdjacentData ++ (void)initialize +{ + if (self == [OFMutableAdjacentData class]) + [self inheritMethodsFromClass: [OFAdjacentData class]]; +} + +- (instancetype)initWithItemSize: (size_t)itemSize capacity: (size_t)capacity +{ + self = [super init]; + + @try { + if (itemSize == 0) + @throw [OFInvalidArgumentException exception]; + + _items = OFAllocMemory(capacity, itemSize); + _itemSize = itemSize; + _capacity = capacity; + _freeWhenDone = true; + } @catch (id e) { + [self release]; + @throw e; + } + + return self; +} + +- (instancetype)initWithItemsNoCopy: (void *)items + count: (size_t)count + itemSize: (size_t)itemSize + freeWhenDone: (bool)freeWhenDone +{ + self = [self initWithItems: items count: count itemSize: itemSize]; + + if (freeWhenDone) + OFFreeMemory(items); + + return self; +} + +- (void *)mutableItems +{ + return _items; +} + +- (void)addItem: (const void *)item +{ + if (SIZE_MAX - _count < 1) + @throw [OFOutOfRangeException exception]; + + if (_count + 1 > _capacity) { + _items = OFResizeMemory(_items, _count + 1, _itemSize); + _capacity = _count + 1; + } + + memcpy(_items + _count * _itemSize, item, _itemSize); + + _count++; +} + +- (void)addItems: (const void *)items count: (size_t)count +{ + if (count > SIZE_MAX - _count) + @throw [OFOutOfRangeException exception]; + + if (_count + count > _capacity) { + _items = OFResizeMemory(_items, _count + count, _itemSize); + _capacity = _count + count; + } + + memcpy(_items + _count * _itemSize, items, count * _itemSize); + _count += count; +} + +- (void)insertItems: (const void *)items + atIndex: (size_t)idx + count: (size_t)count +{ + if (count > SIZE_MAX - _count || idx > _count) + @throw [OFOutOfRangeException exception]; + + if (_count + count > _capacity) { + _items = OFResizeMemory(_items, _count + count, _itemSize); + _capacity = _count + count; + } + + memmove(_items + (idx + count) * _itemSize, _items + idx * _itemSize, + (_count - idx) * _itemSize); + memcpy(_items + idx * _itemSize, items, count * _itemSize); + + _count += count; +} + +- (void)increaseCountBy: (size_t)count +{ + if (count > SIZE_MAX - _count) + @throw [OFOutOfRangeException exception]; + + if (_count + count > _capacity) { + _items = OFResizeMemory(_items, _count + count, _itemSize); + _capacity = _count + count; + } + + memset(_items + _count * _itemSize, '\0', count * _itemSize); + _count += count; +} + +- (void)removeItemsInRange: (OFRange)range +{ + if (range.length > SIZE_MAX - range.location || + range.location + range.length > _count) + @throw [OFOutOfRangeException exception]; + + memmove(_items + range.location * _itemSize, + _items + (range.location + range.length) * _itemSize, + (_count - range.location - range.length) * _itemSize); + + _count -= range.length; + @try { + _items = OFResizeMemory(_items, _count, _itemSize); + _capacity = _count; + } @catch (OFOutOfMemoryException *e) { + /* We don't really care, as we only made it smaller */ + } +} + +- (void)removeLastItem +{ + if (_count == 0) + return; + + _count--; + @try { + _items = OFResizeMemory(_items, _count, _itemSize); + _capacity = _count; + } @catch (OFOutOfMemoryException *e) { + /* We don't care, as we only made it smaller */ + } +} + +- (void)removeAllItems +{ + OFFreeMemory(_items); + _items = NULL; + _count = 0; + _capacity = 0; +} + +- (void)makeImmutable +{ + if (_capacity != _count) { + @try { + _items = OFResizeMemory(_items, _count, _itemSize); + _capacity = _count; + } @catch (OFOutOfMemoryException *e) { + /* We don't care, as we only made it smaller */ + } + } + + object_setClass(self, [OFAdjacentData class]); +} +@end DELETED src/OFMutableConcreteData.h Index: src/OFMutableConcreteData.h ================================================================== --- src/OFMutableConcreteData.h +++ src/OFMutableConcreteData.h @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#import "OFMutableData.h" - -OF_ASSUME_NONNULL_BEGIN - -@interface OFMutableConcreteData: OFMutableData -{ - unsigned char *_Nullable _items; - size_t _capacity, _count, _itemSize; - bool _freeWhenDone; - OFData *_Nullable _parentData; -} -@end - -OF_ASSUME_NONNULL_END DELETED src/OFMutableConcreteData.m Index: src/OFMutableConcreteData.m ================================================================== --- src/OFMutableConcreteData.m +++ src/OFMutableConcreteData.m @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2008-2023 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -#include -#include - -#import "OFMutableConcreteData.h" -#import "OFConcreteData.h" - -#import "OFInvalidArgumentException.h" -#import "OFOutOfMemoryException.h" -#import "OFOutOfRangeException.h" - -@implementation OFMutableConcreteData -+ (void)initialize -{ - if (self == [OFMutableConcreteData class]) - [self inheritMethodsFromClass: [OFConcreteData class]]; -} - -- (instancetype)initWithItemSize: (size_t)itemSize capacity: (size_t)capacity -{ - self = [super init]; - - @try { - if (itemSize == 0) - @throw [OFInvalidArgumentException exception]; - - _items = OFAllocMemory(capacity, itemSize); - _itemSize = itemSize; - _capacity = capacity; - _freeWhenDone = true; - } @catch (id e) { - [self release]; - @throw e; - } - - return self; -} - -- (instancetype)initWithItemsNoCopy: (void *)items - count: (size_t)count - itemSize: (size_t)itemSize - freeWhenDone: (bool)freeWhenDone -{ - self = [self initWithItems: items count: count itemSize: itemSize]; - - if (freeWhenDone) - OFFreeMemory(items); - - return self; -} - -- (void *)mutableItems -{ - return _items; -} - -- (void)addItem: (const void *)item -{ - if (SIZE_MAX - _count < 1) - @throw [OFOutOfRangeException exception]; - - if (_count + 1 > _capacity) { - _items = OFResizeMemory(_items, _count + 1, _itemSize); - _capacity = _count + 1; - } - - memcpy(_items + _count * _itemSize, item, _itemSize); - - _count++; -} - -- (void)addItems: (const void *)items count: (size_t)count -{ - if (count > SIZE_MAX - _count) - @throw [OFOutOfRangeException exception]; - - if (_count + count > _capacity) { - _items = OFResizeMemory(_items, _count + count, _itemSize); - _capacity = _count + count; - } - - memcpy(_items + _count * _itemSize, items, count * _itemSize); - _count += count; -} - -- (void)insertItems: (const void *)items - atIndex: (size_t)idx - count: (size_t)count -{ - if (count > SIZE_MAX - _count || idx > _count) - @throw [OFOutOfRangeException exception]; - - if (_count + count > _capacity) { - _items = OFResizeMemory(_items, _count + count, _itemSize); - _capacity = _count + count; - } - - memmove(_items + (idx + count) * _itemSize, _items + idx * _itemSize, - (_count - idx) * _itemSize); - memcpy(_items + idx * _itemSize, items, count * _itemSize); - - _count += count; -} - -- (void)increaseCountBy: (size_t)count -{ - if (count > SIZE_MAX - _count) - @throw [OFOutOfRangeException exception]; - - if (_count + count > _capacity) { - _items = OFResizeMemory(_items, _count + count, _itemSize); - _capacity = _count + count; - } - - memset(_items + _count * _itemSize, '\0', count * _itemSize); - _count += count; -} - -- (void)removeItemsInRange: (OFRange)range -{ - if (range.length > SIZE_MAX - range.location || - range.location + range.length > _count) - @throw [OFOutOfRangeException exception]; - - memmove(_items + range.location * _itemSize, - _items + (range.location + range.length) * _itemSize, - (_count - range.location - range.length) * _itemSize); - - _count -= range.length; - @try { - _items = OFResizeMemory(_items, _count, _itemSize); - _capacity = _count; - } @catch (OFOutOfMemoryException *e) { - /* We don't really care, as we only made it smaller */ - } -} - -- (void)removeLastItem -{ - if (_count == 0) - return; - - _count--; - @try { - _items = OFResizeMemory(_items, _count, _itemSize); - _capacity = _count; - } @catch (OFOutOfMemoryException *e) { - /* We don't care, as we only made it smaller */ - } -} - -- (void)removeAllItems -{ - OFFreeMemory(_items); - _items = NULL; - _count = 0; - _capacity = 0; -} - -- (void)makeImmutable -{ - if (_capacity != _count) { - @try { - _items = OFResizeMemory(_items, _count, _itemSize); - _capacity = _count; - } @catch (OFOutOfMemoryException *e) { - /* We don't care, as we only made it smaller */ - } - } - - object_setClass(self, [OFConcreteData class]); -} -@end Index: src/OFMutableData.m ================================================================== --- src/OFMutableData.m +++ src/OFMutableData.m @@ -18,11 +18,11 @@ #include #include #include #import "OFMutableData.h" -#import "OFMutableConcreteData.h" +#import "OFMutableAdjacentData.h" #import "OFOutOfRangeException.h" static struct { Class isa; @@ -32,38 +32,38 @@ @end @implementation OFMutableDataPlaceholder - (instancetype)init { - return (id)[[OFMutableConcreteData alloc] init]; + return (id)[[OFMutableAdjacentData alloc] init]; } - (instancetype)initWithItemSize: (size_t)itemSize { - return (id)[[OFMutableConcreteData alloc] initWithItemSize: itemSize]; + return (id)[[OFMutableAdjacentData alloc] initWithItemSize: itemSize]; } - (instancetype)initWithItems: (const void *)items count: (size_t)count { - return (id)[[OFMutableConcreteData alloc] initWithItems: items + return (id)[[OFMutableAdjacentData alloc] initWithItems: items count: count]; } - (instancetype)initWithItems: (const void *)items count: (size_t)count itemSize: (size_t)itemSize { - return (id)[[OFMutableConcreteData alloc] initWithItems: items + return (id)[[OFMutableAdjacentData alloc] initWithItems: items count: count itemSize: itemSize]; } - (instancetype)initWithItemsNoCopy: (void *)items count: (size_t)count freeWhenDone: (bool)freeWhenDone { - return (id)[[OFMutableConcreteData alloc] + return (id)[[OFMutableAdjacentData alloc] initWithItemsNoCopy: items count: count freeWhenDone: freeWhenDone]; } @@ -70,49 +70,49 @@ - (instancetype)initWithItemsNoCopy: (void *)items count: (size_t)count itemSize: (size_t)itemSize freeWhenDone: (bool)freeWhenDone { - return (id)[[OFMutableConcreteData alloc] + return (id)[[OFMutableAdjacentData alloc] initWithItemsNoCopy: items count: count itemSize: itemSize freeWhenDone: freeWhenDone]; } #ifdef OF_HAVE_FILES - (instancetype)initWithContentsOfFile: (OFString *)path { - return (id)[[OFMutableConcreteData alloc] initWithContentsOfFile: path]; + return (id)[[OFMutableAdjacentData alloc] initWithContentsOfFile: path]; } #endif - (instancetype)initWithContentsOfIRI: (OFIRI *)IRI { - return (id)[[OFMutableConcreteData alloc] initWithContentsOfIRI: IRI]; + return (id)[[OFMutableAdjacentData alloc] initWithContentsOfIRI: IRI]; } - (instancetype)initWithStringRepresentation: (OFString *)string { - return (id)[[OFMutableConcreteData alloc] + return (id)[[OFMutableAdjacentData alloc] initWithStringRepresentation: string]; } - (instancetype)initWithBase64EncodedString: (OFString *)string { - return (id)[[OFMutableConcreteData alloc] + return (id)[[OFMutableAdjacentData alloc] initWithBase64EncodedString: string]; } - (instancetype)initWithCapacity: (size_t)capacity { - return (id)[[OFMutableConcreteData alloc] initWithCapacity: capacity]; + return (id)[[OFMutableAdjacentData alloc] initWithCapacity: capacity]; } - (instancetype)initWithItemSize: (size_t)itemSize capacity: (size_t)capacity { - return (id)[[OFMutableConcreteData alloc] initWithItemSize: itemSize + return (id)[[OFMutableAdjacentData alloc] initWithItemSize: itemSize capacity: capacity]; } @end @implementation OFMutableData