@@ -177,11 +177,11 @@ self = [super init]; @try { _s = &_storage; - _s->cString = of_alloc_zeroed(1, 1); + _s->cString = OFAllocZeroedMemory(1, 1); _s->freeWhenDone = true; } @catch (id e) { [self release]; @throw e; } @@ -243,11 +243,11 @@ cStringLength -= 3; } _s = &_storage; - _s->cString = of_alloc(cStringLength + 1, 1); + _s->cString = OFAllocMemory(cStringLength + 1, 1); _s->cStringLength = cStringLength; _s->freeWhenDone = true; if (encoding == OFStringEncodingUTF8 || encoding == OFStringEncodingASCII) { @@ -291,11 +291,11 @@ if (bytes == 0) @throw [OFInvalidEncodingException exception]; _s->cStringLength += bytes - 1; - _s->cString = of_realloc(_s->cString, + _s->cString = OFResizeMemory(_s->cString, _s->cStringLength + 1, 1); memcpy(_s->cString + j, buffer, bytes); j += bytes; } @@ -371,11 +371,11 @@ if (byteLength == 0) @throw [OFInvalidEncodingException exception]; _s->cStringLength += byteLength - 1; - _s->cString = of_realloc(_s->cString, + _s->cString = OFResizeMemory(_s->cString, _s->cStringLength + 1, 1); memcpy(_s->cString + j, buffer, byteLength); j += byteLength; } @@ -448,11 +448,11 @@ else _s->isUTF8 = true; _s->length = string.length; - _s->cString = of_alloc(_s->cStringLength + 1, 1); + _s->cString = OFAllocMemory(_s->cStringLength + 1, 1); memcpy(_s->cString, string.UTF8String, _s->cStringLength + 1); _s->freeWhenDone = true; } @catch (id e) { [self release]; @throw e; @@ -469,11 +469,11 @@ @try { size_t j; _s = &_storage; - _s->cString = of_alloc((length * 4) + 1, 1); + _s->cString = OFAllocMemory((length * 4) + 1, 1); _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { @@ -491,11 +491,11 @@ _s->cString[j] = '\0'; _s->cStringLength = j; @try { - _s->cString = of_realloc(_s->cString, j + 1, 1); + _s->cString = OFResizeMemory(_s->cString, j + 1, 1); } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } } @catch (id e) { [self release]; @@ -525,11 +525,11 @@ } else if (byteOrder != OFByteOrderNative) swap = true; _s = &_storage; - _s->cString = of_alloc((length * 4) + 1, 1); + _s->cString = OFAllocMemory((length * 4) + 1, 1); _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { @@ -576,11 +576,11 @@ _s->cString[j] = '\0'; _s->cStringLength = j; @try { - _s->cString = of_realloc(_s->cString, j + 1, 1); + _s->cString = OFResizeMemory(_s->cString, j + 1, 1); } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } } @catch (id e) { [self release]; @@ -610,11 +610,11 @@ } else if (byteOrder != OFByteOrderNative) swap = true; _s = &_storage; - _s->cString = of_alloc((length * 4) + 1, 1); + _s->cString = OFAllocMemory((length * 4) + 1, 1); _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { @@ -643,11 +643,11 @@ _s->cString[j] = '\0'; _s->cStringLength = j; @try { - _s->cString = of_realloc(_s->cString, j + 1, 1); + _s->cString = OFResizeMemory(_s->cString, j + 1, 1); } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } } @catch (id e) { [self release]; @@ -685,15 +685,15 @@ break; case -1: @throw [OFInvalidEncodingException exception]; } - _s->cString = of_alloc(cStringLength + 1, 1); + _s->cString = OFAllocMemory(cStringLength + 1, 1); memcpy(_s->cString, tmp, cStringLength + 1); _s->freeWhenDone = true; } @finally { - free(tmp); + OFFreeMemory(tmp); } } @catch (id e) { [self release]; @throw e; } @@ -702,11 +702,11 @@ } - (void)dealloc { if (_s != NULL && _s->freeWhenDone) - free(_s->cString); + OFFreeMemory(_s->cString); [super dealloc]; } - (size_t)getCString: (char *)cString @@ -1152,11 +1152,11 @@ return array; } - (const OFUnichar *)characters { - OFUnichar *buffer = of_alloc(_s->length, sizeof(OFUnichar)); + OFUnichar *buffer = OFAllocMemory(_s->length, sizeof(OFUnichar)); size_t i = 0, j = 0; while (i < _s->cStringLength) { OFUnichar c; ssize_t cLen; @@ -1163,11 +1163,11 @@ cLen = of_string_utf8_decode(_s->cString + i, _s->cStringLength - i, &c); if (cLen <= 0 || c > 0x10FFFF) { - free(buffer); + OFFreeMemory(buffer); @throw [OFInvalidEncodingException exception]; } buffer[j++] = c; i += cLen; @@ -1179,11 +1179,11 @@ freeWhenDone: true] items]; } - (const OFChar32 *)UTF32StringWithByteOrder: (OFByteOrder)byteOrder { - OFChar32 *buffer = of_alloc(_s->length + 1, sizeof(OFChar32)); + OFChar32 *buffer = OFAllocMemory(_s->length + 1, sizeof(OFChar32)); size_t i = 0, j = 0; while (i < _s->cStringLength) { OFChar32 c; ssize_t cLen; @@ -1190,11 +1190,11 @@ cLen = of_string_utf8_decode(_s->cString + i, _s->cStringLength - i, &c); if (cLen <= 0 || c > 0x10FFFF) { - free(buffer); + OFFreeMemory(buffer); @throw [OFInvalidEncodingException exception]; } if (byteOrder != OFByteOrderNative) buffer[j++] = OF_BSWAP32(c);