@@ -19,11 +19,13 @@ #include #include #include -#ifdef __wii__ +#include "platform.h" + +#ifdef OF_WII # define BOOL OGC_BOOL # include # undef BOOL #endif @@ -42,11 +44,11 @@ #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFSeekFailedException.h" #import "OFWriteFailedException.h" -#ifdef _WIN32 +#ifdef OF_WINDOWS # include #endif #ifndef O_BINARY # define O_BINARY 0 @@ -114,11 +116,11 @@ + (void)initialize { if (self != [OFFile class]) return; -#ifdef __wii__ +#ifdef OF_WII if (!fatInitDefault()) @throw [OFInitializationFailedException exceptionWithClass: self]; #endif @@ -158,11 +160,11 @@ if ((flags = parseMode([mode UTF8String])) == -1) @throw [OFInvalidArgumentException exception]; flags |= O_CLOEXEC; -#if defined(_WIN32) +#if defined(OF_WINDOWS) if ((_fd = _wopen([path UTF16String], flags, DEFAULT_MODE)) == -1) #elif defined(OF_HAVE_OFF64_T) if ((_fd = open64([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], flags, DEFAULT_MODE)) == -1) @@ -206,11 +208,11 @@ if (_fd == -1 || _atEndOfStream) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length]; -#ifndef _WIN32 +#ifndef OF_WINDOWS if ((ret = read(_fd, buffer, length)) < 0) @throw [OFReadFailedException exceptionWithObject: self requestedLength: length errNo: errno]; #else @@ -234,11 +236,11 @@ { if (_fd == -1 || _atEndOfStream) @throw [OFWriteFailedException exceptionWithObject: self requestedLength: length]; -#ifndef _WIN32 +#ifndef OF_WINDOWS if (length > SSIZE_MAX) @throw [OFOutOfRangeException exception]; if (write(_fd, buffer, length) != (ssize_t)length) @throw [OFWriteFailedException exceptionWithObject: self @@ -256,11 +258,11 @@ } - (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence { -#if defined(_WIN32) +#if defined(OF_WINDOWS) of_offset_t ret = _lseeki64(_fd, offset, whence); #elif defined(OF_HAVE_OFF64_T) of_offset_t ret = lseek64(_fd, offset, whence); #else of_offset_t ret = lseek(_fd, offset, whence);