Index: src/OFDate.h ================================================================== --- src/OFDate.h +++ src/OFDate.h @@ -44,86 +44,86 @@ #endif /** * @brief The microsecond of the date. */ -@property (readonly, nonatomic) uint32_t microsecond; +@property (readonly, nonatomic) unsigned long microsecond; /** * @brief The second of the date. */ -@property (readonly, nonatomic) uint8_t second; +@property (readonly, nonatomic) unsigned char second; /** * @brief The minute of the date. */ -@property (readonly, nonatomic) uint8_t minute; +@property (readonly, nonatomic) unsigned char minute; /** * @brief The minute of the date in local time. */ -@property (readonly, nonatomic) uint8_t localMinute; +@property (readonly, nonatomic) unsigned char localMinute; /** * @brief The hour of the date. */ -@property (readonly, nonatomic) uint8_t hour; +@property (readonly, nonatomic) unsigned char hour; /** * @brief The hour of the date in local time. */ -@property (readonly, nonatomic) uint8_t localHour; +@property (readonly, nonatomic) unsigned char localHour; /** * @brief The day of the month of the date. */ -@property (readonly, nonatomic) uint8_t dayOfMonth; +@property (readonly, nonatomic) unsigned char dayOfMonth; /** * @brief The day of the month of the date in local time. */ -@property (readonly, nonatomic) uint8_t localDayOfMonth; +@property (readonly, nonatomic) unsigned char localDayOfMonth; /** * @brief The month of the year of the date. */ -@property (readonly, nonatomic) uint8_t monthOfYear; +@property (readonly, nonatomic) unsigned char monthOfYear; /** * @brief The month of the year of the date in local time. */ -@property (readonly, nonatomic) uint8_t localMonthOfYear; +@property (readonly, nonatomic) unsigned char localMonthOfYear; /** * @brief The year of the date. */ -@property (readonly, nonatomic) uint16_t year; +@property (readonly, nonatomic) unsigned short year; /** * @brief The year of the date in local time. */ -@property (readonly, nonatomic) uint16_t localYear; +@property (readonly, nonatomic) unsigned short localYear; /** * @brief The day of the week of the date. */ -@property (readonly, nonatomic) uint8_t dayOfWeek; +@property (readonly, nonatomic) unsigned char dayOfWeek; /** * @brief The day of the week of the date in local time. */ -@property (readonly, nonatomic) uint8_t localDayOfWeek; +@property (readonly, nonatomic) unsigned char localDayOfWeek; /** * @brief The day of the year of the date. */ -@property (readonly, nonatomic) uint16_t dayOfYear; +@property (readonly, nonatomic) unsigned short dayOfYear; /** * @brief The day of the year of the date in local time. */ -@property (readonly, nonatomic) uint16_t localDayOfYear; +@property (readonly, nonatomic) unsigned short localDayOfYear; /** * @brief The seconds since 1970-01-01T00:00:00Z. */ @property (readonly, nonatomic) of_time_interval_t timeIntervalSince1970; Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -221,11 +221,11 @@ 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, }; static double -tmAndTzToTime(struct tm *tm, int16_t *tz) +tmAndTzToTime(const struct tm *tm, short tz) { double seconds; /* Years */ seconds = (int64_t)(tm->tm_year - 70) * 31536000; @@ -249,11 +249,11 @@ /* Minutes */ seconds += tm->tm_min * 60; /* Seconds */ seconds += tm->tm_sec; /* Time zone */ - seconds += -(double)*tz * 60; + seconds += -(double)tz * 60; return seconds; } @implementation OFDateSingleton @@ -440,40 +440,40 @@ format: (OFString *)format { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; - int16_t tz = 0; + short tz = 0; if (of_strptime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; objc_autoreleasePoolPop(pool); - return [self initWithTimeIntervalSince1970: tmAndTzToTime(&tm, &tz)]; + return [self initWithTimeIntervalSince1970: tmAndTzToTime(&tm, tz)]; } - (instancetype)initWithLocalDateString: (OFString *)string format: (OFString *)format { void *pool = objc_autoreleasePoolPush(); const char *UTF8String = string.UTF8String; struct tm tm = { .tm_isdst = -1 }; /* - * of_strptime() can never set this to INT16_MAX, no matter what is + * of_strptime() can never set this to SHRT_MAX, no matter what is * passed to it, so this is a safe way to figure out if the date * contains a time zone. */ - int16_t tz = INT16_MAX; + short tz = SHRT_MAX; of_time_interval_t seconds; if (of_strptime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; - if (tz == INT16_MAX) { + if (tz == SHRT_MAX) { #ifdef OF_WINDOWS if (func__mktime64 != NULL) { if ((seconds = func__mktime64(&tm)) == -1) @throw [OFInvalidFormatException exception]; } else { @@ -482,11 +482,11 @@ @throw [OFInvalidFormatException exception]; #ifdef OF_WINDOWS } #endif } else - seconds = tmAndTzToTime(&tm, &tz); + seconds = tmAndTzToTime(&tm, tz); objc_autoreleasePoolPop(pool); return [self initWithTimeIntervalSince1970: seconds]; } @@ -656,88 +656,88 @@ objc_autoreleasePoolPop(pool); return [ret autorelease]; } -- (uint32_t)microsecond +- (unsigned long)microsecond { of_time_interval_t timeInterval = self.timeIntervalSince1970; - return (uint32_t)((timeInterval - trunc(timeInterval)) * 1000000); + return (unsigned long)((timeInterval - trunc(timeInterval)) * 1000000); } -- (uint8_t)second +- (unsigned char)second { GMTIME_RET(tm_sec) } -- (uint8_t)minute +- (unsigned char)minute { GMTIME_RET(tm_min) } -- (uint8_t)localMinute +- (unsigned char)localMinute { LOCALTIME_RET(tm_min) } -- (uint8_t)hour +- (unsigned char)hour { GMTIME_RET(tm_hour) } -- (uint8_t)localHour +- (unsigned char)localHour { LOCALTIME_RET(tm_hour) } -- (uint8_t)dayOfMonth +- (unsigned char)dayOfMonth { GMTIME_RET(tm_mday) } -- (uint8_t)localDayOfMonth +- (unsigned char)localDayOfMonth { LOCALTIME_RET(tm_mday) } -- (uint8_t)monthOfYear +- (unsigned char)monthOfYear { GMTIME_RET(tm_mon + 1) } -- (uint8_t)localMonthOfYear +- (unsigned char)localMonthOfYear { LOCALTIME_RET(tm_mon + 1) } -- (uint16_t)year +- (unsigned short)year { GMTIME_RET(tm_year + 1900) } -- (uint16_t)localYear +- (unsigned short)localYear { LOCALTIME_RET(tm_year + 1900) } -- (uint8_t)dayOfWeek +- (unsigned char)dayOfWeek { GMTIME_RET(tm_wday) } -- (uint8_t)localDayOfWeek +- (unsigned char)localDayOfWeek { LOCALTIME_RET(tm_wday) } -- (uint16_t)dayOfYear +- (unsigned short)dayOfYear { GMTIME_RET(tm_yday + 1) } -- (uint16_t)localDayOfYear +- (unsigned short)localDayOfYear { LOCALTIME_RET(tm_yday + 1) } - (OFString *)dateStringWithFormat: (OFConstantString *)format Index: src/OFHTTPRequest.h ================================================================== --- src/OFHTTPRequest.h +++ src/OFHTTPRequest.h @@ -57,13 +57,13 @@ * * @brief The HTTP version of the HTTP request. */ struct OF_BOXABLE of_http_request_protocol_version_t { /** The major of the HTTP version */ - uint8_t major; + unsigned char major; /** The minor of the HTTP version */ - uint8_t minor; + unsigned char minor; }; typedef struct of_http_request_protocol_version_t of_http_request_protocol_version_t; /** Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -206,11 +206,11 @@ - (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion { if (protocolVersion.major != 1 || protocolVersion.minor > 1) @throw [OFUnsupportedVersionException exceptionWithVersion: - [OFString stringWithFormat: @"%u.%u", + [OFString stringWithFormat: @"%hhu.%hhu", protocolVersion.major, protocolVersion.minor]]; _protocolVersion = protocolVersion; } @@ -231,24 +231,24 @@ @throw [OFInvalidFormatException exception]; major = [components.firstObject unsignedLongLongValue]; minor = [components.lastObject unsignedLongLongValue]; - if (major > UINT8_MAX || minor > UINT8_MAX) + if (major > UCHAR_MAX || minor > UCHAR_MAX) @throw [OFOutOfRangeException exception]; - protocolVersion.major = (uint8_t)major; - protocolVersion.minor = (uint8_t)minor; + protocolVersion.major = (unsigned char)major; + protocolVersion.minor = (unsigned char)minor; self.protocolVersion = protocolVersion; objc_autoreleasePoolPop(pool); } - (OFString *)protocolVersionString { - return [OFString stringWithFormat: @"%u.%u", + return [OFString stringWithFormat: @"%hhu.%hhu", _protocolVersion.major, _protocolVersion.minor]; } - (OFString *)description Index: src/OFHTTPResponse.m ================================================================== --- src/OFHTTPResponse.m +++ src/OFHTTPResponse.m @@ -253,11 +253,11 @@ - (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion { if (protocolVersion.major != 1 || protocolVersion.minor > 1) @throw [OFUnsupportedVersionException exceptionWithVersion: - [OFString stringWithFormat: @"%u.%u", + [OFString stringWithFormat: @"%hhu.%hhu", protocolVersion.major, protocolVersion.minor]]; _protocolVersion = protocolVersion; } @@ -278,24 +278,24 @@ @throw [OFInvalidFormatException exception]; major = [components.firstObject unsignedLongLongValue]; minor = [components.lastObject unsignedLongLongValue]; - if (major > UINT8_MAX || minor > UINT8_MAX) + if (major > UCHAR_MAX || minor > UCHAR_MAX) @throw [OFOutOfRangeException exception]; - protocolVersion.major = (uint8_t)major; - protocolVersion.minor = (uint8_t)minor; + protocolVersion.major = (unsigned char)major; + protocolVersion.minor = (unsigned char)minor; self.protocolVersion = protocolVersion; objc_autoreleasePoolPop(pool); } - (OFString *)protocolVersionString { - return [OFString stringWithFormat: @"%u.%u", + return [OFString stringWithFormat: @"%hhu.%hhu", _protocolVersion.major, _protocolVersion.minor]; } - (OFString *)string Index: src/OFMapTable.h ================================================================== --- src/OFMapTable.h +++ src/OFMapTable.h @@ -75,11 +75,11 @@ @interface OFMapTable: OFObject { of_map_table_functions_t _keyFunctions, _objectFunctions; struct of_map_table_bucket *_Nonnull *_Nullable _buckets; unsigned long _count, _capacity; - uint8_t _rotate; + unsigned char _rotate; unsigned long _mutations; } /** * @brief The key functions used by the map table. Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -48,11 +48,11 @@ OFDate *_fireDate; of_time_interval_t _interval; id _target; id _Nullable _object1, _object2, _object3, _object4; SEL _selector; - uint8_t _arguments; + unsigned char _arguments; bool _repeats; #ifdef OF_HAVE_BLOCKS of_timer_block_t _block; #endif bool _valid; Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -326,11 +326,11 @@ selector: (SEL)selector object: (id)object1 object: (id)object2 object: (id)object3 object: (id)object4 - arguments: (uint8_t)arguments + arguments: (unsigned char)arguments repeats: (bool)repeats OF_METHOD_FAMILY(init) OF_DIRECT { self = [super init]; Index: src/condition.h ================================================================== --- src/condition.h +++ src/condition.h @@ -41,11 +41,11 @@ #elif defined(OF_AMIGAOS) # include typedef struct { struct of_condition_waiting_task { struct Task *task; - uint8_t sigBit; + unsigned char sigBit; struct of_condition_waiting_task *next; } *waitingTasks; } of_condition_t; #endif Index: src/of_strptime.h ================================================================== --- src/of_strptime.h +++ src/of_strptime.h @@ -29,12 +29,12 @@ OF_ASSUME_NONNULL_BEGIN #ifdef __cplusplus extern "C" { #endif -extern const char *of_strptime(const char *buf, const char *fmt, - struct tm *tm, int16_t *tz); +extern const char *of_strptime(const char *buf, const char *fmt, struct tm *tm, + short *tz); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END Index: src/of_strptime.m ================================================================== --- src/of_strptime.m +++ src/of_strptime.m @@ -22,11 +22,11 @@ #include #import "macros.h" const char * -of_strptime(const char *buffer, const char *format, struct tm *tm, int16_t *tz) +of_strptime(const char *buffer, const char *format, struct tm *tm, short *tz) { enum { SEARCH_CONVERSION_SPECIFIER, IN_CONVERSION_SPECIFIER } state = SEARCH_CONVERSION_SPECIFIER; @@ -179,14 +179,14 @@ return NULL; if (tz == NULL) break; - *tz = (((int16_t)b[1] - '0') * 600 + - ((int16_t)b[2] - '0') * 60 + - ((int16_t)b[3] - '0') * 10 + - ((int16_t)b[4] - '0')) * + *tz = (((short)b[1] - '0') * 600 + + ((short)b[2] - '0') * 60 + + ((short)b[3] - '0') * 10 + + ((short)b[4] - '0')) * (b[0] == '-' ? -1 : 1); j += 5; } else if (buffer[j] == 'Z') { if (tz != NULL) Index: src/thread.h ================================================================== --- src/thread.h +++ src/thread.h @@ -39,11 +39,11 @@ struct Task *task; void (*function)(id); id object; struct SignalSemaphore semaphore; struct Task *joinTask; - uint8_t joinSigBit; + unsigned char joinSigBit; bool detached, done; } *of_thread_t; #endif typedef struct of_thread_attr_t {