You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bn...@apache.org on 2003/12/15 23:05:34 UTC
cvs commit: apr/include/arch/netware apr_arch_file_io.h
bnicholes 2003/12/15 14:05:34
Modified: file_io/unix readwrite.c seek.c
include apr.hnw
include/arch/netware apr_arch_file_io.h
Log:
Clean up some 32 bit/64 bit type incompatibilities that cause problems when large file support is enabled. Also turn large file support back on for NetWare
Revision Changes Path
1.87 +4 -0 apr/file_io/unix/readwrite.c
Index: readwrite.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/readwrite.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- readwrite.c 5 Jun 2003 02:29:12 -0000 1.86
+++ readwrite.c 15 Dec 2003 22:05:33 -0000 1.87
@@ -203,7 +203,11 @@
*/
apr_int64_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
if (offset != thefile->filePtr)
+#if defined(NETWARE) && APR_HAS_LARGE_FILES
+ lseek64(thefile->filedes, offset, SEEK_SET);
+#else
lseek(thefile->filedes, offset, SEEK_SET);
+#endif
thefile->bufpos = thefile->dataRead = 0;
thefile->direction = 1;
}
1.32 +14 -2 apr/file_io/unix/seek.c
Index: seek.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/seek.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- seek.c 3 Sep 2003 04:30:50 -0000 1.31
+++ seek.c 15 Dec 2003 22:05:34 -0000 1.32
@@ -54,9 +54,9 @@
#include "apr_arch_file_io.h"
-static apr_status_t setptr(apr_file_t *thefile, unsigned long pos )
+static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos )
{
- long newbufpos;
+ apr_off_t newbufpos;
int rc;
if (thefile->direction == 1) {
@@ -70,7 +70,11 @@
rc = 0;
}
else {
+#if defined(NETWARE) && APR_HAS_LARGE_FILES
+ rc = lseek64(thefile->filedes, pos, SEEK_SET);
+#else
rc = lseek(thefile->filedes, pos, SEEK_SET);
+#endif
if (rc != -1 ) {
thefile->bufpos = thefile->dataRead = 0;
@@ -117,7 +121,11 @@
}
else {
+#if defined(NETWARE) && APR_HAS_LARGE_FILES
+ rv = lseek64(thefile->filedes, *offset, where);
+#else
rv = lseek(thefile->filedes, *offset, where);
+#endif
if (rv == -1) {
*offset = -1;
return errno;
@@ -131,7 +139,11 @@
apr_status_t apr_file_trunc(apr_file_t *fp, apr_off_t offset)
{
+#if defined(NETWARE) && APR_HAS_LARGE_FILES
+ if (ftruncate64(fp->filedes, offset) == -1) {
+#else
if (ftruncate(fp->filedes, offset) == -1) {
+#endif
return errno;
}
return setptr(fp, offset);
1.43 +5 -1 apr/include/apr.hnw
Index: apr.hnw
===================================================================
RCS file: /home/cvs/apr/include/apr.hnw,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- apr.hnw 13 Dec 2003 20:32:49 -0000 1.42
+++ apr.hnw 15 Dec 2003 22:05:34 -0000 1.43
@@ -227,7 +227,7 @@
#define APR_HAS_UNICODE_FS 0
#define APR_HAS_PROC_INVOKED 0
#define APR_HAS_USER 1
-#define APR_HAS_LARGE_FILES 0
+#define APR_HAS_LARGE_FILES 1
#define APR_HAS_XTHREAD_FILES 0
#define APR_HAS_OS_UUID 0
@@ -347,7 +347,11 @@
#define APR_SIZE_T_FMT "d"
+#if APR_HAS_LARGE_FILES
+#define APR_OFF_T_FMT "lld"
+#else
#define APR_OFF_T_FMT "ld"
+#endif
#define APR_PID_T_FMT "d"
1.4 +2 -2 apr/include/arch/netware/apr_arch_file_io.h
Index: apr_arch_file_io.h
===================================================================
RCS file: /home/cvs/apr/include/arch/netware/apr_arch_file_io.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apr_arch_file_io.h 17 Nov 2003 01:41:17 -0000 1.3
+++ apr_arch_file_io.h 15 Dec 2003 22:05:34 -0000 1.4
@@ -127,9 +127,9 @@
/* Stuff for buffered mode */
char *buffer;
int bufpos; /* Read/Write position in buffer */
- unsigned long dataRead; /* amount of valid data read into buffer */
+ apr_off_t dataRead; /* amount of valid data read into buffer */
int direction; /* buffer being used for 0 = read, 1 = write */
- unsigned long filePtr; /* position in file of handle */
+ apr_off_t filePtr; /* position in file of handle */
#if APR_HAS_THREADS
struct apr_thread_mutex_t *thlock;
#endif