Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -93,16 +93,16 @@ [delegate applicationWillTerminate]; [delegate release]; } -#define SIGNAL_HANDLER(sig) \ +#define SIGNAL_HANDLER(signal) \ static void \ - handle##sig(int signal) \ + handle##signal(int sig) \ { \ - app->_##sig##Handler(app->_delegate, \ - @selector(applicationDidReceive##sig)); \ + app->_##signal##Handler(app->_delegate, \ + @selector(applicationDidReceive##signal)); \ } SIGNAL_HANDLER(SIGINT) #ifdef SIGHUP SIGNAL_HANDLER(SIGHUP) #endif Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -261,18 +261,18 @@ - mutableCopy { return [[OFMutableArray alloc] initWithArray: self]; } -- (id)objectAtIndex: (size_t)index +- (id)objectAtIndex: (size_t)idx { OF_UNRECOGNIZED_SELECTOR } -- (id)objectAtIndexedSubscript: (size_t)index +- (id)objectAtIndexedSubscript: (size_t)idx { - return [self objectAtIndex: index]; + return [self objectAtIndex: idx]; } - (id)valueForKey: (OFString *)key { id ret; @@ -857,13 +857,13 @@ size_t count = [self count]; id *tmp = [self allocMemoryWithSize: sizeof(id) count: count]; @try { - [self enumerateObjectsUsingBlock: ^ (id object, size_t index, + [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { - tmp[index] = block(object, index); + tmp[idx] = block(object, idx); }]; ret = [OFArray arrayWithObjects: tmp count: count]; } @finally { @@ -881,13 +881,13 @@ count: count]; @try { __block size_t i = 0; - [self enumerateObjectsUsingBlock: ^ (id object, size_t index, + [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { - if (block(object, index)) + if (block(object, idx)) tmp[i++] = object; }]; ret = [OFArray arrayWithObjects: tmp count: i]; @@ -906,15 +906,15 @@ if (count == 0) return nil; if (count == 1) return [[[self firstObject] retain] autorelease]; - [self enumerateObjectsUsingBlock: ^ (id object, size_t index, + [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { id new; - if (index == 0) { + if (idx == 0) { current = [object retain]; return; } @try { Index: src/OFArray_adjacent.m ================================================================== --- src/OFArray_adjacent.m +++ src/OFArray_adjacent.m @@ -199,18 +199,18 @@ - (id const *)objects { return [_array items]; } -- (id)objectAtIndex: (size_t)index +- (id)objectAtIndex: (size_t)idx { - return *((id *)[_array itemAtIndex: index]); + return *((id *)[_array itemAtIndex: idx]); } -- (id)objectAtIndexedSubscript: (size_t)index +- (id)objectAtIndexedSubscript: (size_t)idx { - return *((id *)[_array itemAtIndex: index]); + return *((id *)[_array itemAtIndex: idx]); } - (void)getObjects: (id *)buffer inRange: (of_range_t)range { Index: src/OFArray_subarray.m ================================================================== --- src/OFArray_subarray.m +++ src/OFArray_subarray.m @@ -55,16 +55,16 @@ - (size_t)count { return _range.length; } -- (id)objectAtIndex: (size_t)index +- (id)objectAtIndex: (size_t)idx { - if (index >= _range.length) + if (idx >= _range.length) @throw [OFOutOfRangeException exception]; - return [_array objectAtIndex: index + _range.location]; + return [_array objectAtIndex: idx + _range.location]; } - (void)getObjects: (id *)buffer inRange: (of_range_t)range { @@ -78,36 +78,36 @@ inRange: range]; } - (size_t)indexOfObject: (id)object { - size_t index = [_array indexOfObject: object]; + size_t idx = [_array indexOfObject: object]; - if (index < _range.location) + if (idx < _range.location) return OF_NOT_FOUND; - index -= _range.location; + idx -= _range.location; - if (index >= _range.length) + if (idx >= _range.length) return OF_NOT_FOUND; - return index; + return idx; } - (size_t)indexOfObjectIdenticalTo: (id)object { - size_t index = [_array indexOfObjectIdenticalTo: object]; + size_t idx = [_array indexOfObjectIdenticalTo: object]; - if (index < _range.location) + if (idx < _range.location) return OF_NOT_FOUND; - index -= _range.location; + idx -= _range.location; - if (index >= _range.length) + if (idx >= _range.length) return OF_NOT_FOUND; - return index; + return idx; } - (OFArray *)objectsInRange: (of_range_t)range { if (range.length > SIZE_MAX - range.location || Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -326,15 +326,15 @@ [self finishInitialization]; return [self caseInsensitiveCompare: otherString]; } -- (of_unichar_t)characterAtIndex: (size_t)index +- (of_unichar_t)characterAtIndex: (size_t)idx { [self finishInitialization]; - return [self characterAtIndex: index]; + return [self characterAtIndex: idx]; } - (void)getCharacters: (of_unichar_t *)buffer inRange: (of_range_t)range { Index: src/OFData.m ================================================================== --- src/OFData.m +++ src/OFData.m @@ -453,16 +453,16 @@ - (const void *)items { return _items; } -- (const void *)itemAtIndex: (size_t)index +- (const void *)itemAtIndex: (size_t)idx { - if (index >= _count) + if (idx >= _count) @throw [OFOutOfRangeException exception]; - return _items + index * _itemSize; + return _items + idx * _itemSize; } - (const void *)firstItem { if (_items == NULL || _count == 0) Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -70,21 +70,21 @@ size_t _toRead; } @property (nonatomic, setter=of_setKeepAlive:) bool of_keepAlive; -- initWithSocket: (OFTCPSocket *)socket; +- initWithSocket: (OFTCPSocket *)sock; @end @implementation OFHTTPClientResponse @synthesize of_keepAlive = _keepAlive; -- initWithSocket: (OFTCPSocket *)socket +- initWithSocket: (OFTCPSocket *)sock { self = [super init]; - _socket = [socket retain]; + _socket = [sock retain]; return self; } - (void)dealloc @@ -286,34 +286,33 @@ } - (OFTCPSocket *)of_closeAndCreateSocketForRequest: (OFHTTPRequest *)request { OFURL *URL = [request URL]; - OFTCPSocket *socket; + OFTCPSocket *sock; [self close]; if ([[URL scheme] isEqual: @"https"]) { if (of_tls_socket_class == Nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; - socket = [[[of_tls_socket_class alloc] init] - autorelease]; + sock = [[[of_tls_socket_class alloc] init] autorelease]; } else - socket = [OFTCPSocket socket]; + sock = [OFTCPSocket socket]; if ([_delegate respondsToSelector: @selector(client:didCreateSocket:request:)]) [_delegate client: self - didCreateSocket: socket + didCreateSocket: sock request: request]; - [socket connectToHost: [URL host] - port: [URL port]]; + [sock connectToHost: [URL host] + port: [URL port]]; - return socket; + return sock; } - (OFHTTPResponse *)performRequest: (OFHTTPRequest *)request redirects: (size_t)redirects { @@ -324,11 +323,11 @@ OFString *path; OFMutableString *requestString; OFString *user, *password; OFMutableDictionary OF_GENERIC(OFString *, OFString *) *headers; OFData *body = [request body]; - OFTCPSocket *socket; + OFTCPSocket *sock; OFHTTPClientResponse *response; OFString *line, *version, *redirect, *connectionHeader; bool keepAlive; OFMutableDictionary OF_GENERIC(OFString *, OFString *) *serverHeaders; OFEnumerator *keyEnumerator, *objectEnumerator; @@ -345,11 +344,11 @@ /* * Set _socket to nil, so that in case of an error it won't be * reused. If everything is successful, we set _socket again * at the end. */ - socket = [_socket autorelease]; + sock = [_socket autorelease]; _socket = nil; [_lastURL release]; _lastURL = nil; @@ -369,11 +368,11 @@ } @finally { [_lastResponse release]; _lastResponse = nil; } } else - socket = [self of_closeAndCreateSocketForRequest: request]; + sock = [self of_closeAndCreateSocketForRequest: request]; /* * As a work around for a bug with split packets in lighttpd when using * HTTPS, we construct the complete request in a buffer string and then * send it all at once. @@ -470,26 +469,26 @@ [requestString appendFormat: @"%@: %@\r\n", key, object]; [requestString appendString: @"\r\n"]; @try { - [socket writeString: requestString]; + [sock writeString: requestString]; } @catch (OFWriteFailedException *e) { if ([e errNo] != ECONNRESET && [e errNo] != EPIPE) @throw e; /* Reconnect in case a keep-alive connection timed out */ - socket = [self of_closeAndCreateSocketForRequest: request]; - [socket writeString: requestString]; + sock = [self of_closeAndCreateSocketForRequest: request]; + [sock writeString: requestString]; } if (body != nil) - [socket writeBuffer: [body items] - length: [body count] * [body itemSize]]; + [sock writeBuffer: [body items] + length: [body count] * [body itemSize]]; @try { - line = [socket readLine]; + line = [sock readLine]; } @catch (OFInvalidEncodingException *e) { @throw [OFInvalidServerReplyException exception]; } /* @@ -496,20 +495,19 @@ * It's possible that the write succeeds on a connection that is * keep-alive, but the connection has already been closed by the remote * end due to a timeout. In this case, we need to reconnect. */ if (line == nil) { - socket = [self of_closeAndCreateSocketForRequest: request]; - [socket writeString: requestString]; + sock = [self of_closeAndCreateSocketForRequest: request]; + [sock writeString: requestString]; if (body != nil) - [socket writeBuffer: [body items] - length: [body count] * - [body itemSize]]; + [sock writeBuffer: [body items] + length: [body count] * [body itemSize]]; @try { - line = [socket readLine]; + line = [sock readLine]; } @catch (OFInvalidEncodingException *e) { @throw [OFInvalidServerReplyException exception]; } } @@ -525,16 +523,16 @@ status = (int)[[line substringWithRange: of_range(9, 3)] decimalValue]; serverHeaders = [OFMutableDictionary dictionary]; for (;;) { - OFString *key, *value, *old; + OFString *value, *old; const char *lineC, *tmp; char *keyC; @try { - line = [socket readLine]; + line = [sock readLine]; } @catch (OFInvalidEncodingException *e) { @throw [OFInvalidServerReplyException exception]; } if (line == nil) @@ -585,11 +583,11 @@ [_delegate client: self didReceiveHeaders: serverHeaders statusCode: status request: request]; - response = [[[OFHTTPClientResponse alloc] initWithSocket: socket] + response = [[[OFHTTPClientResponse alloc] initWithSocket: sock] autorelease]; [response setProtocolVersionFromString: version]; [response setStatusCode: status]; [response setHeaders: serverHeaders]; @@ -609,11 +607,11 @@ } if (keepAlive) { [response of_setKeepAlive: true]; - _socket = [socket retain]; + _socket = [sock retain]; _lastURL = [URL copy]; _lastWasHEAD = (method == OF_HTTP_REQUEST_METHOD_HEAD); _lastResponse = [response retain]; } @@ -669,13 +667,10 @@ * 303 means the request should be converted to a GET * request before redirection. This also means stripping * the entity of the request. */ if (status == 303) { - OFEnumerator *keyEnumerator, *objectEnumerator; - id key, object; - keyEnumerator = [headers keyEnumerator]; objectEnumerator = [headers objectEnumerator]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -45,11 +45,11 @@ * FIXME: Key normalization replaces headers like "DNT" with "Dnt". * FIXME: Errors are not reported to the user. */ @interface OFHTTPServer () -- (bool)of_socket: (OFTCPSocket *)socket +- (bool)of_socket: (OFTCPSocket *)sock didAcceptSocket: (OFTCPSocket *)clientSocket exception: (OFException *)exception; @end static const char * @@ -177,24 +177,24 @@ OFHTTPServer *_server; OFHTTPRequest *_request; bool _chunked, _headersSent; } -- initWithSocket: (OFTCPSocket *)socket +- initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server request: (OFHTTPRequest *)request; @end @implementation OFHTTPServerResponse -- initWithSocket: (OFTCPSocket *)socket +- initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server request: (OFHTTPRequest *)request { self = [super init]; _statusCode = 500; - _socket = [socket retain]; + _socket = [sock retain]; _server = [server retain]; _request = [request retain]; return self; } @@ -336,37 +336,37 @@ OFMutableDictionary *_headers; size_t _contentLength; OFMutableData *_body; } -- initWithSocket: (OFTCPSocket *)socket +- initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server; -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadLine: (OFString *)line exception: (OFException *)exception; - (bool)parseProlog: (OFString *)line; - (bool)parseHeaders: (OFString *)line; -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadIntoBuffer: (char *)buffer length: (size_t)length exception: (OFException *)exception; - (bool)sendErrorAndClose: (short)statusCode; - (void)createResponse; @end @implementation OFHTTPServer_Connection -- initWithSocket: (OFTCPSocket *)socket +- initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server { self = [super init]; @try { - _socket = [socket retain]; + _socket = [sock retain]; _server = [server retain]; _timer = [[OFTimer scheduledTimerWithTimeInterval: 10 - target: socket + target: _socket selector: @selector( cancelAsyncRequests) repeats: false] retain]; _state = AWAITING_PROLOG; } @catch (id e) { @@ -391,11 +391,11 @@ [_body release]; [super dealloc]; } -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadLine: (OFString *)line exception: (OFException *)exception { if (line == nil || exception != nil) return false; @@ -567,16 +567,16 @@ } return true; } -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadIntoBuffer: (char *)buffer length: (size_t)length exception: (OFException *)exception { - if ([socket isAtEndOfStream] || exception != nil) + if ([sock isAtEndOfStream] || exception != nil) return false; [_body addItems: buffer count: length]; @@ -731,11 +731,11 @@ [_listeningSocket cancelAsyncRequests]; [_listeningSocket release]; _listeningSocket = nil; } -- (bool)of_socket: (OFTCPSocket *)socket +- (bool)of_socket: (OFTCPSocket *)sock didAcceptSocket: (OFTCPSocket *)clientSocket exception: (OFException *)exception { OFHTTPServer_Connection *connection; Index: src/OFInflateStream.m ================================================================== --- src/OFInflateStream.m +++ src/OFInflateStream.m @@ -684,20 +684,20 @@ if OF_UNLIKELY (_slidingWindow == NULL) @throw [OFInvalidFormatException exception]; for (j = 0; j < CTX.length; j++) { - uint16_t index; + uint16_t idx; if OF_UNLIKELY (length == 0) { CTX.length -= j; return bytesWritten; } - index = (_slidingWindowIndex - + idx = (_slidingWindowIndex - CTX.distance) & _slidingWindowMask; - value = _slidingWindow[index]; + value = _slidingWindow[idx]; buffer[bytesWritten++] = value; length--; _slidingWindow[_slidingWindowIndex] = Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -208,35 +208,35 @@ [self insertObjectsFromArray: array atIndex: [self count]]; } - (void)insertObject: (id)object - atIndex: (size_t)index + atIndex: (size_t)idx { OF_UNRECOGNIZED_SELECTOR } - (void)insertObjectsFromArray: (OFArray *)array - atIndex: (size_t)index + atIndex: (size_t)idx { size_t i = 0; for (id object in array) [self insertObject: object - atIndex: index + i++]; + atIndex: idx + i++]; } -- (void)replaceObjectAtIndex: (size_t)index +- (void)replaceObjectAtIndex: (size_t)idx withObject: (id)object { OF_UNRECOGNIZED_SELECTOR } - (void)setObject: (id)object - atIndexedSubscript: (size_t)index + atIndexedSubscript: (size_t)idx { - [self replaceObjectAtIndex: index + [self replaceObjectAtIndex: idx withObject: object]; } - (void)replaceObject: (id)oldObject withObject: (id)newObject @@ -275,11 +275,11 @@ return; } } } -- (void)removeObjectAtIndex: (size_t)index +- (void)removeObjectAtIndex: (size_t)idx { OF_UNRECOGNIZED_SELECTOR } - (void)removeObject: (id)object @@ -340,32 +340,32 @@ } #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block { - [self enumerateObjectsUsingBlock: ^ (id object, size_t index, + [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { - id new = block(object, index); + id new = block(object, idx); if (new != object) - [self replaceObjectAtIndex: index + [self replaceObjectAtIndex: idx withObject: new]; }]; } #endif -- (void)exchangeObjectAtIndex: (size_t)index1 - withObjectAtIndex: (size_t)index2 +- (void)exchangeObjectAtIndex: (size_t)idx1 + withObjectAtIndex: (size_t)idx2 { - id object1 = [self objectAtIndex: index1]; - id object2 = [self objectAtIndex: index2]; + id object1 = [self objectAtIndex: idx1]; + id object2 = [self objectAtIndex: idx2]; [object1 retain]; @try { - [self replaceObjectAtIndex: index1 + [self replaceObjectAtIndex: idx1 withObject: object2]; - [self replaceObjectAtIndex: index2 + [self replaceObjectAtIndex: idx2 withObject: object1]; } @finally { [object1 release]; } } Index: src/OFMutableArray_adjacent.m ================================================================== --- src/OFMutableArray_adjacent.m +++ src/OFMutableArray_adjacent.m @@ -58,35 +58,35 @@ _mutations++; } - (void)insertObject: (id)object - atIndex: (size_t)index + atIndex: (size_t)idx { if (object == nil) @throw [OFInvalidArgumentException exception]; @try { [_array insertItem: &object - atIndex: index]; + atIndex: idx]; } @catch (OFOutOfRangeException *e) { @throw [OFOutOfRangeException exception]; } [object retain]; _mutations++; } - (void)insertObjectsFromArray: (OFArray *)array - atIndex: (size_t)index + atIndex: (size_t)idx { id const *objects = [array objects]; size_t count = [array count]; @try { [_array insertItems: objects - atIndex: index + atIndex: idx count: count]; } @catch (OFOutOfRangeException *e) { @throw [OFOutOfRangeException exception]; } @@ -117,11 +117,11 @@ return; } } } -- (void)replaceObjectAtIndex: (size_t)index +- (void)replaceObjectAtIndex: (size_t)idx withObject: (id)object { id *objects; id oldObject; @@ -128,15 +128,15 @@ if (object == nil) @throw [OFInvalidArgumentException exception]; objects = [_array items]; - if (index >= [_array count]) + if (idx >= [_array count]) @throw [OFOutOfRangeException exception]; - oldObject = objects[index]; - objects[index] = [object retain]; + oldObject = objects[idx]; + objects[idx] = [object retain]; [oldObject release]; } - (void)replaceObjectIdenticalTo: (id)oldObject withObject: (id)newObject @@ -207,14 +207,14 @@ return; } } } -- (void)removeObjectAtIndex: (size_t)index +- (void)removeObjectAtIndex: (size_t)idx { - id object = [self objectAtIndex: index]; - [_array removeItemAtIndex: index]; + id object = [self objectAtIndex: idx]; + [_array removeItemAtIndex: idx]; [object release]; _mutations++; } @@ -266,23 +266,23 @@ [object release]; _mutations++; } -- (void)exchangeObjectAtIndex: (size_t)index1 - withObjectAtIndex: (size_t)index2 +- (void)exchangeObjectAtIndex: (size_t)idx1 + withObjectAtIndex: (size_t)idx2 { id *objects = [_array items]; size_t count = [_array count]; id tmp; - if (index1 >= count || index2 >= count) + if (idx1 >= count || idx2 >= count) @throw [OFOutOfRangeException exception]; - tmp = objects[index1]; - objects[index1] = objects[index2]; - objects[index2] = tmp; + tmp = objects[idx1]; + objects[idx1] = objects[idx2]; + objects[idx2] = tmp; } - (void)reverse { id *objects = [_array items]; Index: src/OFMutableData.m ================================================================== --- src/OFMutableData.m +++ src/OFMutableData.m @@ -173,14 +173,14 @@ _count++; } - (void)insertItem: (const void *)item - atIndex: (size_t)index + atIndex: (size_t)idx { [self insertItems: item - atIndex: index + atIndex: idx count: 1]; } - (void)addItems: (const void *)items count: (size_t)count @@ -198,33 +198,33 @@ memcpy(_items + _count * _itemSize, items, count * _itemSize); _count += count; } - (void)insertItems: (const void *)items - atIndex: (size_t)index + atIndex: (size_t)idx count: (size_t)count { - if (count > SIZE_MAX - _count || index > _count) + if (count > SIZE_MAX - _count || idx > _count) @throw [OFOutOfRangeException exception]; if (_count + count > _capacity) { _items = [self resizeMemory: _items size: _itemSize count: _count + count]; _capacity = _count + count; } - memmove(_items + (index + count) * _itemSize, - _items + index * _itemSize, (_count - index) * _itemSize); - memcpy(_items + index * _itemSize, items, count * _itemSize); + memmove(_items + (idx + count) * _itemSize, _items + idx * _itemSize, + (_count - idx) * _itemSize); + memcpy(_items + idx * _itemSize, items, count * _itemSize); _count += count; } -- (void)removeItemAtIndex: (size_t)index +- (void)removeItemAtIndex: (size_t)idx { - [self removeItemsInRange: of_range(index, 1)]; + [self removeItemsInRange: of_range(idx, 1)]; } - (void)removeItemsInRange: (of_range_t)range { if (range.length > SIZE_MAX - range.location || Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -294,19 +294,19 @@ objc_autoreleasePoolPop(pool); } #endif - (void)setCharacter: (of_unichar_t)character - atIndex: (size_t)index + atIndex: (size_t)idx { void *pool = objc_autoreleasePoolPush(); OFString *string; string = [OFString stringWithCharacters: &character length: 1]; - [self replaceCharactersInRange: of_range(index, 1) + [self replaceCharactersInRange: of_range(idx, 1) withString: string]; objc_autoreleasePoolPop(pool); } @@ -464,13 +464,13 @@ wordMiddleFunction: of_ascii_tolower]; } #endif - (void)insertString: (OFString *)string - atIndex: (size_t)index + atIndex: (size_t)idx { - [self replaceCharactersInRange: of_range(index, 0) + [self replaceCharactersInRange: of_range(idx, 0) withString: string]; } - (void)deleteCharactersInRange: (of_range_t)range { Index: src/OFMutableString_UTF8.m ================================================================== --- src/OFMutableString_UTF8.m +++ src/OFMutableString_UTF8.m @@ -178,63 +178,61 @@ * need to change it. */ } - (void)setCharacter: (of_unichar_t)character - atIndex: (size_t)index + atIndex: (size_t)idx { char buffer[4]; of_unichar_t c; size_t lenNew; ssize_t lenOld; if (_s->isUTF8) - index = of_string_utf8_get_position(_s->cString, index, + idx = of_string_utf8_get_position(_s->cString, idx, _s->cStringLength); - if (index > _s->cStringLength) + if (idx > _s->cStringLength) @throw [OFOutOfRangeException exception]; /* Shortcut if old and new character both are ASCII */ - if (character < 0x80 && !(_s->cString[index] & 0x80)) { + if (character < 0x80 && !(_s->cString[idx] & 0x80)) { _s->hashed = false; - _s->cString[index] = character; + _s->cString[idx] = character; return; } if ((lenNew = of_string_utf8_encode(character, buffer)) == 0) @throw [OFInvalidEncodingException exception]; - if ((lenOld = of_string_utf8_decode(_s->cString + index, - _s->cStringLength - index, &c)) <= 0) + if ((lenOld = of_string_utf8_decode(_s->cString + idx, + _s->cStringLength - idx, &c)) <= 0) @throw [OFInvalidEncodingException exception]; _s->hashed = false; if (lenNew == (size_t)lenOld) - memcpy(_s->cString + index, buffer, lenNew); + memcpy(_s->cString + idx, buffer, lenNew); else if (lenNew > (size_t)lenOld) { _s->cString = [self resizeMemory: _s->cString size: _s->cStringLength - lenOld + lenNew + 1]; - memmove(_s->cString + index + lenNew, - _s->cString + index + lenOld, - _s->cStringLength - index - lenOld); - memcpy(_s->cString + index, buffer, lenNew); + memmove(_s->cString + idx + lenNew, _s->cString + idx + lenOld, + _s->cStringLength - idx - lenOld); + memcpy(_s->cString + idx, buffer, lenNew); _s->cStringLength -= lenOld; _s->cStringLength += lenNew; _s->cString[_s->cStringLength] = '\0'; if (character >= 0x80) _s->isUTF8 = true; } else if (lenNew < (size_t)lenOld) { - memmove(_s->cString + index + lenNew, - _s->cString + index + lenOld, - _s->cStringLength - index - lenOld); - memcpy(_s->cString + index, buffer, lenNew); + memmove(_s->cString + idx + lenNew, _s->cString + idx + lenOld, + _s->cStringLength - idx - lenOld); + memcpy(_s->cString + idx, buffer, lenNew); _s->cStringLength -= lenOld; _s->cStringLength += lenNew; _s->cString[_s->cStringLength] = '\0'; @@ -508,29 +506,29 @@ @throw [OFInvalidEncodingException exception]; } } - (void)insertString: (OFString *)string - atIndex: (size_t)index + atIndex: (size_t)idx { size_t newCStringLength; - if (index > _s->length) + if (idx > _s->length) @throw [OFOutOfRangeException exception]; if (_s->isUTF8) - index = of_string_utf8_get_position(_s->cString, index, + idx = of_string_utf8_get_position(_s->cString, idx, _s->cStringLength); newCStringLength = _s->cStringLength + [string UTF8StringLength]; _s->hashed = false; _s->cString = [self resizeMemory: _s->cString size: newCStringLength + 1]; - memmove(_s->cString + index + [string UTF8StringLength], - _s->cString + index, _s->cStringLength - index); - memcpy(_s->cString + index, [string UTF8String], + memmove(_s->cString + idx + [string UTF8StringLength], + _s->cString + idx, _s->cStringLength - idx); + memcpy(_s->cString + idx, [string UTF8String], [string UTF8StringLength]); _s->cString[newCStringLength] = '\0'; _s->cStringLength = newCStringLength; _s->length += [string length]; Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -118,35 +118,35 @@ @interface OFNumber: OFObject { union of_number_value { bool bool_; - signed char schar; - signed short sshort; - signed int sint; - signed long slong; - signed long long slonglong; - unsigned char uchar; - unsigned short ushort; - unsigned int uint; - unsigned long ulong; - unsigned long long ulonglong; + signed char sChar; + signed short sShort; + signed int sInt; + signed long sLong; + signed long long sLongLong; + unsigned char uChar; + unsigned short uShort; + unsigned int uInt; + unsigned long uLong; + unsigned long long uLongLong; int8_t int8; int16_t int16; int32_t int32; int64_t int64; - uint8_t uint8; - uint16_t uint16; - uint32_t uint32; - uint64_t uint64; + uint8_t uInt8; + uint16_t uInt16; + uint32_t uInt32; + uint64_t uInt64; size_t size; - ssize_t ssize; - intmax_t intmax; - uintmax_t uintmax; - ptrdiff_t ptrdiff; - intptr_t intptr; - uintptr_t uintptr; + ssize_t sSize; + intmax_t intMax; + uintmax_t uIntMax; + ptrdiff_t ptrDiff; + intptr_t intPtr; + uintptr_t uIntPtr; float float_; double double_; } _value; of_number_type_t _type; } Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -32,59 +32,59 @@ #define RETURN_AS(t) \ switch (_type) { \ case OF_NUMBER_TYPE_BOOL: \ return (t)_value.bool_; \ case OF_NUMBER_TYPE_CHAR: \ - return (t)_value.schar; \ + return (t)_value.sChar; \ case OF_NUMBER_TYPE_SHORT: \ - return (t)_value.sshort; \ + return (t)_value.sShort; \ case OF_NUMBER_TYPE_INT: \ - return (t)_value.sint; \ + return (t)_value.sInt; \ case OF_NUMBER_TYPE_LONG: \ - return (t)_value.slong; \ + return (t)_value.sLong; \ case OF_NUMBER_TYPE_LONGLONG: \ - return (t)_value.slonglong; \ + return (t)_value.sLongLong; \ case OF_NUMBER_TYPE_UCHAR: \ - return (t)_value.uchar; \ + return (t)_value.uChar; \ case OF_NUMBER_TYPE_USHORT: \ - return (t)_value.ushort; \ + return (t)_value.uShort; \ case OF_NUMBER_TYPE_UINT: \ - return (t)_value.uint; \ + return (t)_value.uInt; \ case OF_NUMBER_TYPE_ULONG: \ - return (t)_value.ulong; \ + return (t)_value.uLong; \ case OF_NUMBER_TYPE_ULONGLONG: \ - return (t)_value.ulonglong; \ + return (t)_value.uLongLong; \ case OF_NUMBER_TYPE_INT8: \ return (t)_value.int8; \ case OF_NUMBER_TYPE_INT16: \ return (t)_value.int16; \ case OF_NUMBER_TYPE_INT32: \ return (t)_value.int32; \ case OF_NUMBER_TYPE_INT64: \ return (t)_value.int64; \ case OF_NUMBER_TYPE_UINT8: \ - return (t)_value.uint8; \ + return (t)_value.uInt8; \ case OF_NUMBER_TYPE_UINT16: \ - return (t)_value.uint16; \ + return (t)_value.uInt16; \ case OF_NUMBER_TYPE_UINT32: \ - return (t)_value.uint32; \ + return (t)_value.uInt32; \ case OF_NUMBER_TYPE_UINT64: \ - return (t)_value.uint64; \ + return (t)_value.uInt64; \ case OF_NUMBER_TYPE_SIZE: \ return (t)_value.size; \ case OF_NUMBER_TYPE_SSIZE: \ - return (t)_value.ssize; \ + return (t)_value.sSize; \ case OF_NUMBER_TYPE_INTMAX: \ - return (t)_value.intmax; \ + return (t)_value.intMax; \ case OF_NUMBER_TYPE_UINTMAX: \ - return (t)_value.uintmax; \ + return (t)_value.uIntMax; \ case OF_NUMBER_TYPE_PTRDIFF: \ - return (t)_value.ptrdiff; \ + return (t)_value.ptrDiff; \ case OF_NUMBER_TYPE_INTPTR: \ - return (t)_value.intptr; \ + return (t)_value.intPtr; \ case OF_NUMBER_TYPE_UINTPTR: \ - return (t)_value.uintptr; \ + return (t)_value.uIntPtr; \ case OF_NUMBER_TYPE_FLOAT: \ return (t)_value.float_; \ case OF_NUMBER_TYPE_DOUBLE: \ return (t)_value.double_; \ default: \ @@ -102,58 +102,58 @@ + (instancetype)numberWithBool: (bool)bool_ { return [[[self alloc] initWithBool: bool_] autorelease]; } -+ (instancetype)numberWithChar: (signed char)schar -{ - return [[[self alloc] initWithChar: schar] autorelease]; -} - -+ (instancetype)numberWithShort: (signed short)sshort -{ - return [[[self alloc] initWithShort: sshort] autorelease]; -} - -+ (instancetype)numberWithInt: (signed int)sint -{ - return [[[self alloc] initWithInt: sint] autorelease]; -} - -+ (instancetype)numberWithLong: (signed long)slong -{ - return [[[self alloc] initWithLong: slong] autorelease]; -} - -+ (instancetype)numberWithLongLong: (signed long long)slonglong -{ - return [[[self alloc] initWithLongLong: slonglong] autorelease]; -} - -+ (instancetype)numberWithUnsignedChar: (unsigned char)uchar -{ - return [[[self alloc] initWithUnsignedChar: uchar] autorelease]; -} - -+ (instancetype)numberWithUnsignedShort: (unsigned short)ushort -{ - return [[[self alloc] initWithUnsignedShort: ushort] autorelease]; -} - -+ (instancetype)numberWithUnsignedInt: (unsigned int)uint -{ - return [[[self alloc] initWithUnsignedInt: uint] autorelease]; -} - -+ (instancetype)numberWithUnsignedLong: (unsigned long)ulong -{ - return [[[self alloc] initWithUnsignedLong: ulong] autorelease]; -} - -+ (instancetype)numberWithUnsignedLongLong: (unsigned long long)ulonglong -{ - return [[[self alloc] initWithUnsignedLongLong: ulonglong] autorelease]; ++ (instancetype)numberWithChar: (signed char)sChar +{ + return [[[self alloc] initWithChar: sChar] autorelease]; +} + ++ (instancetype)numberWithShort: (signed short)sShort +{ + return [[[self alloc] initWithShort: sShort] autorelease]; +} + ++ (instancetype)numberWithInt: (signed int)sInt +{ + return [[[self alloc] initWithInt: sInt] autorelease]; +} + ++ (instancetype)numberWithLong: (signed long)sLong +{ + return [[[self alloc] initWithLong: sLong] autorelease]; +} + ++ (instancetype)numberWithLongLong: (signed long long)sLongLong +{ + return [[[self alloc] initWithLongLong: sLongLong] autorelease]; +} + ++ (instancetype)numberWithUnsignedChar: (unsigned char)uChar +{ + return [[[self alloc] initWithUnsignedChar: uChar] autorelease]; +} + ++ (instancetype)numberWithUnsignedShort: (unsigned short)uShort +{ + return [[[self alloc] initWithUnsignedShort: uShort] autorelease]; +} + ++ (instancetype)numberWithUnsignedInt: (unsigned int)uInt +{ + return [[[self alloc] initWithUnsignedInt: uInt] autorelease]; +} + ++ (instancetype)numberWithUnsignedLong: (unsigned long)uLong +{ + return [[[self alloc] initWithUnsignedLong: uLong] autorelease]; +} + ++ (instancetype)numberWithUnsignedLongLong: (unsigned long long)uLongLong +{ + return [[[self alloc] initWithUnsignedLongLong: uLongLong] autorelease]; } + (instancetype)numberWithInt8: (int8_t)int8 { return [[[self alloc] initWithInt8: int8] autorelease]; @@ -177,58 +177,58 @@ + (instancetype)numberWithUInt8: (uint8_t)uint8 { return [[[self alloc] initWithUInt8: uint8] autorelease]; } -+ (instancetype)numberWithUInt16: (uint16_t)uint16 ++ (instancetype)numberWithUInt16: (uint16_t)uInt16 { - return [[[self alloc] initWithUInt16: uint16] autorelease]; + return [[[self alloc] initWithUInt16: uInt16] autorelease]; } -+ (instancetype)numberWithUInt32: (uint32_t)uint32 ++ (instancetype)numberWithUInt32: (uint32_t)uInt32 { - return [[[self alloc] initWithUInt32: uint32] autorelease]; + return [[[self alloc] initWithUInt32: uInt32] autorelease]; } -+ (instancetype)numberWithUInt64: (uint64_t)uint64 ++ (instancetype)numberWithUInt64: (uint64_t)uInt64 { - return [[[self alloc] initWithUInt64: uint64] autorelease]; + return [[[self alloc] initWithUInt64: uInt64] autorelease]; } + (instancetype)numberWithSize: (size_t)size { return [[[self alloc] initWithSize: size] autorelease]; } -+ (instancetype)numberWithSSize: (ssize_t)ssize -{ - return [[[self alloc] initWithSSize: ssize] autorelease]; -} - -+ (instancetype)numberWithIntMax: (intmax_t)intmax -{ - return [[[self alloc] initWithIntMax: intmax] autorelease]; -} - -+ (instancetype)numberWithUIntMax: (uintmax_t)uintmax -{ - return [[[self alloc] initWithUIntMax: uintmax] autorelease]; -} - -+ (instancetype)numberWithPtrDiff: (ptrdiff_t)ptrdiff -{ - return [[[self alloc] initWithPtrDiff: ptrdiff] autorelease]; -} - -+ (instancetype)numberWithIntPtr: (intptr_t)intptr -{ - return [[[self alloc] initWithIntPtr: intptr] autorelease]; -} - -+ (instancetype)numberWithUIntPtr: (uintptr_t)uintptr -{ - return [[[self alloc] initWithUIntPtr: uintptr] autorelease]; ++ (instancetype)numberWithSSize: (ssize_t)sSize +{ + return [[[self alloc] initWithSSize: sSize] autorelease]; +} + ++ (instancetype)numberWithIntMax: (intmax_t)intMax +{ + return [[[self alloc] initWithIntMax: intMax] autorelease]; +} + ++ (instancetype)numberWithUIntMax: (uintmax_t)uIntMax +{ + return [[[self alloc] initWithUIntMax: uIntMax] autorelease]; +} + ++ (instancetype)numberWithPtrDiff: (ptrdiff_t)ptrDiff +{ + return [[[self alloc] initWithPtrDiff: ptrDiff] autorelease]; +} + ++ (instancetype)numberWithIntPtr: (intptr_t)intPtr +{ + return [[[self alloc] initWithIntPtr: intPtr] autorelease]; +} + ++ (instancetype)numberWithUIntPtr: (uintptr_t)uIntPtr +{ + return [[[self alloc] initWithUIntPtr: uIntPtr] autorelease]; } + (instancetype)numberWithFloat: (float)float_ { return [[[self alloc] initWithFloat: float_] autorelease]; @@ -252,105 +252,105 @@ _type = OF_NUMBER_TYPE_BOOL; return self; } -- initWithChar: (signed char)schar +- initWithChar: (signed char)sChar { self = [super init]; - _value.schar = schar; + _value.sChar = sChar; _type = OF_NUMBER_TYPE_CHAR; return self; } -- initWithShort: (signed short)sshort +- initWithShort: (signed short)sShort { self = [super init]; - _value.sshort = sshort; + _value.sShort = sShort; _type = OF_NUMBER_TYPE_SHORT; return self; } -- initWithInt: (signed int)sint +- initWithInt: (signed int)sInt { self = [super init]; - _value.sint = sint; + _value.sInt = sInt; _type = OF_NUMBER_TYPE_INT; return self; } -- initWithLong: (signed long)slong +- initWithLong: (signed long)sLong { self = [super init]; - _value.slong = slong; + _value.sLong = sLong; _type = OF_NUMBER_TYPE_LONG; return self; } -- initWithLongLong: (signed long long)slonglong +- initWithLongLong: (signed long long)sLongLong { self = [super init]; - _value.slonglong = slonglong; + _value.sLongLong = sLongLong; _type = OF_NUMBER_TYPE_LONGLONG; return self; } -- initWithUnsignedChar: (unsigned char)uchar +- initWithUnsignedChar: (unsigned char)uChar { self = [super init]; - _value.uchar = uchar; + _value.uChar = uChar; _type = OF_NUMBER_TYPE_UCHAR; return self; } -- initWithUnsignedShort: (unsigned short)ushort +- initWithUnsignedShort: (unsigned short)uShort { self = [super init]; - _value.ushort = ushort; + _value.uShort = uShort; _type = OF_NUMBER_TYPE_USHORT; return self; } -- initWithUnsignedInt: (unsigned int)uint +- initWithUnsignedInt: (unsigned int)uInt { self = [super init]; - _value.uint = uint; + _value.uInt = uInt; _type = OF_NUMBER_TYPE_UINT; return self; } -- initWithUnsignedLong: (unsigned long)ulong +- initWithUnsignedLong: (unsigned long)uLong { self = [super init]; - _value.ulong = ulong; + _value.uLong = uLong; _type = OF_NUMBER_TYPE_ULONG; return self; } -- initWithUnsignedLongLong: (unsigned long long)ulonglong +- initWithUnsignedLongLong: (unsigned long long)uLongLong { self = [super init]; - _value.ulonglong = ulonglong; + _value.uLongLong = uLongLong; _type = OF_NUMBER_TYPE_ULONGLONG; return self; } @@ -392,45 +392,45 @@ _type = OF_NUMBER_TYPE_INT64; return self; } -- initWithUInt8: (uint8_t)uint8 +- initWithUInt8: (uint8_t)uInt8 { self = [super init]; - _value.uint8 = uint8; + _value.uInt8 = uInt8; _type = OF_NUMBER_TYPE_UINT8; return self; } -- initWithUInt16: (uint16_t)uint16 +- initWithUInt16: (uint16_t)uInt16 { self = [super init]; - _value.uint16 = uint16; + _value.uInt16 = uInt16; _type = OF_NUMBER_TYPE_UINT16; return self; } -- initWithUInt32: (uint32_t)uint32 +- initWithUInt32: (uint32_t)uInt32 { self = [super init]; - _value.uint32 = uint32; + _value.uInt32 = uInt32; _type = OF_NUMBER_TYPE_UINT32; return self; } -- initWithUInt64: (uint64_t)uint64 +- initWithUInt64: (uint64_t)uInt64 { self = [super init]; - _value.uint64 = uint64; + _value.uInt64 = uInt64; _type = OF_NUMBER_TYPE_UINT64; return self; } @@ -442,65 +442,65 @@ _type = OF_NUMBER_TYPE_SIZE; return self; } -- initWithSSize: (ssize_t)ssize +- initWithSSize: (ssize_t)sSize { self = [super init]; - _value.ssize = ssize; + _value.sSize = sSize; _type = OF_NUMBER_TYPE_SSIZE; return self; } -- initWithIntMax: (intmax_t)intmax +- initWithIntMax: (intmax_t)intMax { self = [super init]; - _value.intmax = intmax; + _value.intMax = intMax; _type = OF_NUMBER_TYPE_INTMAX; return self; } -- initWithUIntMax: (uintmax_t)uintmax +- initWithUIntMax: (uintmax_t)uIntMax { self = [super init]; - _value.uintmax = uintmax; + _value.uIntMax = uIntMax; _type = OF_NUMBER_TYPE_UINTMAX; return self; } -- initWithPtrDiff: (ptrdiff_t)ptrdiff +- initWithPtrDiff: (ptrdiff_t)ptrDiff { self = [super init]; - _value.ptrdiff = ptrdiff; + _value.ptrDiff = ptrDiff; _type = OF_NUMBER_TYPE_PTRDIFF; return self; } -- initWithIntPtr: (intptr_t)intptr +- initWithIntPtr: (intptr_t)intPtr { self = [super init]; - _value.intptr = intptr; + _value.intPtr = intPtr; _type = OF_NUMBER_TYPE_INTPTR; return self; } -- initWithUIntPtr: (uintptr_t)uintptr +- initWithUIntPtr: (uintptr_t)uIntPtr { self = [super init]; - _value.uintptr = uintptr; + _value.uIntPtr = uIntPtr; _type = OF_NUMBER_TYPE_UINTPTR; return self; } @@ -551,14 +551,14 @@ /* * FIXME: This will fail if the value is bigger than * INTMAX_MAX! */ _type = OF_NUMBER_TYPE_UINTMAX; - _value.uintmax = [element decimalValue]; + _value.uIntMax = [element decimalValue]; } else if ([typeString isEqual: @"signed"]) { _type = OF_NUMBER_TYPE_INTMAX; - _value.intmax = [element decimalValue]; + _value.intMax = [element decimalValue]; } else if ([typeString isEqual: @"float"]) { union { float f; uint32_t u; } f; Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -312,11 +312,11 @@ if (_block != NULL) return _block(object, _buffer, length, address, exception); else { # endif bool (*func)(id, SEL, OFUDPSocket *, void *, size_t, - of_udp_socket_address_t address, OFException *) = + of_udp_socket_address_t, OFException *) = (bool (*)(id, SEL, OFUDPSocket *, void *, size_t, of_udp_socket_address_t, OFException *)) [_target methodForSelector: _selector]; return func(_target, _selector, object, _buffer, length, @@ -428,17 +428,17 @@ queueItem->_target = [target retain]; queueItem->_selector = selector; }) } -+ (void)of_addAsyncReceiveForUDPSocket: (OFUDPSocket *)socket ++ (void)of_addAsyncReceiveForUDPSocket: (OFUDPSocket *)sock buffer: (void *)buffer length: (size_t)length target: (id)target selector: (SEL)selector { - ADD_READ(OFRunLoop_UDPReceiveQueueItem, socket, { + ADD_READ(OFRunLoop_UDPReceiveQueueItem, sock, { queueItem->_buffer = buffer; queueItem->_length = length; queueItem->_target = [target retain]; queueItem->_selector = selector; }) @@ -485,17 +485,17 @@ ADD_READ(OFRunLoop_AcceptQueueItem, stream, { queueItem->_block = [block copy]; }) } -+ (void)of_addAsyncReceiveForUDPSocket: (OFUDPSocket *)socket ++ (void)of_addAsyncReceiveForUDPSocket: (OFUDPSocket *)sock buffer: (void *)buffer length: (size_t)length block: (of_udp_socket_async_receive_block_t) block { - ADD_READ(OFRunLoop_UDPReceiveQueueItem, socket, { + ADD_READ(OFRunLoop_UDPReceiveQueueItem, sock, { queueItem->_buffer = buffer; queueItem->_length = length; queueItem->_block = [block copy]; }) } Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1479,11 +1479,11 @@ - (size_t)UTF8StringLength { return [self cStringLengthWithEncoding: OF_STRING_ENCODING_UTF_8]; } -- (of_unichar_t)characterAtIndex: (size_t)index +- (of_unichar_t)characterAtIndex: (size_t)idx { OF_UNRECOGNIZED_SELECTOR } - (void)getCharacters: (of_unichar_t *)buffer Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -149,28 +149,28 @@ } size_t of_string_utf8_get_index(const char *string, size_t position) { - size_t index = position; + size_t idx = position; for (size_t i = 0; i < position; i++) if OF_UNLIKELY ((string[i] & 0xC0) == 0x80) - index--; + idx--; - return index; + return idx; } size_t -of_string_utf8_get_position(const char *string, size_t index, size_t length) +of_string_utf8_get_position(const char *string, size_t idx, size_t length) { - for (size_t i = 0; i <= index; i++) + for (size_t i = 0; i <= idx; i++) if OF_UNLIKELY ((string[i] & 0xC0) == 0x80) - if (++index > length) + if (++idx > length) return OF_NOT_FOUND; - return index; + return idx; } @implementation OFString_UTF8 - init { @@ -944,25 +944,24 @@ _s->hashed = true; return hash; } -- (of_unichar_t)characterAtIndex: (size_t)index +- (of_unichar_t)characterAtIndex: (size_t)idx { of_unichar_t character; - if (index >= _s->length) + if (idx >= _s->length) @throw [OFOutOfRangeException exception]; if (!_s->isUTF8) - return _s->cString[index]; + return _s->cString[idx]; - index = of_string_utf8_get_position(_s->cString, index, - _s->cStringLength); + idx = of_string_utf8_get_position(_s->cString, idx, _s->cStringLength); - if (of_string_utf8_decode(_s->cString + index, - _s->cStringLength - index, &character) <= 0) + if (of_string_utf8_decode(_s->cString + idx, + _s->cStringLength - idx, &character) <= 0) @throw [OFInvalidEncodingException exception]; return character; } Index: src/OFTCPSocket+SOCKS5.m ================================================================== --- src/OFTCPSocket+SOCKS5.m +++ src/OFTCPSocket+SOCKS5.m @@ -30,20 +30,20 @@ /* Reference for static linking */ int _OFTCPSocket_SOCKS5_reference; static void -send_or_exception(OFTCPSocket *self, of_socket_t socket, char *buffer, +send_or_exception(OFTCPSocket *self, of_socket_t sock, char *buffer, int length) { #ifndef OF_WINDOWS ssize_t bytesWritten; #else int bytesWritten; #endif - if ((bytesWritten = send(socket, (const void *)buffer, length, 0)) < 0) + if ((bytesWritten = send(sock, (const void *)buffer, length, 0)) < 0) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length bytesWritten: 0 errNo: of_socket_errno()]; @@ -54,14 +54,14 @@ bytesWritten: bytesWritten errNo: 0]; } static void -recv_exact(OFTCPSocket *self, of_socket_t socket, char *buffer, int length) +recv_exact(OFTCPSocket *self, of_socket_t sock, char *buffer, int length) { while (length > 0) { - ssize_t ret = recv(socket, (void *)buffer, length, 0); + ssize_t ret = recv(sock, (void *)buffer, length, 0); if (ret < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -95,21 +95,21 @@ # endif @end @implementation OFTCPSocket_ConnectThread - initWithSourceThread: (OFThread *)sourceThread - socket: (OFTCPSocket *)socket + socket: (OFTCPSocket *)sock host: (OFString *)host port: (uint16_t)port target: (id)target selector: (SEL)selector { self = [super init]; @try { _sourceThread = [sourceThread retain]; - _socket = [socket retain]; + _socket = [sock retain]; _host = [host copy]; _port = port; _target = [target retain]; _selector = selector; } @catch (id e) { @@ -120,20 +120,20 @@ return self; } # ifdef OF_HAVE_BLOCKS - initWithSourceThread: (OFThread *)sourceThread - socket: (OFTCPSocket *)socket + socket: (OFTCPSocket *)sock host: (OFString *)host port: (uint16_t)port block: (of_tcp_socket_async_connect_block_t)block { self = [super init]; @try { _sourceThread = [sourceThread retain]; - _socket = [socket retain]; + _socket = [sock retain]; _host = [host copy]; _port = port; _block = [block copy]; } @catch (id e) { [self release]; Index: src/OFUDPSocket.m ================================================================== --- src/OFUDPSocket.m +++ src/OFUDPSocket.m @@ -175,13 +175,13 @@ bool of_udp_socket_address_equal(of_udp_socket_address_t *address1, of_udp_socket_address_t *address2) { - struct sockaddr_in *sin_1, *sin_2; + struct sockaddr_in *addrIn1, *addrIn2; #ifdef HAVE_IPV6 - struct sockaddr_in6 *sin6_1, *sin6_2; + struct sockaddr_in6 *addrIn6_1, *addrIn6_2; #endif if (address1->address.ss_family != address2->address.ss_family) return false; @@ -194,33 +194,33 @@ #else if (address1->length < 8 || address2->length < 8) @throw [OFInvalidArgumentException exception]; #endif - sin_1 = (struct sockaddr_in *)&address1->address; - sin_2 = (struct sockaddr_in *)&address2->address; + addrIn1 = (struct sockaddr_in *)&address1->address; + addrIn2 = (struct sockaddr_in *)&address2->address; - if (sin_1->sin_port != sin_2->sin_port) + if (addrIn1->sin_port != addrIn2->sin_port) return false; - if (sin_1->sin_addr.s_addr != sin_2->sin_addr.s_addr) + if (addrIn1->sin_addr.s_addr != addrIn2->sin_addr.s_addr) return false; break; #ifdef HAVE_IPV6 case AF_INET6: if (address1->length < sizeof(struct sockaddr_in6) || address2->length < sizeof(struct sockaddr_in6)) @throw [OFInvalidArgumentException exception]; - sin6_1 = (struct sockaddr_in6 *)&address1->address; - sin6_2 = (struct sockaddr_in6 *)&address2->address; + addrIn6_1 = (struct sockaddr_in6 *)&address1->address; + addrIn6_2 = (struct sockaddr_in6 *)&address2->address; - if (sin6_1->sin6_port != sin6_2->sin6_port) + if (addrIn6_1->sin6_port != addrIn6_2->sin6_port) return false; - if (memcmp(sin6_1->sin6_addr.s6_addr, - sin6_2->sin6_addr.s6_addr, - sizeof(sin6_1->sin6_addr.s6_addr)) != 0) + if (memcmp(addrIn6_1->sin6_addr.s6_addr, + addrIn6_2->sin6_addr.s6_addr, + sizeof(addrIn6_1->sin6_addr.s6_addr)) != 0) return false; break; #endif default: @@ -232,13 +232,13 @@ uint32_t of_udp_socket_address_hash(of_udp_socket_address_t *address) { uint32_t hash = of_hash_seed; - struct sockaddr_in *sin; + struct sockaddr_in *addrIn; #ifdef HAVE_IPV6 - struct sockaddr_in6 *sin6; + struct sockaddr_in6 *addrIn6; uint32_t subhash; #endif hash += address->address.ss_family; @@ -250,29 +250,29 @@ #else if (address->length < 8) @throw [OFInvalidArgumentException exception]; #endif - sin = (struct sockaddr_in *)&address->address; + addrIn = (struct sockaddr_in *)&address->address; - hash += (sin->sin_port << 1); - hash ^= sin->sin_addr.s_addr; + hash += (addrIn->sin_port << 1); + hash ^= addrIn->sin_addr.s_addr; break; #ifdef HAVE_IPV6 case AF_INET6: if (address->length < sizeof(struct sockaddr_in6)) @throw [OFInvalidArgumentException exception]; - sin6 = (struct sockaddr_in6 *)&address->address; + addrIn6 = (struct sockaddr_in6 *)&address->address; - hash += (sin6->sin6_port << 1); + hash += (addrIn6->sin6_port << 1); OF_HASH_INIT(subhash); - for (size_t i = 0; i < sizeof(sin6->sin6_addr.s6_addr); i++) - OF_HASH_ADD(subhash, sin6->sin6_addr.s6_addr[i]); + for (size_t i = 0; i < sizeof(addrIn6->sin6_addr.s6_addr); i++) + OF_HASH_ADD(subhash, adrIn6->sin6_addr.s6_addr[i]); OF_HASH_FINALIZE(subhash); hash ^= subhash; Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -882,31 +882,31 @@ [_children addObject: child]; } - (void)insertChild: (OFXMLNode *)child - atIndex: (size_t)index + atIndex: (size_t)idx { if ([child isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; if (_children == nil) _children = [[OFMutableArray alloc] init]; [_children insertObject: child - atIndex: index]; + atIndex: idx]; } - (void)insertChildren: (OFArray *)children - atIndex: (size_t)index + atIndex: (size_t)idx { for (OFXMLNode *node in children) if ([node isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; [_children insertObjectsFromArray: children - atIndex: index]; + atIndex: idx]; } - (void)removeChild: (OFXMLNode *)child { if ([child isKindOfClass: [OFXMLAttribute class]]) @@ -913,13 +913,13 @@ @throw [OFInvalidArgumentException exception]; [_children removeObject: child]; } -- (void)removeChildAtIndex: (size_t)index +- (void)removeChildAtIndex: (size_t)idx { - [_children removeObjectAtIndex: index]; + [_children removeObjectAtIndex: idx]; } - (void)replaceChild: (OFXMLNode *)child withNode: (OFXMLNode *)node { @@ -929,17 +929,17 @@ [_children replaceObject: child withObject: node]; } -- (void)replaceChildAtIndex: (size_t)index +- (void)replaceChildAtIndex: (size_t)idx withNode: (OFXMLNode *)node { if ([node isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; - [_children replaceObjectAtIndex: index + [_children replaceObjectAtIndex: idx withObject: node]; } - (OFXMLElement *)elementForName: (OFString *)elementName { Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -513,12 +513,14 @@ @throw [OFNotOpenException exceptionWithObject: self]; if (_atEndOfStream) return 0; - if (sizeof(length) >= sizeof(uint64_t) && length > UINT64_MAX) +#if SIZE_MAX >= UINT64_MAX + if (length > UINT64_MAX) @throw [OFOutOfRangeException exception]; +#endif if ((uint64_t)length > _toRead) length = (size_t)_toRead; ret = [_decompressedStream readIntoBuffer: buffer Index: src/bridge/NSArray+OFObject.h ================================================================== --- src/bridge/NSArray+OFObject.h +++ src/bridge/NSArray+OFObject.h @@ -16,11 +16,13 @@ #import #import "NSBridging.h" +#ifdef NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN +#endif /*! * @category NSArray (OFObject) \ * NSArray+OFObject.h ObjFW-Bridge/NSArray+OFObject.h * @@ -27,6 +29,8 @@ * @brief Support for bridging NSArrays to OFArrays. */ @interface NSArray (OFObject) @end +#ifdef NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END +#endif Index: src/bridge/NSArray_OFArray.h ================================================================== --- src/bridge/NSArray_OFArray.h +++ src/bridge/NSArray_OFArray.h @@ -16,16 +16,20 @@ #import @class OFArray; +#ifdef NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN +#endif @interface NSArray_OFArray: NSArray { OFArray *_array; } - initWithOFArray: (OFArray *)array; @end +#ifdef NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END +#endif Index: src/bridge/NSArray_OFArray.m ================================================================== --- src/bridge/NSArray_OFArray.m +++ src/bridge/NSArray_OFArray.m @@ -32,13 +32,13 @@ } return self; } -- (id)objectAtIndex: (NSUInteger)index +- (id)objectAtIndex: (NSUInteger)idx { - id object = [_array objectAtIndex: index]; + id object = [_array objectAtIndex: idx]; if ([(OFObject *)object conformsToProtocol: @protocol(OFBridging)]) return [object NSObject]; return object; Index: src/bridge/NSDictionary+OFObject.h ================================================================== --- src/bridge/NSDictionary+OFObject.h +++ src/bridge/NSDictionary+OFObject.h @@ -16,11 +16,13 @@ #import #import "NSBridging.h" +#ifdef NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN +#endif /*! * @category NSDictionary (OFObject) \ * NSDictionary+OFObject.h ObjFW-Bridge/NSDictionary+OFObject.h * @@ -27,6 +29,8 @@ * @brief Support for bridging NSDictionaries to OFDictionaries. */ @interface NSDictionary (OFObject) @end +#ifdef NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END +#endif Index: src/bridge/NSDictionary_OFDictionary.h ================================================================== --- src/bridge/NSDictionary_OFDictionary.h +++ src/bridge/NSDictionary_OFDictionary.h @@ -16,16 +16,20 @@ #import @class OFDictionary; +#ifdef NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN +#endif @interface NSDictionary_OFDictionary: NSDictionary { OFDictionary *_dictionary; } - initWithOFDictionary: (OFDictionary *)dictionary; @end +#ifdef NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END +#endif Index: src/bridge/NSString+OFObject.h ================================================================== --- src/bridge/NSString+OFObject.h +++ src/bridge/NSString+OFObject.h @@ -16,11 +16,13 @@ #import #import "NSBridging.h" +#ifdef NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN +#endif /*! * @category NSString (OFObject) * NSString+OFObject.h ObjFW-Bridge/NSString+OFObject.h * @@ -31,6 +33,8 @@ * character of OFString is 4). */ @interface NSString (OFObject) @end +#ifdef NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END +#endif Index: src/bridge/OFArray_NSArray.m ================================================================== --- src/bridge/OFArray_NSArray.m +++ src/bridge/OFArray_NSArray.m @@ -39,18 +39,18 @@ } return self; } -- (id)objectAtIndex: (size_t)index +- (id)objectAtIndex: (size_t)idx { id object; - if (index > NSUIntegerMax) + if (idx > NSUIntegerMax) @throw [OFOutOfRangeException exception]; - object = [_array objectAtIndex: index]; + object = [_array objectAtIndex: idx]; if ([(NSObject *)object conformsToProtocol: @protocol(NSBridging)]) return [object OFObject]; return object; Index: src/encodings/codepage_437.m ================================================================== --- src/encodings/codepage_437.m +++ src/encodings/codepage_437.m @@ -135,11 +135,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/encodings/codepage_850.m ================================================================== --- src/encodings/codepage_850.m +++ src/encodings/codepage_850.m @@ -111,11 +111,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/encodings/codepage_858.m ================================================================== --- src/encodings/codepage_858.m +++ src/encodings/codepage_858.m @@ -117,11 +117,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/encodings/common.h ================================================================== --- src/encodings/common.h +++ src/encodings/common.h @@ -19,26 +19,26 @@ if OF_UNLIKELY ((c & 0xFF) < page##nr##Start) { \ output[i] = (unsigned char)c; \ continue; \ } \ \ - index = (c & 0xFF) - page##nr##Start; \ + idx = (c & 0xFF) - page##nr##Start; \ \ - if (index >= sizeof(page##nr)) { \ + if (idx >= sizeof(page##nr)) { \ output[i] = (unsigned char)c; \ continue; \ } \ \ - if (page##nr[index] == 0x00) { \ + if (page##nr[idx] == 0x00) { \ if (lossy) { \ output[i] = '?'; \ continue; \ } else \ return false; \ } \ \ - output[i] = page##nr[index]; \ + output[i] = page##nr[idx]; \ break; #define CASE_MISSING_IS_ERROR(nr) \ case 0x##nr: \ if OF_UNLIKELY ((c & 0xFF) < page##nr##Start) { \ if (lossy) { \ @@ -46,17 +46,17 @@ continue; \ } else \ return false; \ } \ \ - index = (c & 0xFF) - page##nr##Start; \ + idx = (c & 0xFF) - page##nr##Start; \ \ - if (index >= sizeof(page##nr) || page##nr[index] == 0) { \ + if (idx >= sizeof(page##nr) || page##nr[idx] == 0) { \ if (lossy) { \ output[i] = '?'; \ continue; \ } else \ return false; \ } \ \ - output[i] = page##nr[index]; \ + output[i] = page##nr[idx]; \ break; Index: src/encodings/iso_8859_15.m ================================================================== --- src/encodings/iso_8859_15.m +++ src/encodings/iso_8859_15.m @@ -66,11 +66,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/encodings/iso_8859_2.m ================================================================== --- src/encodings/iso_8859_2.m +++ src/encodings/iso_8859_2.m @@ -86,11 +86,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/encodings/iso_8859_3.m ================================================================== --- src/encodings/iso_8859_3.m +++ src/encodings/iso_8859_3.m @@ -83,11 +83,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/encodings/koi8_r.m ================================================================== --- src/encodings/koi8_r.m +++ src/encodings/koi8_r.m @@ -121,11 +121,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/encodings/koi8_u.m ================================================================== --- src/encodings/koi8_u.m +++ src/encodings/koi8_u.m @@ -129,11 +129,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/encodings/mac_roman.m ================================================================== --- src/encodings/mac_roman.m +++ src/encodings/mac_roman.m @@ -155,11 +155,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/encodings/windows_1251.m ================================================================== --- src/encodings/windows_1251.m +++ src/encodings/windows_1251.m @@ -108,11 +108,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/encodings/windows_1252.m ================================================================== --- src/encodings/windows_1252.m +++ src/encodings/windows_1252.m @@ -104,11 +104,11 @@ { for (size_t i = 0; i < length; i++) { of_unichar_t c = input[i]; if OF_UNLIKELY (c > 0x7F) { - uint8_t index; + uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { if (lossy) { output[i] = '?'; continue; Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -602,25 +602,25 @@ OF_HASH_ADD(hash, (otherCopy >> 8) & 0xFF); \ OF_HASH_ADD(hash, otherCopy & 0xFF); \ } static OF_INLINE bool -of_bitset_isset(uint8_t *_Nonnull storage, size_t index) +of_bitset_isset(uint8_t *_Nonnull storage, size_t idx) { - return storage[index / 8] & (1 << (index % 8)); + return storage[idx / 8] & (1 << (idx % 8)); } static OF_INLINE void -of_bitset_set(uint8_t *_Nonnull storage, size_t index) +of_bitset_set(uint8_t *_Nonnull storage, size_t idx) { - storage[index / 8] |= (1 << (index % 8)); + storage[idx / 8] |= (1 << (idx % 8)); } static OF_INLINE void -of_bitset_clear(uint8_t *_Nonnull storage, size_t index) +of_bitset_clear(uint8_t *_Nonnull storage, size_t idx) { - storage[index / 8] &= ~(1 << (index % 8)); + storage[idx / 8] &= ~(1 << (idx % 8)); } static OF_INLINE char *_Nullable of_strdup(const char *_Nonnull string) { Index: src/socket.h ================================================================== --- src/socket.h +++ src/socket.h @@ -111,13 +111,13 @@ extern "C" { #endif extern bool of_socket_init(void); extern int of_socket_errno(void); # ifndef OF_WII -extern int of_getsockname(of_socket_t socket, struct sockaddr *restrict address, - socklen_t *restrict address_len); +extern int of_getsockname(of_socket_t sock, struct sockaddr *restrict addr, + socklen_t *restrict addrLen); # endif #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END Index: src/socket.m ================================================================== --- src/socket.m +++ src/socket.m @@ -191,26 +191,26 @@ #endif } #ifndef OF_WII int -of_getsockname(of_socket_t socket, struct sockaddr *restrict address, - socklen_t *restrict address_len) +of_getsockname(of_socket_t sock, struct sockaddr *restrict addr, + socklen_t *restrict addrLen) { int ret; # ifdef OF_HAVE_THREADS if (!of_mutex_lock(&mutex)) @throw [OFLockFailedException exception]; # endif - ret = getsockname(socket, address, address_len); + ret = getsockname(sock, addr, addrLen); # ifdef OF_HAVE_THREADS if (!of_mutex_unlock(&mutex)) @throw [OFUnlockFailedException exception]; # endif return ret; } #endif Index: tests/OFArrayTests.m ================================================================== --- tests/OFArrayTests.m +++ tests/OFArrayTests.m @@ -98,13 +98,13 @@ [_array release]; [super dealloc]; } -- (id)objectAtIndex: (size_t)index +- (id)objectAtIndex: (size_t)idx { - return [_array objectAtIndex: index]; + return [_array objectAtIndex: idx]; } - (size_t)count { return [_array count]; @@ -117,26 +117,26 @@ if (self == [SimpleMutableArray class]) [self inheritMethodsFromClass: [SimpleArray class]]; } - (void)insertObject: (id)object - atIndex: (size_t)index + atIndex: (size_t)idx { [_array insertObject: object - atIndex: index]; + atIndex: idx]; } -- (void)replaceObjectAtIndex: (size_t)index +- (void)replaceObjectAtIndex: (size_t)idx withObject: (id)object { - [_array replaceObjectAtIndex: index + [_array replaceObjectAtIndex: idx withObject: object]; } -- (void)removeObjectAtIndex: (size_t)index +- (void)removeObjectAtIndex: (size_t)idx { - [_array removeObjectAtIndex: index]; + [_array removeObjectAtIndex: idx]; } @end @implementation TestsAppDelegate (OFArrayTests) - (void)arrayTestsWithClass: (Class)arrayClass Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -172,13 +172,13 @@ [_string release]; [super dealloc]; } -- (of_unichar_t)characterAtIndex: (size_t)index +- (of_unichar_t)characterAtIndex: (size_t)idx { - return [_string characterAtIndex: index]; + return [_string characterAtIndex: idx]; } - (size_t)length { return [_string length]; Index: utils/ofhttp/OFHTTP.m ================================================================== --- utils/ofhttp/OFHTTP.m +++ utils/ofhttp/OFHTTP.m @@ -374,16 +374,16 @@ [self performSelector: @selector(downloadNextURL) afterDelay: 0]; } - (void)client: (OFHTTPClient *)client - didCreateSocket: (OF_KINDOF(OFTCPSocket *))socket + didCreateSocket: (OF_KINDOF(OFTCPSocket *))sock request: (OFHTTPRequest *)request { - if (_insecure && [socket respondsToSelector: + if (_insecure && [sock respondsToSelector: @selector(setCertificateVerificationEnabled:)]) - [socket setCertificateVerificationEnabled: false]; + [sock setCertificateVerificationEnabled: false]; } - (bool)client: (OFHTTPClient *)client shouldFollowRedirect: (OFURL *)URL statusCode: (int)statusCode Index: utils/ofhttp/ProgressBar.m ================================================================== --- utils/ofhttp/ProgressBar.m +++ utils/ofhttp/ProgressBar.m @@ -103,25 +103,25 @@ [of_stdout writeString: @"\r ▕"]; for (size_t i = 0; i < (size_t)bars; i++) [of_stdout writeString: @"█"]; if (bars < barWidth) { - float remainder = bars - floorf(bars); + float rem = bars - floorf(bars); - if (remainder >= 0.875) + if (rem >= 0.875) [of_stdout writeString: @"▉"]; - else if (remainder >= 0.75) + else if (rem >= 0.75) [of_stdout writeString: @"▊"]; - else if (remainder >= 0.625) + else if (rem >= 0.625) [of_stdout writeString: @"▋"]; - else if (remainder >= 0.5) + else if (rem >= 0.5) [of_stdout writeString: @"▌"]; - else if (remainder >= 0.375) + else if (rem >= 0.375) [of_stdout writeString: @"▍"]; - else if (remainder >= 0.25) + else if (rem >= 0.25) [of_stdout writeString: @"▎"]; - else if (remainder >= 0.125) + else if (rem >= 0.125) [of_stdout writeString: @"▏"]; else [of_stdout writeString: @" "]; for (size_t i = 0; i < barWidth - (size_t)bars - 1; i++)