@@ -266,13 +266,11 @@ [self readIntoBuffer: buffer exactLength: size]; #ifndef OF_BIG_ENDIAN - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP16(buffer[i]); #endif return size; } @@ -284,13 +282,11 @@ [self readIntoBuffer: buffer exactLength: size]; #ifndef OF_BIG_ENDIAN - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP32(buffer[i]); #endif return size; } @@ -302,13 +298,11 @@ [self readIntoBuffer: buffer exactLength: size]; #ifndef OF_BIG_ENDIAN - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP64(buffer[i]); #endif return size; } @@ -320,13 +314,11 @@ [self readIntoBuffer: buffer exactLength: size]; #ifndef OF_FLOAT_BIG_ENDIAN - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP_FLOAT(buffer[i]); #endif return size; } @@ -338,13 +330,11 @@ [self readIntoBuffer: buffer exactLength: size]; #ifndef OF_FLOAT_BIG_ENDIAN - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP_DOUBLE(buffer[i]); #endif return size; } @@ -406,13 +396,11 @@ [self readIntoBuffer: buffer exactLength: size]; #ifdef OF_BIG_ENDIAN - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP16(buffer[i]); #endif return size; } @@ -424,13 +412,11 @@ [self readIntoBuffer: buffer exactLength: size]; #ifdef OF_BIG_ENDIAN - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP32(buffer[i]); #endif return size; } @@ -442,13 +428,11 @@ [self readIntoBuffer: buffer exactLength: size]; #ifdef OF_BIG_ENDIAN - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP64(buffer[i]); #endif return size; } @@ -460,13 +444,11 @@ [self readIntoBuffer: buffer exactLength: size]; #ifdef OF_FLOAT_BIG_ENDIAN - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP_FLOAT(buffer[i]); #endif return size; } @@ -478,13 +460,11 @@ [self readIntoBuffer: buffer exactLength: size]; #ifdef OF_FLOAT_BIG_ENDIAN - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) buffer[i] = OF_BSWAP_DOUBLE(buffer[i]); #endif return size; } @@ -570,17 +550,17 @@ return ret; } - (OFString*)tryReadLineWithEncoding: (of_string_encoding_t)encoding { - size_t i, pageSize, bufferLength, retLength; + size_t pageSize, bufferLength, retLength; char *retCString, *buffer, *readBuffer; OFString *ret; /* Look if there's a line or \0 in our buffer */ if (!_waitingForDelimiter && _readBuffer != NULL) { - for (i = 0; i < _readBufferLength; i++) { + for (size_t i = 0; i < _readBufferLength; i++) { if OF_UNLIKELY (_readBuffer[i] == '\n' || _readBuffer[i] == '\0') { retLength = i; if (i > 0 && _readBuffer[i - 1] == '\r') @@ -636,11 +616,11 @@ bufferLength = [self lowlevelReadIntoBuffer: buffer length: pageSize]; /* Look if there's a newline or \0 */ - for (i = 0; i < bufferLength; i++) { + for (size_t i = 0; i < bufferLength; i++) { if OF_UNLIKELY (buffer[i] == '\n' || buffer[i] == '\0') { retLength = _readBufferLength + i; retCString = [self allocMemoryWithSize: retLength]; @@ -781,11 +761,11 @@ - (OFString*)tryReadTillDelimiter: (OFString*)delimiter encoding: (of_string_encoding_t)encoding { const char *delimiterCString; - size_t i, j, delimiterLength, pageSize, bufferLength, retLength; + size_t j, delimiterLength, pageSize, bufferLength, retLength; char *retCString, *buffer, *readBuffer; OFString *ret; delimiterCString = [delimiter cStringWithEncoding: encoding]; delimiterLength = [delimiter cStringLengthWithEncoding: encoding]; @@ -794,11 +774,11 @@ if (delimiterLength == 0) @throw [OFInvalidArgumentException exception]; /* Look if there's something in our buffer */ if (!_waitingForDelimiter && _readBuffer != NULL) { - for (i = 0; i < _readBufferLength; i++) { + for (size_t i = 0; i < _readBufferLength; i++) { if (_readBuffer[i] != delimiterCString[j++]) j = 0; if (j == delimiterLength || _readBuffer[i] == '\0') { if (_readBuffer[i] == '\0') @@ -850,11 +830,11 @@ bufferLength = [self lowlevelReadIntoBuffer: buffer length: pageSize]; /* Look if there's a delimiter or \0 */ - for (i = 0; i < bufferLength; i++) { + for (size_t i = 0; i < bufferLength; i++) { if (buffer[i] != delimiterCString[j++]) j = 0; if (j == delimiterLength || buffer[i] == '\0') { if (buffer[i] == '\0') @@ -1042,19 +1022,15 @@ #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else - uint16_t *tmp; - - tmp = [self allocMemoryWithSize: sizeof(uint16_t) - count: count]; + uint16_t *tmp = [self allocMemoryWithSize: sizeof(uint16_t) + count: count]; @try { - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP16(buffer[i]); [self writeBuffer: tmp length: size]; } @finally { @@ -1072,19 +1048,15 @@ #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else - uint32_t *tmp; - - tmp = [self allocMemoryWithSize: sizeof(uint32_t) - count: count]; + uint32_t *tmp = [self allocMemoryWithSize: sizeof(uint32_t) + count: count]; @try { - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP32(buffer[i]); [self writeBuffer: tmp length: size]; } @finally { @@ -1102,19 +1074,15 @@ #ifdef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else - uint64_t *tmp; - - tmp = [self allocMemoryWithSize: sizeof(uint64_t) - count: count]; + uint64_t *tmp = [self allocMemoryWithSize: sizeof(uint64_t) + count: count]; @try { - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP64(buffer[i]); [self writeBuffer: tmp length: size]; } @finally { @@ -1132,19 +1100,15 @@ #ifdef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else - float *tmp; - - tmp = [self allocMemoryWithSize: sizeof(float) - count: count]; + float *tmp = [self allocMemoryWithSize: sizeof(float) + count: count]; @try { - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_FLOAT(buffer[i]); [self writeBuffer: tmp length: size]; } @finally { @@ -1162,19 +1126,15 @@ #ifdef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else - double *tmp; - - tmp = [self allocMemoryWithSize: sizeof(double) - count: count]; + double *tmp = [self allocMemoryWithSize: sizeof(double) + count: count]; @try { - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_DOUBLE(buffer[i]); [self writeBuffer: tmp length: size]; } @finally { @@ -1232,19 +1192,15 @@ #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else - uint16_t *tmp; - - tmp = [self allocMemoryWithSize: sizeof(uint16_t) - count: count]; + uint16_t *tmp = [self allocMemoryWithSize: sizeof(uint16_t) + count: count]; @try { - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP16(buffer[i]); [self writeBuffer: tmp length: size]; } @finally { @@ -1262,19 +1218,15 @@ #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else - uint32_t *tmp; - - tmp = [self allocMemoryWithSize: sizeof(uint32_t) - count: count]; + uint32_t *tmp = [self allocMemoryWithSize: sizeof(uint32_t) + count: count]; @try { - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP32(buffer[i]); [self writeBuffer: tmp length: size]; } @finally { @@ -1292,19 +1244,15 @@ #ifndef OF_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else - uint64_t *tmp; - - tmp = [self allocMemoryWithSize: sizeof(uint64_t) - count: count]; + uint64_t *tmp = [self allocMemoryWithSize: sizeof(uint64_t) + count: count]; @try { - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP64(buffer[i]); [self writeBuffer: tmp length: size]; } @finally { @@ -1322,19 +1270,15 @@ #ifndef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else - float *tmp; - - tmp = [self allocMemoryWithSize: sizeof(float) - count: count]; + float *tmp = [self allocMemoryWithSize: sizeof(float) + count: count]; @try { - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_FLOAT(buffer[i]); [self writeBuffer: tmp length: size]; } @finally { @@ -1352,19 +1296,15 @@ #ifndef OF_FLOAT_BIG_ENDIAN [self writeBuffer: buffer length: size]; #else - double *tmp; - - tmp = [self allocMemoryWithSize: sizeof(double) - count: count]; + double *tmp = [self allocMemoryWithSize: sizeof(double) + count: count]; @try { - size_t i; - - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) tmp[i] = OF_BSWAP_DOUBLE(buffer[i]); [self writeBuffer: tmp length: size]; } @finally {