Index: ConfigParser.m ================================================================== --- ConfigParser.m +++ ConfigParser.m @@ -51,17 +51,23 @@ - (instancetype)initWithConfigPath: (OFString *)configPath { self = [super init]; @try { + void *pool = objc_autoreleasePoolPush(); + OFFile *configFile = [OFFile fileWithPath: configPath + mode: @"r"]; + OFXMLElement *config = [[OFXMLElement alloc] - initWithFile: configPath]; + initWithStream: configFile]; @try { [self _parseConfig: config]; } @finally { [config release]; } + + objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } @@ -110,11 +116,11 @@ @" is missing port attribute"]; listenConfig.host = host; @try { - intmax_t port = portString.decimalValue; + long long port = portString.longLongValue; if (port < 0 || port > 65535) @throw [OFInvalidFormatException exception]; listenConfig.port = port; } @catch (OFInvalidFormatException *e) { @@ -167,9 +173,9 @@ _modules = [modules copy]; } - (void)_invalidConfig: (OFString *)message { - [of_stderr writeFormat: @"Error parsing config: %@", message]; + [OFStdErr writeFormat: @"Error parsing config: %@", message]; [OFApplication terminateWithStatus: 1]; } @end Index: ObjWebServer.m ================================================================== --- ObjWebServer.m +++ ObjWebServer.m @@ -68,13 +68,13 @@ - (OFPlugin *)loadModuleAtPath: (OFString *)path withConfig: (OFXMLElement *)config { OFPlugin *module; - of_log(@"Loading module at %@", path); + OFLog(@"Loading module at %@", path); - module = [OFPlugin pluginFromFile: path]; + module = [OFPlugin pluginWithPath: path]; [module parseConfig: config]; return module; } @@ -92,11 +92,11 @@ } server.numberOfThreads = [OFSystemInfo numberOfCPUs] + 1; server.delegate = self; - of_log(@"Starting server on host %@ port %" PRIu16, + OFLog(@"Starting server on host %@ port %" PRIu16, listenConfig.host, listenConfig.port); [server start]; } @@ -105,11 +105,11 @@ requestBody: (OFStream *)requestBody response: (OFHTTPResponse *)response { OFString *path = request.URL.path; - of_log(@"Request: %@", request); + OFLog(@"Request: %@", request); for (OFPair OF_GENERIC(OFString *, id ) *module in _modules) if ([path hasPrefix: module.firstObject]) if ([module.secondObject handleRequest: request requestBody: requestBody @@ -118,10 +118,10 @@ } - (bool)server: (OFHTTPServer *)server didReceiveExceptionOnListeningSocket: (id)exception { - of_log(@"Exception on listening socket: %@", exception); + OFLog(@"Exception on listening socket: %@", exception); return true; } @end Index: StaticModule.m ================================================================== --- StaticModule.m +++ StaticModule.m @@ -95,11 +95,11 @@ { OFMutableDictionary OF_GENERIC(OFString *, OFString *) *MIMETypes; _root = [[config elementForName: @"root"].stringValue copy]; if (_root == nil) { - [of_stderr writeString: + [OFStdErr writeString: @"Error parsing config: No element!"]; [OFApplication terminateWithStatus: 1]; } MIMETypes = [OFMutableDictionary dictionary]; @@ -108,17 +108,17 @@ [MIMEType attributeForName: @"extension"].stringValue; OFString *type = [MIMEType attributeForName: @"type"].stringValue; if (extension == nil) { - [of_stderr writeString: + [OFStdErr writeString: @"Error parsing config: " @" has no extension attribute!"]; [OFApplication terminateWithStatus: 1]; } if (type == nil) { - [of_stderr writeString: + [OFStdErr writeString: @"Error parsing config: " @" has no type attribute!"]; [OFApplication terminateWithStatus: 1]; } @@ -187,9 +187,9 @@ return true; } @end StaticModule * -init_plugin(void) +OFPluginInit(void) { return [[[StaticModule alloc] init] autorelease]; }