@@ -52,47 +52,41 @@ # define GMTIME_RET(field) \ time_t seconds = (time_t)_seconds; \ struct tm tm; \ \ if (seconds != floor(_seconds)) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ if (gmtime_r(&seconds, &tm) == NULL) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ return tm.field; # define LOCALTIME_RET(field) \ time_t seconds = (time_t)_seconds; \ struct tm tm; \ \ if (seconds != floor(_seconds)) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ if (localtime_r(&seconds, &tm) == NULL) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ return tm.field; #else # ifdef OF_HAVE_THREADS # define GMTIME_RET(field) \ time_t seconds = (time_t)_seconds; \ struct tm *tm; \ \ if (seconds != floor(_seconds)) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ [mutex lock]; \ \ @try { \ if ((tm = gmtime(&seconds)) == NULL) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ return tm->field; \ } @finally { \ [mutex unlock]; \ } @@ -99,19 +93,17 @@ # define LOCALTIME_RET(field) \ time_t seconds = (time_t)_seconds; \ struct tm *tm; \ \ if (seconds != floor(_seconds)) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ [mutex lock]; \ \ @try { \ if ((tm = localtime(&seconds)) == NULL) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ return tm->field; \ } @finally { \ [mutex unlock]; \ } @@ -119,29 +111,25 @@ # define GMTIME_RET(field) \ time_t seconds = (time_t)_seconds; \ struct tm *tm; \ \ if (seconds != floor(_seconds)) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ if ((tm = gmtime(&seconds)) == NULL) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ return tm->field; # define LOCALTIME_RET(field) \ time_t seconds = (time_t)_seconds; \ struct tm *tm; \ \ if (seconds != floor(_seconds)) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ if ((tm = localtime(&seconds)) == NULL) \ - @throw [OFOutOfRangeException \ - exceptionWithClass: [self class]]; \ + @throw [OFOutOfRangeException exception]; \ \ return tm->field; # endif #endif @@ -255,12 +243,11 @@ tm.tm_isdst = -1; if (of_strptime([string UTF8String], [format UTF8String], &tm) == NULL) - @throw [OFInvalidFormatException - exceptionWithClass: [self class]]; + @throw [OFInvalidFormatException exception]; /* Years */ _seconds = (int64_t)(tm.tm_year - 70) * 31536000; /* Days of leap years, excluding the year to look at */ _seconds += (((tm.tm_year + 1899) / 4) - 492) * 86400; @@ -271,12 +258,11 @@ (tm.tm_year + 1900) % 100 != 0) || (tm.tm_year + 1900) % 400 == 0)) _seconds += 86400; /* Months */ if (tm.tm_mon < 0 || tm.tm_mon > 12) - @throw [OFInvalidFormatException - exceptionWithClass: [self class]]; + @throw [OFInvalidFormatException exception]; _seconds += month_to_day_of_year[tm.tm_mon] * 86400; /* Days */ _seconds += (tm.tm_mday - 1) * 86400; /* Hours */ _seconds += tm.tm_hour * 3600; @@ -302,16 +288,14 @@ tm.tm_isdst = -1; if (of_strptime([string UTF8String], [format UTF8String], &tm) == NULL) - @throw [OFInvalidFormatException - exceptionWithClass: [self class]]; + @throw [OFInvalidFormatException exception]; if ((_seconds = mktime(&tm)) == -1) - @throw [OFInvalidFormatException - exceptionWithClass: [self class]]; + @throw [OFInvalidFormatException exception]; } @catch (id e) { [self release]; @throw e; } @@ -329,13 +313,11 @@ uint64_t u; } d; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; + @throw [OFInvalidArgumentException exception]; d.u = (uint64_t)[element hexadecimalValue]; _seconds = d.d; objc_autoreleasePoolPop(pool); @@ -391,13 +373,11 @@ - (of_comparison_result_t)compare: (id )object { OFDate *otherDate; if (![object isKindOfClass: [OFDate class]]) - @throw [OFInvalidArgumentException - exceptionWithClass: [self class] - selector: _cmd]; + @throw [OFInvalidArgumentException exception]; otherDate = (OFDate*)object; if (_seconds < otherDate->_seconds) return OF_ORDERED_ASCENDING; @@ -517,26 +497,25 @@ struct tm tm; size_t pageSize; char *buffer; if (seconds != floor(_seconds)) - @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; #ifdef HAVE_GMTIME_R if (gmtime_r(&seconds, &tm) == NULL) - @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; #else # ifdef OF_HAVE_THREADS [mutex lock]; @try { # endif struct tm *tmp; if ((tmp = gmtime(&seconds)) == NULL) - @throw [OFOutOfRangeException - exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; tm = *tmp; # ifdef OF_HAVE_THREADS } @finally { [mutex unlock]; @@ -547,12 +526,11 @@ pageSize = [OFSystemInfo pageSize]; buffer = [self allocMemoryWithSize: pageSize]; @try { if (!strftime(buffer, pageSize, [format UTF8String], &tm)) - @throw [OFOutOfRangeException - exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; ret = [OFString stringWithUTF8String: buffer]; } @finally { [self freeMemory: buffer]; } @@ -567,26 +545,25 @@ struct tm tm; size_t pageSize; char *buffer; if (seconds != floor(_seconds)) - @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; #ifdef HAVE_LOCALTIME_R if (localtime_r(&seconds, &tm) == NULL) - @throw [OFOutOfRangeException exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; #else # ifdef OF_HAVE_THREADS [mutex lock]; @try { # endif struct tm *tmp; if ((tmp = localtime(&seconds)) == NULL) - @throw [OFOutOfRangeException - exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; tm = *tmp; # ifdef OF_HAVE_THREADS } @finally { [mutex unlock]; @@ -597,12 +574,11 @@ pageSize = [OFSystemInfo pageSize]; buffer = [self allocMemoryWithSize: pageSize]; @try { if (!strftime(buffer, pageSize, [format UTF8String], &tm)) - @throw [OFOutOfRangeException - exceptionWithClass: [self class]]; + @throw [OFOutOfRangeException exception]; ret = [OFString stringWithUTF8String: buffer]; } @finally { [self freeMemory: buffer]; }