Index: src/OFMutableString.h ================================================================== --- src/OFMutableString.h +++ src/OFMutableString.h @@ -76,21 +76,21 @@ * Appends a formatted UTF-8 encoded C string to the OFString. * See printf for the format syntax. * * \param fmt A format string which generates the string to append */ -- appendWithFormat: (OFString*)fmt, ...; +- appendFormat: (OFString*)fmt, ...; /** * Appends a formatted UTF-8 encoded C string to the OFString. * See printf for the format syntax. * * \param fmt A format string which generates the string to append * \param args The arguments used in the format string */ -- appendWithFormat: (OFString*)fmt - arguments: (va_list)args; +- appendFormat: (OFString*)fmt + withArguments: (va_list)args; /** * Reverse the OFString. */ - reverse; Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -233,37 +233,39 @@ is_utf8 = YES; return self; } -- appendWithFormat: (OFString*)fmt, ... +- appendFormat: (OFString*)fmt, ... { id ret; va_list args; va_start(args, fmt); - ret = [self appendWithFormat: fmt - arguments: args]; + ret = [self appendFormat: fmt + withArguments: args]; va_end(args); return ret; } -- appendWithFormat: (OFString*)fmt - arguments: (va_list)args +- appendFormat: (OFString*)fmt + withArguments: (va_list)args { char *t; - if (fmt == NULL) - @throw [OFInvalidFormatException newWithClass: isa]; + if (fmt == nil) + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; - if ((vasprintf(&t, [fmt cString], args)) == -1) + if ((vasprintf(&t, [fmt cString], args)) == -1) { /* * This is only the most likely error to happen. Unfortunately, * there is no good way to check what really happened. */ @throw [OFOutOfMemoryException newWithClass: isa]; + } @try { [self appendCString: t]; } @finally { free(t); Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -454,14 +454,15 @@ int t; Class c; self = [super init]; - if (fmt == NULL) { + if (fmt == nil) { c = isa; [super dealloc]; - @throw [OFInvalidFormatException newWithClass: c]; + @throw [OFInvalidArgumentException newWithClass: c + selector: _cmd]; } if ((t = vasprintf(&string, [fmt cString], args)) == -1) { c = isa; [super dealloc]; Index: tests/OFString.m ================================================================== --- tests/OFString.m +++ tests/OFString.m @@ -139,12 +139,12 @@ TEST(@"+[stringWithFormat:]", [(s[0] = [OFMutableString stringWithFormat: @"%s: %d", "test", 123]) isEqual: @"test: 123"]) - TEST(@"-[appendWithFormat:]", - [([s[0] appendWithFormat: @"%02X", 15]) isEqual: @"test: 1230F"]) + TEST(@"-[appendFormat:]", + [([s[0] appendFormat: @"%02X", 15]) isEqual: @"test: 1230F"]) TEST(@"-[indexOfFirstOccurrenceOfString:]", [@"π„žΓΆΓΆ" indexOfFirstOccurrenceOfString: @"ΓΆΓΆ"] == 1 && [@"π„žΓΆΓΆ" indexOfFirstOccurrenceOfString: @"ΓΆ"] == 1 && [@"π„žΓΆΓΆ" indexOfFirstOccurrenceOfString: @"π„ž"] == 0 &&