@@ -27,21 +27,21 @@ #import "OFInvalidFormatException.h" #import "OFOpenItemFailedException.h" OF_DIRECT_MEMBERS @interface OFINIFile () -- (void)of_parseFile: (OFString *)path encoding: (of_string_encoding_t)encoding; +- (void)of_parseFile: (OFString *)path encoding: (OFStringEncoding)encoding; @end static bool isWhitespaceLine(OFString *line) { const char *cString = line.UTF8String; size_t length = line.UTF8StringLength; for (size_t i = 0; i < length; i++) - if (!of_ascii_isspace(cString[i])) + if (!OFASCIIIsSpace(cString[i])) return false; return true; } @@ -52,11 +52,11 @@ { return [[[self alloc] initWithPath: path] autorelease]; } + (instancetype)fileWithPath: (OFString *)path - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [[[self alloc] initWithPath: path encoding: encoding] autorelease]; } @@ -65,15 +65,15 @@ OF_INVALID_INIT_METHOD } - (instancetype)initWithPath: (OFString *)path { - return [self initWithPath: path encoding: OF_STRING_ENCODING_UTF_8]; + return [self initWithPath: path encoding: OFStringEncodingUTF8]; } - (instancetype)initWithPath: (OFString *)path - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { self = [super init]; @try { _categories = [[OFMutableArray alloc] init]; @@ -109,11 +109,11 @@ objc_autoreleasePoolPop(pool); return category; } -- (void)of_parseFile: (OFString *)path encoding: (of_string_encoding_t)encoding +- (void)of_parseFile: (OFString *)path encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFFile *file; OFINICategory *category = nil; OFString *line; @@ -137,11 +137,11 @@ if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; categoryName = [line substringWithRange: - of_range(1, line.length - 2)]; + OFRangeMake(1, line.length - 2)]; category = [[[OFINICategory alloc] of_initWithName: categoryName] autorelease]; [_categories addObject: category]; } else { if (category == nil) @@ -154,14 +154,14 @@ objc_autoreleasePoolPop(pool); } - (void)writeToFile: (OFString *)path { - [self writeToFile: path encoding: OF_STRING_ENCODING_UTF_8]; + [self writeToFile: path encoding: OFStringEncodingUTF8]; } -- (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding +- (void)writeToFile: (OFString *)path encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path mode: @"w"]; bool first = true;