Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -222,34 +222,38 @@ objc_autoreleasePoolPop(pool); } FreeEnvironmentStringsW(env); #elif !defined(OF_IOS) - for (; *env != NULL; env++) { - OFString *key, *value; - char *sep; - - pool = objc_autoreleasePoolPush(); - - if ((sep = strchr(*env, '=')) == NULL) { - fprintf(stderr, "Warning: Invalid environment " - "variable: %s\n", *env); - continue; - } - - key = [OFString - stringWithCString: *env - encoding: OF_STRING_ENCODING_NATIVE - length: sep - *env]; - value = [OFString - stringWithCString: sep + 1 - encoding: OF_STRING_ENCODING_NATIVE]; - - [environment setObject: value - forKey: key]; - - objc_autoreleasePoolPop(pool); + if (env != NULL) { + for (; *env != NULL; env++) { + OFString *key, *value; + char *sep; + const of_string_encoding_t encoding = + OF_STRING_ENCODING_NATIVE; + + pool = objc_autoreleasePoolPush(); + + if ((sep = strchr(*env, '=')) == NULL) { + fprintf(stderr, "Warning: Invalid " + "environment variable: %s\n", *env); + continue; + } + + key = [OFString + stringWithCString: *env + encoding: encoding + length: sep - *env]; + value = [OFString + stringWithCString: sep + 1 + encoding: encoding]; + + [environment setObject: value + forKey: key]; + + objc_autoreleasePoolPop(pool); + } } #else /* * iOS does not provide environ and Apple does not allow using * _NSGetEnviron on iOS. Therefore, we just get a few common Index: src/OFFile.m ================================================================== --- src/OFFile.m +++ src/OFFile.m @@ -405,11 +405,12 @@ #endif /* FIXME: Maybe use another exception? */ @throw [OFOpenFileFailedException exceptionWithPath: path mode: @"r"]; - return s.st_size; + /* On Android, off_t is 32 bit, but st_size is long long there */ + return (off_t)s.st_size; } + (OFDate*)modificationDateOfFileAtPath: (OFString*)path { if (path == nil) Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -377,12 +377,17 @@ [@"\t-0.25 " floatValue] == -0.25 && [@"\r-INFINITY\n" floatValue] == -INFINITY && isnan([@" NAN\t\t" floatValue])) TEST(@"-[doubleValue]", +#ifndef __ANDROID__ [@"\t-0x1.FFFFFFFFFFFFFP-1020 " doubleValue] == -0x1.FFFFFFFFFFFFFP-1020 && +#else + /* strtod() does not accept 0x on Android */ + [@"\t-0.123456789 " doubleValue] == -0.123456789 && +#endif [@"\r-INFINITY\n" doubleValue] == -INFINITY && isnan([@" NAN\t\t" doubleValue])) EXPECT_EXCEPTION(@"Detect invalid characters in -[decimalValue] #1", OFInvalidFormatException, [@"abc" decimalValue])