diff --git a/ChangeLog b/ChangeLog index 169d414bd..8fd409393 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-24 Jeremy Bettis + + * Source/NSCalendarDate.m: Fix bug adding interval to date. + * Source/NSDebug.m: Implemented _NSNewStringFromCString() for gdb. + * Source/GSFormat.m: Fix %S format. + * Source/NSObject.m: ([conformsToProtocol:]) return NO if passed nul. + 2005-07-24 Richard Frith-Macdonald * Source/NSPathUtilities.m: Fix to avoid duplicate paths. diff --git a/Source/GSFormat.m b/Source/GSFormat.m index 3b0fcbdd6..e37883840 100644 --- a/Source/GSFormat.m +++ b/Source/GSFormat.m @@ -1787,31 +1787,14 @@ NSDictionary *locale) } else { - /* This is complicated. We have to transform the wide - string into a unicode string. */ + /* This is simple. Wide string == unicode string. */ int prc; - unichar *sp; - wchar_t *wsp; + unichar *wsp; len = 0; prc = prec; - wsp = (wchar_t *)string; + wsp = (unichar *)string; while (prc-- && *wsp++) len++; - - wsp = (wchar_t *)string; - - /* Allocate dynamically an array which definitely is long - enough for the wide character version. */ - if (len < 8192 - || ((string = (unichar *) NSZoneMalloc(s->_zone, len * sizeof (unichar))) - == NULL)) - string = (unichar *) alloca (len * sizeof (unichar)); - else - string_malloced = 1; - - prc = len; - sp = string; - while (prc--) *sp = *wsp; } if ((width -= len) <= 0) diff --git a/Source/NSCalendarDate.m b/Source/NSCalendarDate.m index 0a1d00469..8a9a99b9f 100644 --- a/Source/NSCalendarDate.m +++ b/Source/NSCalendarDate.m @@ -2558,7 +2558,7 @@ static void Grow(DescriptionInfo *info, unsigned size) eday += 31; } } - if (emonth < smonth) + if (emonth < smonth || (emonth == smonth && eday < sday)) { eyear -= 1; emonth += 12; @@ -2585,7 +2585,7 @@ static void Grow(DescriptionInfo *info, unsigned size) } else { - while (diff--) + while (diff-- > 0) { int tmpmonth = emonth - diff - 1; int tmpyear = eyear; diff --git a/Source/NSDebug.m b/Source/NSDebug.m index ee77801e6..f77fcf6c3 100644 --- a/Source/NSDebug.m +++ b/Source/NSDebug.m @@ -954,3 +954,9 @@ const char *_NSPrintForDebugger(id object) return NULL; } + +NSString *_NSNewStringFromCString(const char *cstring) +{ + return [NSString stringWithCString: cstring]; +} + diff --git a/Source/NSObject.m b/Source/NSObject.m index d45b906aa..afa050836 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -1299,6 +1299,10 @@ GSDescriptionForClassMethod(pcl self, SEL aSel) { struct objc_protocol_list* proto_list; + if (aProtocol == 0) + { + return NO; + } for (proto_list = ((struct objc_class*)self)->protocols; proto_list; proto_list = proto_list->next) {