Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -56,11 +56,11 @@ ivars->cStringLength = initialized; switch (of_string_check_utf8(ivars->cString, ivars->cStringLength, &ivars->length)) { case 1: - ivars->isUTF8 = YES; + ivars->UTF8 = YES; break; case -1: free(ivars); @throw [OFInvalidEncodingException newWithClass: isa]; } Index: src/OFFile.h ================================================================== --- src/OFFile.h +++ src/OFFile.h @@ -34,11 +34,11 @@ */ @interface OFFile: OFSeekableStream { int fileDescriptor; BOOL closable; - BOOL isAtEndOfStream; + BOOL atEndOfStream; } /** * \brief Creates a new OFFile with the specified path and mode. * Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -613,33 +613,33 @@ - (BOOL)_isAtEndOfStream { if (fileDescriptor == -1) return YES; - return isAtEndOfStream; + return atEndOfStream; } - (size_t)_readNBytes: (size_t)length intoBuffer: (void*)buffer { size_t ret; - if (fileDescriptor == -1 || isAtEndOfStream) + if (fileDescriptor == -1 || atEndOfStream) @throw [OFReadFailedException newWithClass: isa stream: self requestedLength: length]; if ((ret = read(fileDescriptor, buffer, length)) == 0) - isAtEndOfStream = YES; + atEndOfStream = YES; return ret; } - (void)_writeNBytes: (size_t)length fromBuffer: (const void*)buffer { - if (fileDescriptor == -1 || isAtEndOfStream || + if (fileDescriptor == -1 || atEndOfStream || write(fileDescriptor, buffer, length) < length) @throw [OFWriteFailedException newWithClass: isa stream: self requestedLength: length]; } Index: src/OFHash.h ================================================================== --- src/OFHash.h +++ src/OFHash.h @@ -19,15 +19,15 @@ /** * \brief A base class for classes providing hash functions. */ @interface OFHash: OFObject { - BOOL isCalculated; + BOOL calculated; } #ifdef OF_HAVE_PROPERTIES -@property (readonly) BOOL isCalculated; +@property (readonly, getter=isCalculated) BOOL calculated; #endif /** * \brief Returns the digest size of the hash, in bytes. * Index: src/OFHash.m ================================================================== --- src/OFHash.m +++ src/OFHash.m @@ -46,8 +46,8 @@ selector: _cmd]; } - (BOOL)isCalculated { - return isCalculated; + return calculated; } @end Index: src/OFMD5Hash.m ================================================================== --- src/OFMD5Hash.m +++ src/OFMD5Hash.m @@ -152,11 +152,11 @@ uint32_t t; if (length == 0) return; - if (isCalculated) + if (calculated) @throw [OFHashAlreadyCalculatedException newWithClass: isa hash: self]; /* Update bitcount */ t = bits[0]; @@ -204,11 +204,11 @@ - (uint8_t*)digest { uint8_t *p; size_t count; - if (isCalculated) + if (calculated) return (uint8_t*)buffer; /* Compute number of bytes mod 64 */ count = (bits[0] >> 3) & 0x3F; @@ -242,10 +242,10 @@ in.u32[15] = bits[1]; md5_transform(buffer, in.u32); of_bswap32_vec_if_be(buffer, 4); - isCalculated = YES; + calculated = YES; return (uint8_t*)buffer; } @end Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -50,11 +50,11 @@ of_unichar_t *unicodeString; size_t unicodeLen, newCStringLength, cLen; size_t i, j, d; char *newCString; - if (!s->isUTF8) { + if (!s->UTF8) { assert(tableSize >= 1); uint8_t *p = (uint8_t*)s->cString + s->cStringLength; uint8_t t; @@ -148,11 +148,11 @@ UTF8StringLength -= 3; } switch (of_string_check_utf8(UTF8String, UTF8StringLength, &length)) { case 1: - s->isUTF8 = YES; + s->UTF8 = YES; break; case -1: @throw [OFInvalidEncodingException newWithClass: isa]; } @@ -175,11 +175,11 @@ UTF8StringLength -= 3; } switch (of_string_check_utf8(UTF8String, UTF8StringLength, &length)) { case 1: - s->isUTF8 = YES; + s->UTF8 = YES; break; case -1: @throw [OFInvalidEncodingException newWithClass: isa]; } @@ -238,12 +238,12 @@ s->cStringLength += UTF8StringLength; s->length += string->s->length; s->cString[s->cStringLength] = 0; - if (string->s->isUTF8) - s->isUTF8 = YES; + if (string->s->UTF8) + s->UTF8 = YES; } - (void)appendFormat: (OFConstantString*)format, ... { va_list arguments; @@ -294,11 +294,11 @@ s->cString[i] ^= s->cString[j]; s->cString[j] ^= s->cString[i]; s->cString[i] ^= s->cString[j]; } - if (!s->isUTF8) { + if (!s->UTF8) { madvise(s->cString, s->cStringLength, MADV_NORMAL); return; } for (i = 0; i < s->cStringLength; i++) { @@ -393,11 +393,11 @@ size_t newCStringLength; if (index > s->length) @throw [OFOutOfRangeException newWithClass: isa]; - if (s->isUTF8) + if (s->UTF8) index = of_string_index_to_position(s->cString, index, s->cStringLength); newCStringLength = s->cStringLength + [string UTF8StringLength]; s->cString = [self resizeMemory: s->cString @@ -425,11 +425,11 @@ if (end > s->length) @throw [OFOutOfRangeException newWithClass: isa]; s->length -= end - start; - if (s->isUTF8) { + if (s->UTF8) { start = of_string_index_to_position(s->cString, start, s->cStringLength); end = of_string_index_to_position(s->cString, end, s->cStringLength); } @@ -461,11 +461,11 @@ if (end > s->length) @throw [OFOutOfRangeException newWithClass: isa]; newLength = s->length - (end - start) + [replacement length]; - if (s->isUTF8) { + if (s->UTF8) { start = of_string_index_to_position(s->cString, start, s->cStringLength); end = of_string_index_to_position(s->cString, end, s->cStringLength); } Index: src/OFSHA1Hash.m ================================================================== --- src/OFSHA1Hash.m +++ src/OFSHA1Hash.m @@ -161,11 +161,11 @@ length: (size_t)length { if (length == 0) return; - if (isCalculated) + if (calculated) @throw [OFHashAlreadyCalculatedException newWithClass: isa hash: self]; sha1_update(state, &count, buffer, buffer_, length); } @@ -173,11 +173,11 @@ - (uint8_t*)digest { size_t i; char finalcount[8]; - if (isCalculated) + if (calculated) return digest; for (i = 0; i < 8; i++) /* Endian independent */ finalcount[i] = (char)((count >> ((7 - (i & 7)) * 8)) & 255); @@ -190,10 +190,10 @@ for (i = 0; i < OF_SHA1_DIGEST_SIZE; i++) digest[i] = (char)((state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255); - isCalculated = YES; + calculated = YES; return digest; } @end Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -34,15 +34,15 @@ { char *cache; char *writeBuffer; size_t cacheLength, writeBufferLength; BOOL buffersWrites; - BOOL isBlocking; + BOOL blocking; } #ifdef OF_HAVE_PROPERTIES -@property (assign, setter=setBlocking:) BOOL isBlocking; +@property (assign, getter=isBlocking) BOOL blocking; #endif /** * \brief Returns a boolean whether the end of the stream has been reached. * Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -63,11 +63,11 @@ self = [super init]; cache = NULL; writeBuffer = NULL; - isBlocking = YES; + blocking = YES; return self; } - (BOOL)_isAtEndOfStream @@ -1363,19 +1363,19 @@ return cacheLength; } - (BOOL)isBlocking { - return isBlocking; + return blocking; } - (void)setBlocking: (BOOL)enable { #ifndef _WIN32 int flags; - isBlocking = enable; + blocking = enable; if ((flags = fcntl([self fileDescriptor], F_GETFL)) == -1) @throw [OFSetOptionFailedException newWithClass: isa stream: self]; Index: src/OFStreamSocket.h ================================================================== --- src/OFStreamSocket.h +++ src/OFStreamSocket.h @@ -27,15 +27,15 @@ * \brief A class which provides functions to create and use stream sockets. */ @interface OFStreamSocket: OFStream { int sock; - BOOL isAtEndOfStream; + BOOL atEndOfStream; } /** * \brief Returns a new, autoreleased OFTCPSocket. * * \return A new, autoreleased OFTCPSocket */ + socket; @end Index: src/OFStreamSocket.m ================================================================== --- src/OFStreamSocket.m +++ src/OFStreamSocket.m @@ -64,11 +64,11 @@ return [[[self alloc] init] autorelease]; } - (BOOL)_isAtEndOfStream { - return isAtEndOfStream; + return atEndOfStream; } - (size_t)_readNBytes: (size_t)length intoBuffer: (void*)buffer { @@ -76,11 +76,11 @@ if (sock == INVALID_SOCKET) @throw [OFNotConnectedException newWithClass: isa socket: self]; - if (isAtEndOfStream) { + if (atEndOfStream) { OFReadFailedException *e; e = [OFReadFailedException newWithClass: isa stream: self requestedLength: length]; @@ -97,11 +97,11 @@ @throw [OFReadFailedException newWithClass: isa stream: self requestedLength: length]; if (ret == 0) - isAtEndOfStream = YES; + atEndOfStream = YES; return ret; } - (void)_writeNBytes: (size_t)length @@ -109,11 +109,11 @@ { if (sock == INVALID_SOCKET) @throw [OFNotConnectedException newWithClass: isa socket: self]; - if (isAtEndOfStream) { + if (atEndOfStream) { OFWriteFailedException *e; e = [OFWriteFailedException newWithClass: isa stream: self requestedLength: length]; @@ -134,11 +134,11 @@ #ifdef _WIN32 - (void)setBlocking: (BOOL)enable { u_long v = enable; - isBlocking = enable; + blocking = enable; if (ioctlsocket(sock, FIONBIO, &v) == SOCKET_ERROR) @throw [OFSetOptionFailedException newWithClass: isa stream: self]; } @@ -156,11 +156,11 @@ socket: self]; close(sock); sock = INVALID_SOCKET; - isAtEndOfStream = NO; + atEndOfStream = NO; } - (void)dealloc { if (sock != INVALID_SOCKET) Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -85,11 +85,11 @@ * than those two ivars. */ struct of_string_ivars { char *cString; size_t cStringLength; - BOOL isUTF8; + BOOL UTF8; size_t length; } *restrict s; /* * Unused in OFString, however, OFConstantString sets this to SIZE_MAX * once it allocated and initialized the struct. Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -84,20 +84,20 @@ int of_string_check_utf8(const char *cString, size_t cStringLength, size_t *length) { size_t i, tmpLength = cStringLength; - int isUTF8 = 0; + int UTF8 = 0; madvise((void*)cString, cStringLength, MADV_SEQUENTIAL); for (i = 0; i < cStringLength; i++) { /* No sign of UTF-8 here */ if (OF_LIKELY(!(cString[i] & 0x80))) continue; - isUTF8 = 1; + UTF8 = 1; /* We're missing a start byte here */ if (OF_UNLIKELY(!(cString[i] & 0x40))) { madvise((void*)cString, cStringLength, MADV_NORMAL); return -1; @@ -160,11 +160,11 @@ madvise((void*)cString, cStringLength, MADV_NORMAL); if (length != NULL) *length = tmpLength; - return isUTF8; + return UTF8; } size_t of_string_unicode_to_utf8(of_unichar_t character, char *buffer) { @@ -498,11 +498,11 @@ case 1: if (encoding == OF_STRING_ENCODING_ASCII) @throw [OFInvalidEncodingException newWithClass: isa]; - s->isUTF8 = YES; + s->UTF8 = YES; break; case -1: @throw [OFInvalidEncodingException newWithClass: isa]; } @@ -524,11 +524,11 @@ if (!(cString[i] & 0x80)) { s->cString[j++] = cString[i]; continue; } - s->isUTF8 = YES; + s->UTF8 = YES; bytes = of_string_unicode_to_utf8( (uint8_t)cString[i], buffer); if (bytes == 0) @throw [OFInvalidEncodingException @@ -573,11 +573,11 @@ if (character == 0xFFFD) @throw [OFInvalidEncodingException newWithClass: isa]; - s->isUTF8 = YES; + s->UTF8 = YES; characterBytes = of_string_unicode_to_utf8(character, buffer); if (characterBytes == 0) @throw [OFInvalidEncodingException @@ -611,11 +611,11 @@ /* * We need one call to make sure it's initialized (in case it's * a constant string). */ s->cStringLength = [string UTF8StringLength]; - s->isUTF8 = string->s->isUTF8; + s->UTF8 = string->s->UTF8; s->length = string->s->length; s->cString = [self allocMemoryWithSize: s->cStringLength + 1]; memcpy(s->cString, string->s->cString, s->cStringLength + 1); } @catch (id e) { @@ -685,27 +685,27 @@ switch (characterLen) { case 1: s->cString[j++] = buffer[0]; break; case 2: - s->isUTF8 = YES; + s->UTF8 = YES; s->cStringLength++; memcpy(s->cString + j, buffer, 2); j += 2; break; case 3: - s->isUTF8 = YES; + s->UTF8 = YES; s->cStringLength += 2; memcpy(s->cString + j, buffer, 3); j += 3; break; case 4: - s->isUTF8 = YES; + s->UTF8 = YES; s->cStringLength += 3; memcpy(s->cString + j, buffer, 4); j += 4; @@ -818,27 +818,27 @@ switch (characterLen) { case 1: s->cString[j++] = buffer[0]; break; case 2: - s->isUTF8 = YES; + s->UTF8 = YES; s->cStringLength++; memcpy(s->cString + j, buffer, 2); j += 2; break; case 3: - s->isUTF8 = YES; + s->UTF8 = YES; s->cStringLength += 2; memcpy(s->cString + j, buffer, 3); j += 3; break; case 4: - s->isUTF8 = YES; + s->UTF8 = YES; s->cStringLength += 3; memcpy(s->cString + j, buffer, 4); j += 4; @@ -902,11 +902,11 @@ @try { switch (of_string_check_utf8(s->cString, cStringLength, &s->length)) { case 1: - s->isUTF8 = YES; + s->UTF8 = YES; break; case -1: @throw [OFInvalidEncodingException newWithClass: isa]; } @@ -952,22 +952,22 @@ /* * First needs to be a call to be sure it is initialized, in * case it's a constant string. */ s->cStringLength = [firstComponent UTF8StringLength]; - s->isUTF8 = firstComponent->s->isUTF8; + s->UTF8 = firstComponent->s->UTF8; s->length = firstComponent->s->length; /* Calculate length and see if we need UTF-8 */ va_copy(argumentsCopy, arguments); while ((component = va_arg(argumentsCopy, OFString*)) != nil) { /* First needs to be a call, see above */ s->cStringLength += 1 + [component UTF8StringLength]; s->length += 1 + component->s->length; - if (component->s->isUTF8) - s->isUTF8 = YES; + if (component->s->UTF8) + s->UTF8 = YES; } s->cString = [self allocMemoryWithSize: s->cStringLength + 1]; cStringLength = [firstComponent UTF8StringLength]; @@ -1141,11 +1141,11 @@ { switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cString; case OF_STRING_ENCODING_ASCII: - if (s->isUTF8) + if (s->UTF8) @throw [OFInvalidEncodingException newWithClass: isa]; return s->cString; default: @throw [OFNotImplementedException newWithClass: isa @@ -1167,11 +1167,11 @@ { switch (encoding) { case OF_STRING_ENCODING_UTF_8: return s->cStringLength; case OF_STRING_ENCODING_ASCII: - if (s->isUTF8) + if (s->UTF8) @throw [OFInvalidEncodingException newWithClass: isa]; return s->cStringLength; default: @throw [OFNotImplementedException newWithClass: isa @@ -1249,11 +1249,11 @@ selector: _cmd]; otherCString = [otherString UTF8String]; otherCStringLength = [otherString UTF8StringLength]; - if (!s->isUTF8) { + if (!s->UTF8) { minimumCStringLength = (s->cStringLength > otherCStringLength ? otherCStringLength : s->cStringLength); if ((compare = memcasecmp(s->cString, otherCString, minimumCStringLength)) == 0) { @@ -1362,11 +1362,11 @@ of_unichar_t character; if (index >= s->length) @throw [OFOutOfRangeException newWithClass: isa]; - if (!s->isUTF8) + if (!s->UTF8) return s->cString[index]; index = of_string_index_to_position(s->cString, index, s->cStringLength); @@ -1441,11 +1441,11 @@ size_t end = range.start + range.length; if (end > s->length) @throw [OFOutOfRangeException newWithClass: isa]; - if (s->isUTF8) { + if (s->UTF8) { start = of_string_index_to_position(s->cString, start, s->cStringLength); end = of_string_index_to_position(s->cString, end, s->cStringLength); } Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -34,14 +34,18 @@ * To connect to a server, create a socket and connect it. * To create a server, create a socket, bind it and listen on it. */ @interface OFTCPSocket: OFStreamSocket { - BOOL isListening; + BOOL listening; struct sockaddr_storage *sockAddr; socklen_t sockAddrLen; } + +#ifdef OF_HAVE_PROPERTIES +@property (assign, readonly, getter=isBlocking) BOOL *listening; +#endif /** * \brief Connect the OFTCPSocket to the specified destination. * * \param host The host to connect to Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -333,11 +333,11 @@ if (listen(sock, backLog) == -1) @throw [OFListenFailedException newWithClass: isa socket: self backLog: backLog]; - isListening = YES; + listening = YES; } - (void)listen { if (sock == INVALID_SOCKET) @@ -347,11 +347,11 @@ if (listen(sock, 5) == -1) @throw [OFListenFailedException newWithClass: isa socket: self backLog: 5]; - isListening = YES; + listening = YES; } - (OFTCPSocket*)accept { OFTCPSocket *newSocket; @@ -439,18 +439,18 @@ assert(0); } - (BOOL)isListening { - return isListening; + return listening; } - (void)close { [super close]; - isListening = NO; + listening = NO; [self freeMemory: sockAddr]; sockAddr = NULL; sockAddrLen = 0; } @end