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 @@ - (id)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; @@ -874,13 +874,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 { @@ -898,13 +898,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]; @@ -923,15 +923,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 @@ -325,15 +325,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 @@ -376,16 +376,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 @@ -71,11 +71,11 @@ size_t _toRead; } @property (nonatomic, setter=of_setKeepAlive:) bool of_keepAlive; -- (instancetype)initWithSocket: (OFTCPSocket *)socket; +- (instancetype)initWithSocket: (OFTCPSocket *)sock; @end static OFString * constructRequestString(OFHTTPRequest *request) { @@ -236,19 +236,19 @@ [_serverHeaders release]; [super dealloc]; } -- (void)createResponseWithSocket: (OFTCPSocket *)socket +- (void)createResponseWithSocket: (OFTCPSocket *)sock { OFURL *URL = [_request URL]; OFHTTPClientResponse *response; OFString *connectionHeader; bool keepAlive; OFString *location; - response = [[[OFHTTPClientResponse alloc] initWithSocket: socket] + response = [[[OFHTTPClientResponse alloc] initWithSocket: sock] autorelease]; [response setProtocolVersionFromString: _version]; [response setStatusCode: _status]; [response setHeaders: _serverHeaders]; @@ -268,11 +268,11 @@ } if (keepAlive) { [response of_setKeepAlive: true]; - _client->_socket = [socket retain]; + _client->_socket = [sock retain]; _client->_lastURL = [URL copy]; _client->_lastWasHEAD = ([_request method] == OF_HTTP_REQUEST_METHOD_HEAD); _client->_lastResponse = [response retain]; } @@ -408,11 +408,11 @@ return true; } - (bool)handleServerHeader: (OFString *)line - socket: (OFTCPSocket *)socket + socket: (OFTCPSocket *)sock { OFString *key, *value, *old; const char *lineC, *tmp; char *keyC; @@ -429,11 +429,11 @@ statusCode: _status request: _request context: _context]; [self performSelector: @selector(createResponseWithSocket:) - withObject: socket + withObject: sock afterDelay: 0]; return false; } @@ -472,15 +472,17 @@ forKey: key]; return true; } -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadLine: (OFString *)line context: (id)context exception: (id)exception { + bool ret; + if (exception != nil) { if ([exception isKindOfClass: [OFInvalidEncodingException class]]) exception = [OFInvalidServerReplyException exception]; @@ -492,24 +494,26 @@ } @try { if (_firstLine) { _firstLine = false; - return [self handleFirstLine: line]; + ret = [self handleFirstLine: line]; } else - return [self handleServerHeader: line - socket: socket]; + ret = [self handleServerHeader: line + socket: sock]; } @catch (id e) { [_client->_delegate client: _client didEncounterException: e forRequest: _request context: _context]; - return false; + ret = false; } + + return ret; } -- (size_t)socket: (OFTCPSocket *)socket +- (size_t)socket: (OFTCPSocket *)sock didWriteBody: (const void **)body length: (size_t)length context: (id)context exception: (id)exception { @@ -519,18 +523,18 @@ forRequest: _request context: _context]; return 0; } - [socket asyncReadLineWithTarget: self - selector: @selector(socket:didReadLine:context: - exception:) - context: nil]; + [sock asyncReadLineWithTarget: self + selector: @selector(socket:didReadLine:context: + exception:) + context: nil]; return 0; } -- (size_t)socket: (OFTCPSocket *)socket +- (size_t)socket: (OFTCPSocket *)sock didWriteRequest: (const void **)request length: (size_t)length context: (id)context exception: (id)exception { @@ -551,26 +555,26 @@ context: _context]; return 0; } if ((body = [_request body]) != nil) { - [socket asyncWriteBuffer: [body items] - length: [body count] * [body itemSize] - target: self - selector: @selector(socket:didWriteBody:length: - context:exception:) - context: nil]; + [sock asyncWriteBuffer: [body items] + length: [body count] * [body itemSize] + target: self + selector: @selector(socket:didWriteBody:length: + context:exception:) + context: nil]; return 0; } else - return [self socket: socket + return [self socket: sock didWriteBody: NULL length: 0 context: nil exception: nil]; } -- (void)handleSocket: (OFTCPSocket *)socket +- (void)handleSocket: (OFTCPSocket *)sock { /* * 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. @@ -586,26 +590,26 @@ /* * Pass requestString as context to retain it so that the * underlying buffer lives long enough. */ - [socket asyncWriteBuffer: UTF8String - length: UTF8StringLength - target: self - selector: @selector(socket:didWriteRequest: - length:context:exception:) - context: requestString]; + [sock asyncWriteBuffer: UTF8String + length: UTF8StringLength + target: self + selector: @selector(socket:didWriteRequest: + length:context:exception:) + context: requestString]; } @catch (id e) { [_client->_delegate client: _client didEncounterException: e forRequest: _request context: _context]; return; } } -- (void)socketDidConnect: (OFTCPSocket *)socket +- (void)socketDidConnect: (OFTCPSocket *)sock context: (id)context exception: (id)exception { if (exception != nil) { [_client->_delegate client: _client @@ -616,23 +620,23 @@ } if ([_client->_delegate respondsToSelector: @selector(client:didCreateSocket:forRequest:context:)]) [_client->_delegate client: _client - didCreateSocket: socket + didCreateSocket: sock forRequest: _request context: _context]; [self performSelector: @selector(handleSocket:) - withObject: socket + withObject: sock afterDelay: 0]; } - (bool)throwAwayContent: (OFHTTPClientResponse *)response buffer: (char *)buffer length: (size_t)length - context: (OFTCPSocket *)socket + context: (OFTCPSocket *)sock exception: (id)exception { if (exception != nil) { [_client->_delegate client: _client didEncounterException: exception @@ -646,11 +650,11 @@ [_client->_lastResponse release]; _client->_lastResponse = nil; [self performSelector: @selector(handleSocket:) - withObject: socket + withObject: sock afterDelay: 0]; return false; } return true; @@ -657,11 +661,11 @@ } - (void)start { OFURL *URL = [_request URL]; - OFTCPSocket *socket; + OFTCPSocket *sock; /* Can we reuse the last socket? */ if (_client->_socket != nil && [[_client->_lastURL scheme] isEqual: [URL scheme]] && [[_client->_lastURL host] isEqual: [URL host]] && @@ -669,11 +673,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 = [_client->_socket autorelease]; + sock = [_client->_socket autorelease]; _client->_socket = nil; [_client->_lastURL release]; _client->_lastURL = nil; @@ -686,57 +690,56 @@ length: 512 target: self selector: @selector(throwAwayContent: buffer:length:context: exception:) - context: socket]; + context: sock]; } else { [_client->_lastResponse release]; _client->_lastResponse = nil; [self performSelector: @selector(handleSocket:) - withObject: socket + withObject: sock afterDelay: 0]; } } else [self closeAndReconnect]; } - (void)closeAndReconnect { OFURL *URL = [_request URL]; - OFTCPSocket *socket; + OFTCPSocket *sock; [_client 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]; - - [socket asyncConnectToHost: [URL host] - port: [URL port] - target: self - selector: @selector(socketDidConnect:context: - exception:) - context: nil]; + sock = [OFTCPSocket socket]; + + [sock asyncConnectToHost: [URL host] + port: [URL port] + target: self + selector: @selector(socketDidConnect:context: + exception:) + context: nil]; } @end @implementation OFHTTPClientResponse @synthesize of_keepAlive = _keepAlive; -- (instancetype)initWithSocket: (OFTCPSocket *)socket +- (instancetype)initWithSocket: (OFTCPSocket *)sock { self = [super init]; - _socket = [socket retain]; + _socket = [sock retain]; return self; } - (void)dealloc 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 context: (id)context exception: (id)exception; @end @@ -178,24 +178,24 @@ OFHTTPServer *_server; OFHTTPRequest *_request; bool _chunked, _headersSent; } -- (instancetype)initWithSocket: (OFTCPSocket *)socket +- (instancetype)initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server request: (OFHTTPRequest *)request; @end @implementation OFHTTPServerResponse -- (instancetype)initWithSocket: (OFTCPSocket *)socket +- (instancetype)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; } @@ -339,39 +339,39 @@ OFMutableDictionary *_headers; size_t _contentLength; OFMutableData *_body; } -- (instancetype)initWithSocket: (OFTCPSocket *)socket +- (instancetype)initWithSocket: (OFTCPSocket *)sock server: (OFHTTPServer *)server; -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadLine: (OFString *)line context: (id)context exception: (id)exception; - (bool)parseProlog: (OFString *)line; - (bool)parseHeaders: (OFString *)line; -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadIntoBuffer: (char *)buffer length: (size_t)length context: (id)context exception: (id)exception; - (bool)sendErrorAndClose: (short)statusCode; - (void)createResponse; @end @implementation OFHTTPServer_Connection -- (instancetype)initWithSocket: (OFTCPSocket *)socket +- (instancetype)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) { @@ -396,11 +396,11 @@ [_body release]; [super dealloc]; } -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadLine: (OFString *)line context: (id)context exception: (id)exception { if (line == nil || exception != nil) @@ -575,17 +575,17 @@ } return true; } -- (bool)socket: (OFTCPSocket *)socket +- (bool)socket: (OFTCPSocket *)sock didReadIntoBuffer: (char *)buffer length: (size_t)length context: (id)context exception: (id)exception { - if ([socket isAtEndOfStream] || exception != nil) + if ([sock isAtEndOfStream] || exception != nil) return false; [_body addItems: buffer count: length]; @@ -741,11 +741,11 @@ [_listeningSocket cancelAsyncRequests]; [_listeningSocket release]; _listeningSocket = nil; } -- (bool)of_socket: (OFTCPSocket *)socket +- (bool)of_socket: (OFTCPSocket *)sock didAcceptSocket: (OFTCPSocket *)clientSocket context: (id)context exception: (id)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/OFInvocation.m ================================================================== --- src/OFInvocation.m +++ src/OFInvocation.m @@ -84,21 +84,21 @@ [super dealloc]; } - (void)setArgument: (const void *)buffer - atIndex: (size_t)index + atIndex: (size_t)idx { - OFMutableData *data = [_arguments objectAtIndex: index]; + OFMutableData *data = [_arguments objectAtIndex: idx]; memcpy([data items], buffer, [data itemSize]); } - (void)getArgument: (void *)buffer - atIndex: (size_t)index + atIndex: (size_t)idx { - OFData *data = [_arguments objectAtIndex: index]; + OFData *data = [_arguments objectAtIndex: idx]; memcpy(buffer, [data items], [data itemSize]); } - (void)setReturnValue: (const void *)buffer Index: src/OFMethodSignature.m ================================================================== --- src/OFMethodSignature.m +++ src/OFMethodSignature.m @@ -634,15 +634,15 @@ - (size_t)frameLength { return *(size_t *)[_offsets firstItem]; } -- (const char *)argumentTypeAtIndex: (size_t)index +- (const char *)argumentTypeAtIndex: (size_t)idx { - return *(const char **)[_typesPointers itemAtIndex: index + 1]; + return *(const char **)[_typesPointers itemAtIndex: idx + 1]; } -- (size_t)argumentOffsetAtIndex: (size_t)index +- (size_t)argumentOffsetAtIndex: (size_t)idx { - return *(size_t *)[_offsets itemAtIndex: index + 1]; + return *(size_t *)[_offsets itemAtIndex: idx + 1]; } @end Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -267,35 +267,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 @@ -334,11 +334,11 @@ return; } } } -- (void)removeObjectAtIndex: (size_t)index +- (void)removeObjectAtIndex: (size_t)idx { OF_UNRECOGNIZED_SELECTOR } - (void)removeObject: (id)object @@ -399,32 +399,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,15 +207,15 @@ return; } } } -- (void)removeObjectAtIndex: (size_t)index +- (void)removeObjectAtIndex: (size_t)idx { #ifndef __clang_analyzer__ - id object = [self objectAtIndex: index]; - [_array removeItemAtIndex: index]; + id object = [self objectAtIndex: idx]; + [_array removeItemAtIndex: idx]; [object release]; _mutations++; #endif } @@ -270,23 +270,23 @@ _mutations++; #endif } -- (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,26 +198,26 @@ 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)increaseCountBy: (size_t)count @@ -234,13 +234,13 @@ memset(_items + _count * _itemSize, '\0', 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; } @@ -165,86 +165,86 @@ + (instancetype)numberWithBool: (bool)bool_; /*! * @brief Creates a new OFNumber with the specified signed char. * - * @param schar A signed char which the OFNumber should contain + * @param sChar A signed char which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithChar: (signed char)schar; ++ (instancetype)numberWithChar: (signed char)sChar; /*! * @brief Creates a new OFNumber with the specified signed short. * - * @param sshort A signed short which the OFNumber should contain + * @param sShort A signed short which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithShort: (signed short)sshort; ++ (instancetype)numberWithShort: (signed short)sShort; /*! * @brief Creates a new OFNumber with the specified signed int. * - * @param sint A signed int which the OFNumber should contain + * @param sInt A signed int which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithInt: (signed int)sint; ++ (instancetype)numberWithInt: (signed int)sInt; /*! * @brief Creates a new OFNumber with the specified signed long. * - * @param slong A signed long which the OFNumber should contain + * @param sLong A signed long which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithLong: (signed long)slong; ++ (instancetype)numberWithLong: (signed long)sLong; /*! * @brief Creates a new OFNumber with the specified signed long long. * - * @param slonglong A signed long long which the OFNumber should contain + * @param sLongLong A signed long long which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithLongLong: (signed long long)slonglong; ++ (instancetype)numberWithLongLong: (signed long long)sLongLong; /*! * @brief Creates a new OFNumber with the specified unsigned char. * - * @param uchar An unsigned char which the OFNumber should contain + * @param uChar An unsigned char which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUnsignedChar: (unsigned char)uchar; ++ (instancetype)numberWithUnsignedChar: (unsigned char)uChar; /*! * @brief Creates a new OFNumber with the specified unsigned short. * - * @param ushort An unsigned short which the OFNumber should contain + * @param uShort An unsigned short which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUnsignedShort: (unsigned short)ushort; ++ (instancetype)numberWithUnsignedShort: (unsigned short)uShort; /*! * @brief Creates a new OFNumber with the specified unsigned int. * - * @param uint An unsigned int which the OFNumber should contain + * @param uInt An unsigned int which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUnsignedInt: (unsigned int)uint; ++ (instancetype)numberWithUnsignedInt: (unsigned int)uInt; /*! * @brief Creates a new OFNumber with the specified unsigned long. * - * @param ulong An unsigned long which the OFNumber should contain + * @param uLong An unsigned long which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUnsignedLong: (unsigned long)ulong; ++ (instancetype)numberWithUnsignedLong: (unsigned long)uLong; /*! * @brief Creates a new OFNumber with the specified unsigned long long. * - * @param ulonglong An unsigned long long which the OFNumber should contain + * @param uLongLong An unsigned long long which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUnsignedLongLong: (unsigned long long)ulonglong; ++ (instancetype)numberWithUnsignedLongLong: (unsigned long long)uLongLong; /*! * @brief Creates a new OFNumber with the specified int8_t. * * @param int8 An int8_t which the OFNumber should contain @@ -277,38 +277,38 @@ + (instancetype)numberWithInt64: (int64_t)int64; /*! * @brief Creates a new OFNumber with the specified uint8_t. * - * @param uint8 A uint8_t which the OFNumber should contain + * @param uInt8 A uint8_t which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUInt8: (uint8_t)uint8; ++ (instancetype)numberWithUInt8: (uint8_t)uInt8; /*! * @brief Creates a new OFNumber with the specified uint16_t. * - * @param uint16 A uint16_t which the OFNumber should contain + * @param uInt16 A uint16_t which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUInt16: (uint16_t)uint16; ++ (instancetype)numberWithUInt16: (uint16_t)uInt16; /*! * @brief Creates a new OFNumber with the specified uint32_t. * - * @param uint32 A uint32_t which the OFNumber should contain + * @param uInt32 A uint32_t which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUInt32: (uint32_t)uint32; ++ (instancetype)numberWithUInt32: (uint32_t)uInt32; /*! * @brief Creates a new OFNumber with the specified uint64_t. * - * @param uint64 A uint64_t which the OFNumber should contain + * @param uInt64 A uint64_t which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUInt64: (uint64_t)uint64; ++ (instancetype)numberWithUInt64: (uint64_t)uInt64; /*! * @brief Creates a new OFNumber with the specified size_t. * * @param size A size_t which the OFNumber should contain @@ -317,54 +317,54 @@ + (instancetype)numberWithSize: (size_t)size; /*! * @brief Creates a new OFNumber with the specified ssize_t. * - * @param ssize An ssize_t which the OFNumber should contain + * @param sSize An ssize_t which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithSSize: (ssize_t)ssize; ++ (instancetype)numberWithSSize: (ssize_t)sSize; /*! * @brief Creates a new OFNumber with the specified intmax_t. * - * @param intmax An intmax_t which the OFNumber should contain + * @param intMax An intmax_t which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithIntMax: (intmax_t)intmax; ++ (instancetype)numberWithIntMax: (intmax_t)intMax; /*! * @brief Creates a new OFNumber with the specified uintmax_t. * - * @param uintmax A uintmax_t which the OFNumber should contain + * @param uIntMax A uintmax_t which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUIntMax: (uintmax_t)uintmax; ++ (instancetype)numberWithUIntMax: (uintmax_t)uIntMax; /*! * @brief Creates a new OFNumber with the specified ptrdiff_t. * - * @param ptrdiff A ptrdiff_t which the OFNumber should contain + * @param ptrDiff A ptrdiff_t which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithPtrDiff: (ptrdiff_t)ptrdiff; ++ (instancetype)numberWithPtrDiff: (ptrdiff_t)ptrDiff; /*! * @brief Creates a new OFNumber with the specified intptr_t. * - * @param intptr An intptr_t which the OFNumber should contain + * @param intPtr An intptr_t which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithIntPtr: (intptr_t)intptr; ++ (instancetype)numberWithIntPtr: (intptr_t)intPtr; /*! * @brief Creates a new OFNumber with the specified uintptr_t. * - * @param uintptr A uintptr_t which the OFNumber should contain + * @param uIntPtr A uintptr_t which the OFNumber should contain * @return A new autoreleased OFNumber */ -+ (instancetype)numberWithUIntPtr: (uintptr_t)uintptr; ++ (instancetype)numberWithUIntPtr: (uintptr_t)uIntPtr; /*! * @brief Creates a new OFNumber with the specified float. * * @param float_ A float which the OFNumber should contain @@ -392,95 +392,95 @@ /*! * @brief Initializes an already allocated OFNumber with the specified signed * char. * - * @param schar A signed char which the OFNumber should contain + * @param sChar A signed char which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithChar: (signed char)schar; +- (instancetype)initWithChar: (signed char)sChar; /*! * @brief Initializes an already allocated OFNumber with the specified signed * short. * - * @param sshort A signed short which the OFNumber should contain + * @param sShort A signed short which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithShort: (signed short)sshort; +- (instancetype)initWithShort: (signed short)sShort; /*! * @brief Initializes an already allocated OFNumber with the specified signed * int. * - * @param sint A signed int which the OFNumber should contain + * @param sInt A signed int which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithInt: (signed int)sint; +- (instancetype)initWithInt: (signed int)sInt; /*! * @brief Initializes an already allocated OFNumber with the specified signed * long. * - * @param slong A signed long which the OFNumber should contain + * @param sLong A signed long which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithLong: (signed long)slong; +- (instancetype)initWithLong: (signed long)sLong; /*! * @brief Initializes an already allocated OFNumber with the specified signed * long long. * - * @param slonglong A signed long long which the OFNumber should contain + * @param sLongLong A signed long long which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithLongLong: (signed long long)slonglong; +- (instancetype)initWithLongLong: (signed long long)sLongLong; /*! * @brief Initializes an already allocated OFNumber with the specified unsigned * char. * - * @param uchar An unsigned char which the OFNumber should contain + * @param uChar An unsigned char which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUnsignedChar: (unsigned char)uchar; +- (instancetype)initWithUnsignedChar: (unsigned char)uChar; /*! * @brief Initializes an already allocated OFNumber with the specified unsigned * short. * - * @param ushort An unsigned short which the OFNumber should contain + * @param uShort An unsigned short which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUnsignedShort: (unsigned short)ushort; +- (instancetype)initWithUnsignedShort: (unsigned short)uShort; /*! * @brief Initializes an already allocated OFNumber with the specified unsigned * int. * - * @param uint An unsigned int which the OFNumber should contain + * @param uInt An unsigned int which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUnsignedInt: (unsigned int)uint; +- (instancetype)initWithUnsignedInt: (unsigned int)uInt; /*! * @brief Initializes an already allocated OFNumber with the specified unsigned * long. * - * @param ulong An unsigned long which the OFNumber should contain + * @param uLong An unsigned long which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUnsignedLong: (unsigned long)ulong; +- (instancetype)initWithUnsignedLong: (unsigned long)uLong; /*! * @brief Initializes an already allocated OFNumber with the specified unsigned * long long. * - * @param ulonglong An unsigned long long which the OFNumber should contain + * @param uLongLong An unsigned long long which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUnsignedLongLong: (unsigned long long)ulonglong; +- (instancetype)initWithUnsignedLongLong: (unsigned long long)uLongLong; /*! * @brief Initializes an already allocated OFNumber with the specified int8_t. * * @param int8 An int8_t which the OFNumber should contain @@ -513,38 +513,38 @@ - (instancetype)initWithInt64: (int64_t)int64; /*! * @brief Initializes an already allocated OFNumber with the specified uint8_t. * - * @param uint8 A uint8_t which the OFNumber should contain + * @param uInt8 A uint8_t which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUInt8: (uint8_t)uint8; +- (instancetype)initWithUInt8: (uint8_t)uInt8; /*! * @brief Initializes an already allocated OFNumber with the specified uint16_t. * - * @param uint16 A uint16_t which the OFNumber should contain + * @param uInt16 A uint16_t which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUInt16: (uint16_t)uint16; +- (instancetype)initWithUInt16: (uint16_t)uInt16; /*! * @brief Initializes an already allocated OFNumber with the specified uint32_t. * - * @param uint32 A uint32_t which the OFNumber should contain + * @param uInt32 A uint32_t which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUInt32: (uint32_t)uint32; +- (instancetype)initWithUInt32: (uint32_t)uInt32; /*! * @brief Initializes an already allocated OFNumber with the specified uint64_t. * - * @param uint64 A uint64_t which the OFNumber should contain + * @param uInt64 A uint64_t which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUInt64: (uint64_t)uint64; +- (instancetype)initWithUInt64: (uint64_t)uInt64; /*! * @brief Initializes an already allocated OFNumber with the specified size_t. * * @param size A size_t which the OFNumber should contain @@ -553,57 +553,57 @@ - (instancetype)initWithSize: (size_t)size; /*! * @brief Initializes an already allocated OFNumber with the specified ssize_t. * - * @param ssize An ssize_t which the OFNumber should contain + * @param sSize An ssize_t which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithSSize: (ssize_t)ssize; +- (instancetype)initWithSSize: (ssize_t)sSize; /*! * @brief Initializes an already allocated OFNumber with the specified intmax_t. * - * @param intmax An intmax_t which the OFNumber should contain + * @param intMax An intmax_t which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithIntMax: (intmax_t)intmax; +- (instancetype)initWithIntMax: (intmax_t)intMax; /*! * @brief Initializes an already allocated OFNumber with the specified * uintmax_t. * - * @param uintmax A uintmax_t which the OFNumber should contain + * @param uIntMax A uintmax_t which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUIntMax: (uintmax_t)uintmax; +- (instancetype)initWithUIntMax: (uintmax_t)uIntMax; /*! * @brief Initializes an already allocated OFNumber with the specified * ptrdiff_t. * - * @param ptrdiff A ptrdiff_t which the OFNumber should contain + * @param ptrDiff A ptrdiff_t which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrdiff; +- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrDiff; /*! * @brief Initializes an already allocated OFNumber with the specified intptr_t. * - * @param intptr An intptr_t which the OFNumber should contain + * @param intPtr An intptr_t which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithIntPtr: (intptr_t)intptr; +- (instancetype)initWithIntPtr: (intptr_t)intPtr; /*! * @brief Initializes an already allocated OFNumber with the specified * uintptr_t. * - * @param uintptr A uintptr_t which the OFNumber should contain + * @param uIntPtr A uintptr_t which the OFNumber should contain * @return An initialized OFNumber */ -- (instancetype)initWithUIntPtr: (uintptr_t)uintptr; +- (instancetype)initWithUIntPtr: (uintptr_t)uIntPtr; /*! * @brief Initializes an already allocated OFNumber with the specified float. * * @param float_ A float which the OFNumber should contain 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]; @@ -172,63 +172,63 @@ + (instancetype)numberWithInt64: (int64_t)int64 { return [[[self alloc] initWithInt64: int64] autorelease]; } -+ (instancetype)numberWithUInt8: (uint8_t)uint8 -{ - return [[[self alloc] initWithUInt8: uint8] autorelease]; -} - -+ (instancetype)numberWithUInt16: (uint16_t)uint16 -{ - return [[[self alloc] initWithUInt16: uint16] autorelease]; -} - -+ (instancetype)numberWithUInt32: (uint32_t)uint32 -{ - return [[[self alloc] initWithUInt32: uint32] autorelease]; -} - -+ (instancetype)numberWithUInt64: (uint64_t)uint64 -{ - return [[[self alloc] initWithUInt64: uint64] autorelease]; ++ (instancetype)numberWithUInt8: (uint8_t)uInt8 +{ + return [[[self alloc] initWithUInt8: uInt8] autorelease]; +} + ++ (instancetype)numberWithUInt16: (uint16_t)uInt16 +{ + return [[[self alloc] initWithUInt16: uInt16] autorelease]; +} + ++ (instancetype)numberWithUInt32: (uint32_t)uInt32 +{ + return [[[self alloc] initWithUInt32: uInt32] autorelease]; +} + ++ (instancetype)numberWithUInt64: (uint64_t)uInt64 +{ + 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; } -- (instancetype)initWithChar: (signed char)schar +- (instancetype)initWithChar: (signed char)sChar { self = [super init]; - _value.schar = schar; + _value.sChar = sChar; _type = OF_NUMBER_TYPE_CHAR; return self; } -- (instancetype)initWithShort: (signed short)sshort +- (instancetype)initWithShort: (signed short)sShort { self = [super init]; - _value.sshort = sshort; + _value.sShort = sShort; _type = OF_NUMBER_TYPE_SHORT; return self; } -- (instancetype)initWithInt: (signed int)sint +- (instancetype)initWithInt: (signed int)sInt { self = [super init]; - _value.sint = sint; + _value.sInt = sInt; _type = OF_NUMBER_TYPE_INT; return self; } -- (instancetype)initWithLong: (signed long)slong +- (instancetype)initWithLong: (signed long)sLong { self = [super init]; - _value.slong = slong; + _value.sLong = sLong; _type = OF_NUMBER_TYPE_LONG; return self; } -- (instancetype)initWithLongLong: (signed long long)slonglong +- (instancetype)initWithLongLong: (signed long long)sLongLong { self = [super init]; - _value.slonglong = slonglong; + _value.sLongLong = sLongLong; _type = OF_NUMBER_TYPE_LONGLONG; return self; } -- (instancetype)initWithUnsignedChar: (unsigned char)uchar +- (instancetype)initWithUnsignedChar: (unsigned char)uChar { self = [super init]; - _value.uchar = uchar; + _value.uChar = uChar; _type = OF_NUMBER_TYPE_UCHAR; return self; } -- (instancetype)initWithUnsignedShort: (unsigned short)ushort +- (instancetype)initWithUnsignedShort: (unsigned short)uShort { self = [super init]; - _value.ushort = ushort; + _value.uShort = uShort; _type = OF_NUMBER_TYPE_USHORT; return self; } -- (instancetype)initWithUnsignedInt: (unsigned int)uint +- (instancetype)initWithUnsignedInt: (unsigned int)uInt { self = [super init]; - _value.uint = uint; + _value.uInt = uInt; _type = OF_NUMBER_TYPE_UINT; return self; } -- (instancetype)initWithUnsignedLong: (unsigned long)ulong +- (instancetype)initWithUnsignedLong: (unsigned long)uLong { self = [super init]; - _value.ulong = ulong; + _value.uLong = uLong; _type = OF_NUMBER_TYPE_ULONG; return self; } -- (instancetype)initWithUnsignedLongLong: (unsigned long long)ulonglong +- (instancetype)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; } -- (instancetype)initWithUInt8: (uint8_t)uint8 +- (instancetype)initWithUInt8: (uint8_t)uInt8 { self = [super init]; - _value.uint8 = uint8; + _value.uInt8 = uInt8; _type = OF_NUMBER_TYPE_UINT8; return self; } -- (instancetype)initWithUInt16: (uint16_t)uint16 +- (instancetype)initWithUInt16: (uint16_t)uInt16 { self = [super init]; - _value.uint16 = uint16; + _value.uInt16 = uInt16; _type = OF_NUMBER_TYPE_UINT16; return self; } -- (instancetype)initWithUInt32: (uint32_t)uint32 +- (instancetype)initWithUInt32: (uint32_t)uInt32 { self = [super init]; - _value.uint32 = uint32; + _value.uInt32 = uInt32; _type = OF_NUMBER_TYPE_UINT32; return self; } -- (instancetype)initWithUInt64: (uint64_t)uint64 +- (instancetype)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; } -- (instancetype)initWithSSize: (ssize_t)ssize +- (instancetype)initWithSSize: (ssize_t)sSize { self = [super init]; - _value.ssize = ssize; + _value.sSize = sSize; _type = OF_NUMBER_TYPE_SSIZE; return self; } -- (instancetype)initWithIntMax: (intmax_t)intmax +- (instancetype)initWithIntMax: (intmax_t)intMax { self = [super init]; - _value.intmax = intmax; + _value.intMax = intMax; _type = OF_NUMBER_TYPE_INTMAX; return self; } -- (instancetype)initWithUIntMax: (uintmax_t)uintmax +- (instancetype)initWithUIntMax: (uintmax_t)uIntMax { self = [super init]; - _value.uintmax = uintmax; + _value.uIntMax = uIntMax; _type = OF_NUMBER_TYPE_UINTMAX; return self; } -- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrdiff +- (instancetype)initWithPtrDiff: (ptrdiff_t)ptrDiff { self = [super init]; - _value.ptrdiff = ptrdiff; + _value.ptrDiff = ptrDiff; _type = OF_NUMBER_TYPE_PTRDIFF; return self; } -- (instancetype)initWithIntPtr: (intptr_t)intptr +- (instancetype)initWithIntPtr: (intptr_t)intPtr { self = [super init]; - _value.intptr = intptr; + _value.intPtr = intPtr; _type = OF_NUMBER_TYPE_INTPTR; return self; } -- (instancetype)initWithUIntPtr: (uintptr_t)uintptr +- (instancetype)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 @@ -601,35 +601,35 @@ queueItem->_selector = selector; queueItem->_context = [context retain]; }) } -+ (void)of_addAsyncReceiveForUDPSocket: (OFUDPSocket *)socket ++ (void)of_addAsyncReceiveForUDPSocket: (OFUDPSocket *)sock buffer: (void *)buffer length: (size_t)length target: (id)target selector: (SEL)selector context: (id)context { - ADD_READ(OFRunLoop_UDPReceiveQueueItem, socket, { + ADD_READ(OFRunLoop_UDPReceiveQueueItem, sock, { queueItem->_target = [target retain]; queueItem->_selector = selector; queueItem->_context = [context retain]; queueItem->_buffer = buffer; queueItem->_length = length; }) } -+ (void)of_addAsyncSendForUDPSocket: (OFUDPSocket *)socket ++ (void)of_addAsyncSendForUDPSocket: (OFUDPSocket *)sock buffer: (const void *)buffer length: (size_t)length receiver: (of_udp_socket_address_t)receiver target: (id)target selector: (SEL)selector context: (id)context { - ADD_WRITE(OFRunLoop_UDPSendQueueItem, socket, { + ADD_WRITE(OFRunLoop_UDPSendQueueItem, sock, { queueItem->_target = [target retain]; queueItem->_selector = selector; queueItem->_context = [context retain]; queueItem->_buffer = buffer; queueItem->_length = length; @@ -690,30 +690,30 @@ 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->_block = [block copy]; queueItem->_buffer = buffer; queueItem->_length = length; }) } -+ (void)of_addAsyncSendForUDPSocket: (OFUDPSocket *)socket ++ (void)of_addAsyncSendForUDPSocket: (OFUDPSocket *)sock buffer: (const void *)buffer length: (size_t)length receiver: (of_udp_socket_address_t)receiver block: (of_udp_socket_async_send_block_t)block { - ADD_WRITE(OFRunLoop_UDPSendQueueItem, socket, { + ADD_WRITE(OFRunLoop_UDPSendQueueItem, sock, { queueItem->_block = [block copy]; queueItem->_buffer = buffer; queueItem->_length = length; queueItem->_receiver = receiver; }) Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1451,11 +1451,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 - (instancetype)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 @@ -80,29 +80,29 @@ # endif id _exception; } - (instancetype)initWithSourceThread: (OFThread *)sourceThread - socket: (OFTCPSocket *)socket + socket: (OFTCPSocket *)sock host: (OFString *)host port: (uint16_t)port target: (id)target selector: (SEL)selector context: (id)context; # ifdef OF_HAVE_BLOCKS - (instancetype)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; # endif @end @implementation OFTCPSocket_ConnectThread - (instancetype)initWithSourceThread: (OFThread *)sourceThread - socket: (OFTCPSocket *)socket + socket: (OFTCPSocket *)sock host: (OFString *)host port: (uint16_t)port target: (id)target selector: (SEL)selector context: (id)context @@ -109,11 +109,11 @@ { self = [super init]; @try { _sourceThread = [sourceThread retain]; - _socket = [socket retain]; + _socket = [sock retain]; _host = [host copy]; _port = port; _target = [target retain]; _selector = selector; _context = [context retain]; @@ -125,20 +125,20 @@ return self; } # ifdef OF_HAVE_BLOCKS - (instancetype)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/OFTarArchive.m ================================================================== --- src/OFTarArchive.m +++ src/OFTarArchive.m @@ -297,12 +297,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 = [_stream readIntoBuffer: buffer @@ -376,11 +378,11 @@ size = [_entry size]; if (size % 512 != 0) [_stream readIntoBuffer: buffer - exactLength: 512 - (size % 512)]; + exactLength: (size_t)(512 - (size % 512))]; } } @end @implementation OFTarArchive_FileWriteStream Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -528,11 +528,11 @@ id object4 = [[_object4 retain] autorelease]; OF_ENSURE(_arguments <= 4); if (_repeats && _valid) { - int missedIntervals = + int64_t missedIntervals = -[_fireDate timeIntervalSinceNow] / _interval; of_time_interval_t newFireDate; /* In case the clock was changed backwards */ if (missedIntervals < 0) Index: src/OFUDPSocket.m ================================================================== --- src/OFUDPSocket.m +++ src/OFUDPSocket.m @@ -182,13 +182,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; @@ -201,33 +201,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: @@ -239,13 +239,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; @@ -257,29 +257,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 @@ -789,12 +789,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 @@ -848,12 +850,16 @@ - (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { size_t bytesWritten; - if ((sizeof(length) >= sizeof(int64_t) && length > INT64_MAX) || - INT64_MAX - _bytesWritten < (int64_t)length) +#if SIZE_MAX >= INT64_MAX + if (length > INT64_MAX) + @throw [OFOutOfRangeException exception]; +#endif + + if (INT64_MAX - _bytesWritten < (int64_t)length) @throw [OFOutOfRangeException exception]; bytesWritten = [_stream writeBuffer: buffer length: length]; Index: src/bridge/NSArray+OFObject.h ================================================================== --- src/bridge/NSArray+OFObject.h +++ src/bridge/NSArray+OFObject.h @@ -16,11 +16,11 @@ #import #import "NSBridging.h" -NS_ASSUME_NONNULL_BEGIN +OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _NSArray_OFObject_reference; @@ -35,6 +35,6 @@ * @brief Support for bridging NSArrays to OFArrays. */ @interface NSArray (OFObject) @end -NS_ASSUME_NONNULL_END +OF_ASSUME_NONNULL_END Index: src/bridge/NSArray_OFArray.h ================================================================== --- src/bridge/NSArray_OFArray.h +++ src/bridge/NSArray_OFArray.h @@ -14,18 +14,20 @@ * file. */ #import +#import "macros.h" + @class OFArray; -NS_ASSUME_NONNULL_BEGIN +OF_ASSUME_NONNULL_BEGIN @interface NSArray_OFArray: NSArray { OFArray *_array; } - (instancetype)initWithOFArray: (OFArray *)array; @end -NS_ASSUME_NONNULL_END +OF_ASSUME_NONNULL_END 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,11 @@ #import #import "NSBridging.h" -NS_ASSUME_NONNULL_BEGIN +OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _NSDictionary_OFObject_reference; @@ -35,6 +35,6 @@ * @brief Support for bridging NSDictionaries to OFDictionaries. */ @interface NSDictionary (OFObject) @end -NS_ASSUME_NONNULL_END +OF_ASSUME_NONNULL_END Index: src/bridge/NSDictionary_OFDictionary.h ================================================================== --- src/bridge/NSDictionary_OFDictionary.h +++ src/bridge/NSDictionary_OFDictionary.h @@ -13,19 +13,21 @@ * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import + +#import "macros.h" @class OFDictionary; -NS_ASSUME_NONNULL_BEGIN +OF_ASSUME_NONNULL_BEGIN @interface NSDictionary_OFDictionary: NSDictionary { OFDictionary *_dictionary; } - (instancetype)initWithOFDictionary: (OFDictionary *)dictionary; @end -NS_ASSUME_NONNULL_END +OF_ASSUME_NONNULL_END Index: src/bridge/NSString+OFObject.h ================================================================== --- src/bridge/NSString+OFObject.h +++ src/bridge/NSString+OFObject.h @@ -16,11 +16,11 @@ #import #import "NSBridging.h" -NS_ASSUME_NONNULL_BEGIN +OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif extern int _NSString_OFObject_reference; @@ -39,6 +39,6 @@ * character of OFString is 4). */ @interface NSString (OFObject) @end -NS_ASSUME_NONNULL_END +OF_ASSUME_NONNULL_END 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 @@ -753,25 +753,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/OFInvocationTests.m ================================================================== --- tests/OFInvocationTests.m +++ tests/OFInvocationTests.m @@ -102,12 +102,12 @@ : (float)f13 : (float)f14 : (float)f15 : (float)f16 { - return (d1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + d10 + f11 + - f12 + f13 + f14 + f15 + f16) / 16; + return (float)((d1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + d10 + f11 + + f12 + f13 + f14 + f15 + f16) / 16); } - (long double)invocationTestMethod5: (long double)d1 : (long double)d2 : (long double)d3 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 @@ -498,17 +498,17 @@ [self performSelector: @selector(downloadNextURL) afterDelay: 0]; } - (void)client: (OFHTTPClient *)client - didCreateSocket: (OF_KINDOF(OFTCPSocket *))socket + didCreateSocket: (OF_KINDOF(OFTCPSocket *))sock request: (OFHTTPRequest *)request context: (id)context { - 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++)