@@ -52,42 +52,47 @@ # define GMTIME_RET(field) \ time_t seconds_ = (time_t)seconds; \ struct tm tm; \ \ if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + @throw [OFOutOfRangeException \ + exceptionWithClass: [self class]]; \ \ if (gmtime_r(&seconds_, &tm) == NULL) \ - @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + @throw [OFOutOfRangeException \ + exceptionWithClass: [self class]]; \ \ return tm.field; # define LOCALTIME_RET(field) \ time_t seconds_ = (time_t)seconds; \ struct tm tm; \ \ if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + @throw [OFOutOfRangeException \ + exceptionWithClass: [self class]]; \ \ if (localtime_r(&seconds_, &tm) == NULL) \ - @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + @throw [OFOutOfRangeException \ + exceptionWithClass: [self class]]; \ \ return tm.field; #else # ifdef OF_THREADS # define GMTIME_RET(field) \ time_t seconds_ = (time_t)seconds; \ struct tm *tm; \ \ if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + @throw [OFOutOfRangeException \ + exceptionWithClass: [self class]]; \ \ [mutex lock]; \ \ @try { \ if ((tm = gmtime(&seconds_)) == NULL) \ @throw [OFOutOfRangeException \ - exceptionWithClass: isa]; \ + exceptionWithClass: [self class]]; \ \ return tm->field; \ } @finally { \ [mutex unlock]; \ } @@ -94,18 +99,19 @@ # define LOCALTIME_RET(field) \ time_t seconds_ = (time_t)seconds; \ struct tm *tm; \ \ if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + @throw [OFOutOfRangeException \ + exceptionWithClass: [self class]]; \ \ [mutex lock]; \ \ @try { \ if ((tm = localtime(&seconds_)) == NULL) \ @throw [OFOutOfRangeException \ - exceptionWithClass: isa]; \ + exceptionWithClass: [self class]]; \ \ return tm->field; \ } @finally { \ [mutex unlock]; \ } @@ -113,25 +119,29 @@ # define GMTIME_RET(field) \ time_t seconds_ = (time_t)seconds; \ struct tm *tm; \ \ if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + @throw [OFOutOfRangeException \ + exceptionWithClass: [self class]]; \ \ if ((tm = gmtime(&seconds_)) == NULL) \ - @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + @throw [OFOutOfRangeException \ + exceptionWithClass: [self class]]; \ \ return tm->field; # define LOCALTIME_RET(field) \ time_t seconds_ = (time_t)seconds; \ struct tm *tm; \ \ if (seconds_ != floor(seconds)) \ - @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + @throw [OFOutOfRangeException \ + exceptionWithClass: [self class]]; \ \ if ((tm = localtime(&seconds_)) == NULL) \ - @throw [OFOutOfRangeException exceptionWithClass: isa]; \ + @throw [OFOutOfRangeException \ + exceptionWithClass: [self class]]; \ \ return tm->field; # endif #endif @@ -246,11 +256,11 @@ tm.tm_isdst = -1; if (of_strptime([string UTF8String], [format UTF8String], &tm) == NULL) @throw [OFInvalidFormatException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; /* 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; @@ -262,11 +272,11 @@ (tm.tm_year + 1900) % 400 == 0)) seconds += 86400; /* Months */ if (tm.tm_mon < 0 || tm.tm_mon > 12) @throw [OFInvalidFormatException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; seconds += month_to_day_of_year[tm.tm_mon] * 86400; /* Days */ seconds += (tm.tm_mday - 1) * 86400; /* Hours */ seconds += tm.tm_hour * 3600; @@ -293,15 +303,15 @@ tm.tm_isdst = -1; if (of_strptime([string UTF8String], [format UTF8String], &tm) == NULL) @throw [OFInvalidFormatException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; if ((seconds = mktime(&tm)) == -1) @throw [OFInvalidFormatException - exceptionWithClass: isa]; + exceptionWithClass: [self class]]; } @catch (id e) { [self release]; @throw e; } @@ -316,11 +326,11 @@ OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException - exceptionWithClass: isa + exceptionWithClass: [self class] selector: _cmd]; seconds = [element doubleValue]; [pool release]; @@ -376,12 +386,13 @@ - (of_comparison_result_t)compare: (id)object { OFDate *otherDate; if (![object isKindOfClass: [OFDate class]]) - @throw [OFInvalidArgumentException exceptionWithClass: isa - selector: _cmd]; + @throw [OFInvalidArgumentException + exceptionWithClass: [self class] + selector: _cmd]; otherDate = object; if (seconds < otherDate->seconds) return OF_ORDERED_ASCENDING; @@ -493,25 +504,26 @@ time_t seconds_ = (time_t)seconds; struct tm tm; char *buffer; if (seconds_ != floor(seconds)) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; #ifdef HAVE_GMTIME_R if (gmtime_r(&seconds_, &tm) == NULL) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; #else # ifdef OF_THREADS [mutex lock]; @try { # endif struct tm *tmp; if ((tmp = gmtime(&seconds_)) == NULL) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException + exceptionWithClass: [self class]]; tm = *tmp; # ifdef OF_THREADS } @finally { [mutex unlock]; @@ -521,11 +533,12 @@ buffer = [self allocMemoryWithSize: of_pagesize]; @try { if (!strftime(buffer, of_pagesize, [format UTF8String], &tm)) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException + exceptionWithClass: [self class]]; ret = [OFString stringWithUTF8String: buffer]; } @finally { [self freeMemory: buffer]; } @@ -539,25 +552,26 @@ time_t seconds_ = (time_t)seconds; struct tm tm; char *buffer; if (seconds_ != floor(seconds)) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; #ifdef HAVE_LOCALTIME_R if (localtime_r(&seconds_, &tm) == NULL) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException exceptionWithClass: [self class]]; #else # ifdef OF_THREADS [mutex lock]; @try { # endif struct tm *tmp; if ((tmp = localtime(&seconds_)) == NULL) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException + exceptionWithClass: [self class]]; tm = *tmp; # ifdef OF_THREADS } @finally { [mutex unlock]; @@ -567,11 +581,12 @@ buffer = [self allocMemoryWithSize: of_pagesize]; @try { if (!strftime(buffer, of_pagesize, [format UTF8String], &tm)) - @throw [OFOutOfRangeException exceptionWithClass: isa]; + @throw [OFOutOfRangeException + exceptionWithClass: [self class]]; ret = [OFString stringWithUTF8String: buffer]; } @finally { [self freeMemory: buffer]; }