@@ -20,11 +20,11 @@ #include #include #import "OFString+URLEncoding.h" -#import "OFInvalidEncodingException.h" +#import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" /* Reference for static linking */ int _OFString_URLEncoding_reference; @@ -40,13 +40,12 @@ * Worst case: 3 times longer than before. * Oh, and we can't use [self allocWithSize:] here as self might be a * @"" literal. */ if ((retCString = malloc(([self UTF8StringLength] * 3) + 1)) == NULL) - @throw [OFOutOfMemoryException - exceptionWithClass: [self class] - requestedSize: ([self UTF8StringLength] * 3) + 1]; + @throw [OFOutOfMemoryException exceptionWithRequestedSize: + ([self UTF8StringLength] * 3) + 1]; for (i = 0; *string != '\0'; string++) { if (isalnum((int)*string) || *string == '-' || *string == '_' || *string == '.' || *string == '~') retCString[i++] = *string; @@ -83,12 +82,11 @@ int state = 0; size_t i; if ((retCString = malloc([self UTF8StringLength] + 1)) == NULL) @throw [OFOutOfMemoryException - exceptionWithClass: [self class] - requestedSize: [self UTF8StringLength] + 1]; + exceptionWithRequestedSize: [self UTF8StringLength] + 1]; for (i = 0; *string; string++) { switch (state) { case 0: if (*string == '%') @@ -108,12 +106,11 @@ byte += (*string - 'A' + 10) << shift; else if (*string >= 'a' && *string <= 'f') byte += (*string - 'a' + 10) << shift; else { free(retCString); - @throw [OFInvalidEncodingException - exceptionWithClass: [self class]]; + @throw [OFInvalidFormatException exception]; } if (++state == 3) { retCString[i++] = byte; state = 0; @@ -125,12 +122,11 @@ } retCString[i] = '\0'; if (state != 0) { free(retCString); - @throw [OFInvalidEncodingException - exceptionWithClass: [self class]]; + @throw [OFInvalidFormatException exception]; } @try { ret = [OFString stringWithUTF8String: retCString length: i];