Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -31,11 +31,11 @@ */ + newWithItemSize: (size_t)is; /** * Initializes an already allocated OFArray whose items all have the same size. - * + * * \param is The size of each element in the OFArray * \return An initialized OFArray */ - initWithItemSize: (size_t)is; @@ -103,11 +103,11 @@ } /** * Initializes an already allocated OFBigArray whose items all have the same * size. - * + * * \param is The size of each element in the OFBigArray * \return An initialized OFBigArray */ - initWithItemSize: (size_t)is; Index: src/OFExceptions.h ================================================================== --- src/OFExceptions.h +++ src/OFExceptions.h @@ -122,11 +122,11 @@ */ - (void*)pointer; @end /** - * An OFException indicating the given value is out of range. + * An OFException indicating the given value is out of range. */ @interface OFOutOfRangeException: OFException {} /** * \return An error message for the exception as a C String */ @@ -310,11 +310,11 @@ - (const char*)cString; @end /** * An OFException indicating an attempt to connect or bind an already connected - * or bound socket + * or bound socket. */ @interface OFAlreadyConnectedException: OFException {} /** * \return An error message for the exception as a C string. */ Index: src/OFExceptions.m ================================================================== --- src/OFExceptions.m +++ src/OFExceptions.m @@ -144,11 +144,11 @@ @implementation OFInvalidEncodingException - (const char*)cString { if (string != NULL) return string; - + asprintf(&string, "The encoding is invalid for object of classs %s!", [object name]); return string; } Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -158,11 +158,11 @@ if ((ret = fwrite(buf, size, nitems, fp)) == 0 && size != 0 && nitems != 0) @throw [OFWriteFailedException newWithObject: self andSize: size andNItems: nitems]; - + return ret; } - (size_t)writeNBytes: (size_t)size fromBuffer: (const uint8_t*)buf Index: src/OFHashes.h ================================================================== --- src/OFHashes.h +++ src/OFHashes.h @@ -28,11 +28,11 @@ - init; /** * Adds a buffer to the hash to be calculated. - * + * * \param buf The buffer which should be included into calculation. * \param size The size of the buffer */ - updateWithBuffer: (const uint8_t*)buf ofSize: (size_t)size; @@ -59,11 +59,11 @@ - init; /** * Adds a buffer to the hash to be calculated. - * + * * \param buf The buffer which should be included into calculation. * \param size The size of the buffer */ - updateWithBuffer: (const uint8_t*)buf ofSize: (size_t)size; Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -55,11 +55,11 @@ memchunks_size = __memchunks_size + 1; if (SIZE_MAX - __memchunks_size == 0 || memchunks_size > SIZE_MAX / sizeof(void*)) @throw [OFOutOfRangeException newWithObject: self]; - + if ((memchunks = realloc(__memchunks, memchunks_size * sizeof(void*))) == NULL) @throw [OFNoMemException newWithObject: self andSize: memchunks_size]; @@ -106,11 +106,11 @@ while (iter-- > __memchunks) { if (OF_UNLIKELY(*iter == ptr)) { if (OF_UNLIKELY((ptr = realloc(ptr, size)) == NULL)) @throw [OFNoMemException newWithObject: self andSize: size]; - + *iter = ptr; return ptr; } } @@ -126,11 +126,11 @@ size_t memsize; if (ptr == NULL) return [self getMemForNItems: nitems ofSize: size]; - + if (nitems == 0 || size == 0) { [self freeMem: ptr]; return NULL; } Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -21,18 +21,18 @@ BOOL is_utf8; } /** * Creates a new OFString. - * + * * \return An initialized OFString */ + new; /** * Creates a new OFString from a C string. - * + * * \param str A C string to initialize the OFString with * \return A new OFString */ + newFromCString: (const char*)str; @@ -43,11 +43,11 @@ */ - init; /** * Initializes an already allocated OFString from a C string. - * + * * \param str A C string to initialize the OFString with * \return An initialized OFString */ - initFromCString: (const char*)str; @@ -61,11 +61,11 @@ */ - (size_t)length; /** * Clones the OFString, creating a new one. - * + * * \return A copy of the OFString */ - (OFString*)clone; /** Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -175,11 +175,11 @@ - appendCString: (const char*)str { char *newstr; size_t newlen, strlength; - if (string == NULL) + if (string == NULL) return [self setTo: [OFString newFromCString: str]]; strlength = strlen(str); switch (check_utf8(str, strlength)) { @@ -298,11 +298,11 @@ size_t i = length; if (is_utf8) @throw [OFInvalidEncodingException newWithObject: self]; - while (i--) + while (i--) string[i] = toupper(string[i]); return self; } @@ -311,11 +311,11 @@ size_t i = length; if (is_utf8) @throw [OFInvalidEncodingException newWithObject: self]; - while (i--) + while (i--) string[i] = tolower(string[i]); return self; } @end Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -92,11 +92,11 @@ continue; } break; } - + freeaddrinfo(res0); if (sock < 0) @throw [OFConnectionFailedException newWithObject: self andHost: host @@ -205,11 +205,11 @@ - (size_t)readNBytes: (size_t)size intoBuffer: (uint8_t*)buf { ssize_t ret; - if (sock < 0) + if (sock < 0) @throw [OFNotConnectedException newWithObject: self]; if ((ret = recv(sock, buf, size, 0)) < 0) @throw [OFReadFailedException newWithObject: self andSize: size]; @@ -220,11 +220,11 @@ - (uint8_t*)readNBytes: (size_t)size { uint8_t *ret; - if (sock < 0) + if (sock < 0) @throw [OFNotConnectedException newWithObject: self]; ret = [self getMemWithSize: size]; @try { @@ -241,11 +241,11 @@ - (size_t)writeNBytes: (size_t)size fromBuffer: (const uint8_t*)buf { ssize_t ret; - if (sock < 0) + if (sock < 0) @throw [OFNotConnectedException newWithObject: self]; if ((ret = send(sock, buf, size, 0)) < 0) @throw [OFWriteFailedException newWithObject: self andSize: size]; @@ -254,11 +254,11 @@ return ret; } - (size_t)writeCString: (const char*)str { - if (sock < 0) + if (sock < 0) @throw [OFNotConnectedException newWithObject: self]; return [self writeNBytes: strlen(str) fromBuffer: (const uint8_t*)str]; } @@ -290,11 +290,11 @@ return self; } - close { - if (sock < 0) + if (sock < 0) @throw [OFNotConnectedException newWithObject: self]; sock = -1; if (saddr != NULL) Index: src/OFXMLFactory.m ================================================================== --- src/OFXMLFactory.m +++ src/OFXMLFactory.m @@ -164,11 +164,11 @@ */ free(xml); return NULL; } - if (OF_UNLIKELY(!xf_resize_chars(&xml, &len, 1 + strlen(arg) + + if (OF_UNLIKELY(!xf_resize_chars(&xml, &len, 1 + strlen(arg) + 2 + strlen(esc_val) + 1))) { free(esc_val); @throw [OFNoMemException newWithObject: nil andSize: len + 1 + strlen(arg) + 2 + Index: tests/OFList/OFList.m ================================================================== --- tests/OFList/OFList.m +++ tests/OFList/OFList.m @@ -40,11 +40,11 @@ if (cond) \ SUCCESS \ else \ FAIL \ i++; - + const char *strings[] = { "First String Object", "Second String Object", "Third String Object" }; @@ -55,15 +55,15 @@ size_t i; OFList *list; OFListObject *iter; list = [OFList new]; - + [list addNew: [OFString newFromCString: strings[0]]]; [list addNew: [OFString newFromCString: strings[1]]]; [list addNew: [OFString newFromCString: strings[2]]]; - + for (iter = [list first], i = 0; iter != nil; iter = [iter next], i++) if (!strcmp([[iter data] cString], strings[i])) SUCCESS else FAIL @@ -70,10 +70,10 @@ CHECK(!strcmp([[[list first] data] cString], strings[0])) CHECK(!strcmp([[[list last] data] cString], strings[2])) puts(""); - + [list freeIncludingData]; return 0; } Index: tests/OFObject/OFObject.m ================================================================== --- tests/OFObject/OFObject.m +++ tests/OFObject/OFObject.m @@ -73,11 +73,11 @@ puts("Now trying to free them again..."); CATCH_EXCEPTION([obj freeMem: p], OFMemNotPartOfObjException) CATCH_EXCEPTION([obj freeMem: q], OFMemNotPartOfObjException) CATCH_EXCEPTION([obj freeMem: r], OFMemNotPartOfObjException) puts("Got all 3!"); - + puts("Trying to allocate more memory than possible..."); CATCH_EXCEPTION(p = [obj getMemWithSize: SIZE_MAX], OFNoMemException) puts("Allocating 1 byte..."); p = [obj getMemWithSize: 1]; @@ -94,10 +94,10 @@ puts("Trying to resize memory that is not part of object..."); CATCH_EXCEPTION(p = [obj resizeMem: (void*)1 toSize: 1024], OFMemNotPartOfObjException) - + /* TODO: Test if freeing object frees all memory */ return 0; } Index: tests/OFTCPSocket/OFTCPSocket.m ================================================================== --- tests/OFTCPSocket/OFTCPSocket.m +++ tests/OFTCPSocket/OFTCPSocket.m @@ -68,11 +68,11 @@ return 1; } #ifdef HAVE_IPV6 memset(buf, 0, 7); - + [accepted free]; [client close]; [server close]; puts("== IPv6 ==");