Overview
Comment: | Use 64 bit file offsets |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c409a0ec954848ccea2395940b335eaf |
User & Date: | js on 2015-01-17 22:41:00 |
Other Links: | manifest | tags |
Context
2015-01-19
| ||
22:29 | OFStream: writeBufferEnabled -> writeBuffered check-in: afb42d363d user: js tags: trunk | |
2015-01-17
| ||
22:41 | Use 64 bit file offsets check-in: c409a0ec95 user: js tags: trunk | |
18:39 | Fix compilation on Win32 check-in: 8b0caeabde user: js tags: trunk | |
Changes
Modified configure.ac from [fb80735dec] to [073f94a1b8].
︙ | ︙ | |||
691 692 693 694 695 696 697 698 699 700 701 702 703 704 | AC_ARG_ENABLE(files, AS_HELP_STRING([--disable-files], [disable file support])) AS_IF([test x"$enable_files" != x"no"], [ AC_DEFINE(OF_HAVE_FILES, 1, [Whether we have files]) AC_SUBST(USE_SRCS_FILES, '${SRCS_FILES}') AC_SUBST(OFHASH, "ofhash") AC_SUBST(OFZIP, "ofzip") AC_CHECK_FUNCS(readdir_r) ]) AC_CHECK_FUNCS([sysconf gmtime_r localtime_r nanosleep lstat]) AC_CHECK_HEADERS([pwd.h grp.h]) | > > > > | 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 | AC_ARG_ENABLE(files, AS_HELP_STRING([--disable-files], [disable file support])) AS_IF([test x"$enable_files" != x"no"], [ AC_DEFINE(OF_HAVE_FILES, 1, [Whether we have files]) AC_SUBST(USE_SRCS_FILES, '${SRCS_FILES}') AC_SUBST(OFHASH, "ofhash") AC_SUBST(OFZIP, "ofzip") AC_CHECK_TYPE(off64_t, [ AC_DEFINE(OF_HAVE_OFF64_T, 1, [Whether we have off64_t]) ]) AC_CHECK_FUNCS(readdir_r) ]) AC_CHECK_FUNCS([sysconf gmtime_r localtime_r nanosleep lstat]) AC_CHECK_HEADERS([pwd.h grp.h]) |
︙ | ︙ |
Modified src/OFFile.h from [de974a9641] to [ea93239d94].
︙ | ︙ | |||
25 26 27 28 29 30 31 | #include <sys/stat.h> #import "OFSeekableStream.h" @class OFArray; @class OFDate; | | > > | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <sys/stat.h> #import "OFSeekableStream.h" @class OFArray; @class OFDate; #if defined(_WIN32) typedef struct __stat64 of_stat_t; #elif defined(OF_HAVE_OFF64_T) typedef struct stat64 of_stat_t; #else typedef struct stat of_stat_t; #endif /*! * @class OFFile OFFile.h ObjFW/OFFile.h * * @brief A class which provides functions to read, write and manipulate files. */ |
︙ | ︙ |
Modified src/OFFile.m from [73987ccc68] to [864c3ff8dd].
︙ | ︙ | |||
122 123 124 125 126 127 128 | #if !defined(HAVE_READDIR_R) && !defined(_WIN32) && defined(OF_HAVE_THREADS) static of_mutex_t mutex; #endif int of_stat(OFString *path, of_stat_t *buffer) { | | | > > > | > > > > > > > > > > | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | #if !defined(HAVE_READDIR_R) && !defined(_WIN32) && defined(OF_HAVE_THREADS) static of_mutex_t mutex; #endif int of_stat(OFString *path, of_stat_t *buffer) { #if defined(_WIN32) return _wstat64([path UTF16String], buffer); #elif defined(OF_HAVE_OFF64_T) return stat64([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], buffer); #else return stat([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], buffer); #endif } int of_lstat(OFString *path, of_stat_t *buffer) { #if defined(_WIN32) return _wstat64([path UTF16String], buffer); #elif defined(HAVE_LSTAT) # ifdef OF_HAVE_OFF64_T return lstat64([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], buffer); # else return lstat([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], buffer); # endif #else # ifdef OF_HAVE_OFF64_T return stat64([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], buffer); # else return stat([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], buffer); # endif #endif } static int parseMode(const char *mode) { if (strcmp(mode, "r") == 0) |
︙ | ︙ | |||
891 892 893 894 895 896 897 | int flags; if ((flags = parseMode([mode UTF8String])) == -1) @throw [OFInvalidArgumentException exception]; flags |= O_CLOEXEC; | | > > > | | | | 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | int flags; if ((flags = parseMode([mode UTF8String])) == -1) @throw [OFInvalidArgumentException exception]; flags |= O_CLOEXEC; #if defined(_WIN32) 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) #else if ((_fd = open([path cStringWithEncoding: [OFSystemInfo native8BitEncoding]], flags, DEFAULT_MODE)) == -1) #endif @throw [OFOpenFileFailedException exceptionWithPath: path mode: mode]; } @catch (id e) { [self release]; @throw e; |
︙ | ︙ | |||
973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 | requestedLength: length]; #endif } - (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence { of_offset_t ret = lseek(_fd, offset, whence); if (ret == -1) @throw [OFSeekFailedException exceptionWithStream: self offset: offset whence: whence]; _atEndOfStream = false; | > > > > > > | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | requestedLength: length]; #endif } - (of_offset_t)lowlevelSeekToOffset: (of_offset_t)offset whence: (int)whence { #if defined(_WIN32) 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); #endif if (ret == -1) @throw [OFSeekFailedException exceptionWithStream: self offset: offset whence: whence]; _atEndOfStream = false; |
︙ | ︙ |
Modified src/OFSeekableStream.h from [56c089ffb2] to [2c45e50707].
︙ | ︙ | |||
21 22 23 24 25 26 27 | # define __STDC_CONSTANT_MACROS #endif #include <sys/types.h> #import "OFStream.h" | > > | > > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # define __STDC_CONSTANT_MACROS #endif #include <sys/types.h> #import "OFStream.h" #if defined(_WIN32) typedef __int64 of_offset_t; #elif defined(__ANDROID__) typedef long long of_offset_t; #elif defined(OF_HAVE_OFF64_T) typedef off64_t of_offset_t; #else typedef off_t of_offset_t; #endif /*! * @class OFSeekableStream OFSeekableStream.h ObjFW/OFSeekableStream.h * |
︙ | ︙ |