diff --git a/nsprpub/pr/include/prio.h b/nsprpub/pr/include/prio.h index 49e5fdd2ecc..5df417eb263 100644 --- a/nsprpub/pr/include/prio.h +++ b/nsprpub/pr/include/prio.h @@ -315,8 +315,8 @@ typedef PRInt32 (PR_CALLBACK *PRWriteFN)(PRFileDesc *fd, const void *buf, PRInt3 typedef PRInt32 (PR_CALLBACK *PRAvailableFN)(PRFileDesc *fd); typedef PRInt64 (PR_CALLBACK *PRAvailable64FN)(PRFileDesc *fd); typedef PRStatus (PR_CALLBACK *PRFsyncFN)(PRFileDesc *fd); -typedef PRInt32 (PR_CALLBACK *PRSeekFN)(PRFileDesc *fd, PRInt32 offset, PRSeekWhence how); -typedef PRInt64 (PR_CALLBACK *PRSeek64FN)(PRFileDesc *fd, PRInt64 offset, PRSeekWhence how); +typedef PROffset32 (PR_CALLBACK *PRSeekFN)(PRFileDesc *fd, PROffset32 offset, PRSeekWhence how); +typedef PROffset64 (PR_CALLBACK *PRSeek64FN)(PRFileDesc *fd, PROffset64 offset, PRSeekWhence how); typedef PRStatus (PR_CALLBACK *PRFileInfoFN)(PRFileDesc *fd, PRFileInfo *info); typedef PRStatus (PR_CALLBACK *PRFileInfo64FN)(PRFileDesc *fd, PRFileInfo64 *info); typedef PRInt32 (PR_CALLBACK *PRWritevFN)( @@ -746,14 +746,14 @@ typedef enum PRFileType struct PRFileInfo { PRFileType type; /* Type of file */ - PRUint32 size; /* Size, in bytes, of file's contents */ + PROffset32 size; /* Size, in bytes, of file's contents */ PRTime creationTime; /* Creation time per definition of PRTime */ PRTime modifyTime; /* Last modification time per definition of PRTime */ }; struct PRFileInfo64 { PRFileType type; /* Type of file */ - PRUint64 size; /* Size, in bytes, of file's contents */ + PROffset64 size; /* Size, in bytes, of file's contents */ PRTime creationTime; /* Creation time per definition of PRTime */ PRTime modifyTime; /* Last modification time per definition of PRTime */ }; @@ -857,7 +857,7 @@ PR_EXTERN(PRStatus) PR_Access(const char *name, PRAccessHow how); * INPUTS: * PRFileDesc *fd * Pointer to a PRFileDesc object. - * PRInt32, PRInt64 offset + * PROffset32, PROffset64 offset * Specifies a value, in bytes, that is used in conjunction * with the 'whence' parameter to set the file pointer. A * negative value causes seeking in the reverse direction. @@ -873,7 +873,7 @@ PR_EXTERN(PRStatus) PR_Access(const char *name, PRAccessHow how); * file plus the value of the offset parameter. * OUTPUTS: * None. - * RETURN: PRInt32, PRInt64 + * RETURN: PROffset32, PROffset64 * Upon successful completion, the resulting pointer location, * measured in bytes from the beginning of the file, is returned. * If the PR_Seek() function fails, the file offset remains @@ -882,8 +882,8 @@ PR_EXTERN(PRStatus) PR_Access(const char *name, PRAccessHow how); ************************************************************************* */ -PR_EXTERN(PRInt32) PR_Seek(PRFileDesc *fd, PRInt32 offset, PRSeekWhence whence); -PR_EXTERN(PRInt64) PR_Seek64(PRFileDesc *fd, PRInt64 offset, PRSeekWhence whence); +PR_EXTERN(PROffset32) PR_Seek(PRFileDesc *fd, PROffset32 offset, PRSeekWhence whence); +PR_EXTERN(PROffset64) PR_Seek64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence); /* ************************************************************************ @@ -1698,7 +1698,7 @@ PR_EXTERN(PRFileMap *) PR_CreateFileMap( PR_EXTERN(void *) PR_MemMap( PRFileMap *fmap, - PRInt64 offset, /* must be aligned and sized to whole pages */ + PROffset64 offset, /* must be aligned and sized to whole pages */ PRUint32 len); PR_EXTERN(PRStatus) PR_MemUnmap(void *addr, PRUint32 len); diff --git a/nsprpub/pr/include/private/primpl.h b/nsprpub/pr/include/private/primpl.h index 200773cd900..88d26566e68 100644 --- a/nsprpub/pr/include/private/primpl.h +++ b/nsprpub/pr/include/private/primpl.h @@ -1196,10 +1196,10 @@ extern void *_PR_MD_GET_SP(PRThread *thread); *************************************************************************/ /************************************************************************/ -extern PRInt32 _PR_MD_LSEEK(PRFileDesc *fd, PRInt32 offset, PRSeekWhence whence); +extern PROffset32 _PR_MD_LSEEK(PRFileDesc *fd, PROffset32 offset, PRSeekWhence whence); #define _PR_MD_LSEEK _MD_LSEEK -extern PRInt64 _PR_MD_LSEEK64(PRFileDesc *fd, PRInt64 offset, PRSeekWhence whence); +extern PROffset64 _PR_MD_LSEEK64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence); #define _PR_MD_LSEEK64 _MD_LSEEK64 extern PRInt32 _PR_MD_GETFILEINFO(const char *fn, PRFileInfo *info); @@ -1799,7 +1799,7 @@ extern PRStatus _PR_MD_CREATE_FILE_MAP(PRFileMap *fmap, PRInt64 size); extern void * _PR_MD_MEM_MAP( PRFileMap *fmap, - PRInt64 offset, + PROffset64 offset, PRUint32 len); #define _PR_MD_MEM_MAP _MD_MEM_MAP diff --git a/nsprpub/pr/include/prtypes.h b/nsprpub/pr/include/prtypes.h index fd3d084274f..8aaf594ea75 100644 --- a/nsprpub/pr/include/prtypes.h +++ b/nsprpub/pr/include/prtypes.h @@ -316,6 +316,15 @@ typedef double PRFloat64; ************************************************************************/ typedef size_t PRSize; + +/************************************************************************ +** TYPES: PROffset32, PROffset64 +** DESCRIPTION: +** A type for representing byte offsets from some location. +************************************************************************/ +typedef PRInt32 PROffset32; +typedef PRInt64 PROffset64; + /************************************************************************ ** TYPES: PRPtrDiff ** DESCRIPTION: diff --git a/nsprpub/pr/src/io/prfile.c b/nsprpub/pr/src/io/prfile.c index fa05e0bdd99..ab16e27a8af 100644 --- a/nsprpub/pr/src/io/prfile.c +++ b/nsprpub/pr/src/io/prfile.c @@ -95,20 +95,20 @@ static PRInt32 PR_CALLBACK FileWrite(PRFileDesc *fd, const void *buf, PRInt32 am return count; } -static PRInt32 PR_CALLBACK FileSeek(PRFileDesc *fd, PRInt32 offset, PRSeekWhence whence) +static PROffset32 PR_CALLBACK FileSeek(PRFileDesc *fd, PROffset32 offset, PRSeekWhence whence) { - PRInt32 result; + PROffset32 result; result = _PR_MD_LSEEK(fd, offset, whence); return result; } -static PRInt64 PR_CALLBACK FileSeek64(PRFileDesc *fd, PRInt64 offset, PRSeekWhence whence) +static PROffset64 PR_CALLBACK FileSeek64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence) { #ifdef XP_MAC #pragma unused( fd, offset, whence ) #endif - PRInt64 result; + PROffset64 result; result = _PR_MD_LSEEK64(fd, offset, whence); return result; diff --git a/nsprpub/pr/src/io/prmmap.c b/nsprpub/pr/src/io/prmmap.c index 9383c151987..351adb1aac5 100644 --- a/nsprpub/pr/src/io/prmmap.c +++ b/nsprpub/pr/src/io/prmmap.c @@ -52,7 +52,7 @@ PR_IMPLEMENT(PRFileMap *) PR_CreateFileMap( PR_IMPLEMENT(void *) PR_MemMap( PRFileMap *fmap, - PRInt64 offset, + PROffset64 offset, PRUint32 len) { return _PR_MD_MEM_MAP(fmap, offset, len); diff --git a/nsprpub/pr/src/md/mac/macio.c b/nsprpub/pr/src/md/mac/macio.c index df9e905fc2a..c12f39b27b9 100644 --- a/nsprpub/pr/src/md/mac/macio.c +++ b/nsprpub/pr/src/md/mac/macio.c @@ -425,7 +425,7 @@ ErrorExit: /* _MD_CLOSE_FILE, _MD_READ, _MD_WRITE, _MD_GET_FILE_ERROR are defined in _macos.h */ -PRInt32 _MD_LSeek(PRFileDesc *fd, PRInt32 offset, PRSeekWhence how) +PROffset32 _MD_LSeek(PRFileDesc *fd, PROffset32 offset, PRSeekWhence how) { PRInt32 refNum = fd->secret->md.osfd; OSErr err = noErr; @@ -1880,7 +1880,7 @@ PRStatus _MD_CreateFileMap(PRFileMap *fmap, PRInt64 size) void * _MD_MemMap( PRFileMap *fmap, - PRInt64 offset, + PROffset64 offset, PRUint32 len) { #pragma unused (fmap, offset, len) diff --git a/nsprpub/pr/src/md/os2/os2misc.c b/nsprpub/pr/src/md/os2/os2misc.c index a74eca86eb6..de675e43167 100644 --- a/nsprpub/pr/src/md/os2/os2misc.c +++ b/nsprpub/pr/src/md/os2/os2misc.c @@ -487,7 +487,7 @@ PRStatus _MD_CreateFileMap(PRFileMap *fmap, PRInt64 size) void * _MD_MemMap( PRFileMap *fmap, - PRInt64 offset, + PROffset64 offset, PRUint32 len) { PR_ASSERT(!"Not implemented"); diff --git a/nsprpub/pr/src/md/unix/unix.c b/nsprpub/pr/src/md/unix/unix.c index aa3cf45aa4b..8c3dca00a4b 100644 --- a/nsprpub/pr/src/md/unix/unix.c +++ b/nsprpub/pr/src/md/unix/unix.c @@ -2256,9 +2256,9 @@ static void sigbushandler() { #endif /* !defined(_PR_PTHREADS) */ -PRInt32 _MD_lseek(PRFileDesc *fd, PRInt32 offset, PRSeekWhence whence) +PROffset32 _MD_lseek(PRFileDesc *fd, PROffset32 offset, PRSeekWhence whence) { - PRInt32 rv, where; + PROffset32 rv, where; switch (whence) { case PR_SEEK_SET: @@ -2285,10 +2285,10 @@ done: return(rv); } -PRInt64 _MD_lseek64(PRFileDesc *fd, PRInt64 offset, PRSeekWhence whence) +PROffset64 _MD_lseek64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence) { PRInt32 where; - PRInt64 rv; + PROffset64 rv; switch (whence) { @@ -2661,10 +2661,10 @@ static PRIntn _MD_solaris25_stat64(const char *fn, _MDStat64 *buf) #if defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) -static PRInt64 _MD_Unix_lseek64(PRIntn osfd, PRInt64 offset, PRIntn whence) +static PROffset64 _MD_Unix_lseek64(PRIntn osfd, PROffset64 offset, PRIntn whence) { PRUint64 maxoff; - PRInt64 rv = minus_one; + PROffset64 rv = minus_one; LL_I2L(maxoff, 0x7fffffff); if (LL_CMP(offset, <=, maxoff)) { diff --git a/nsprpub/pr/src/md/windows/ntio.c b/nsprpub/pr/src/md/windows/ntio.c index 47c1efebef7..8225da9bd99 100644 --- a/nsprpub/pr/src/md/windows/ntio.c +++ b/nsprpub/pr/src/md/windows/ntio.c @@ -2460,10 +2460,10 @@ _PR_MD_SOCKETAVAILABLE(PRFileDesc *fd) return result; } -PRInt32 -_PR_MD_LSEEK(PRFileDesc *fd, PRInt32 offset, int whence) +PROffset32 +_PR_MD_LSEEK(PRFileDesc *fd, PROffset32 offset, int whence) { - PRInt32 rv; + PROffset32 rv; rv = SetFilePointer((HANDLE)fd->secret->md.osfd, offset, NULL, whence); /* @@ -2476,8 +2476,8 @@ _PR_MD_LSEEK(PRFileDesc *fd, PRInt32 offset, int whence) return rv; } -PRInt64 -_PR_MD_LSEEK64(PRFileDesc *fd, PRInt64 offset, int whence) +PROffset64 +_PR_MD_LSEEK64(PRFileDesc *fd, PROffset64 offset, int whence) { PRUint64 result; PRUint32 position, uhi; @@ -2516,7 +2516,7 @@ _PR_MD_LSEEK64(PRFileDesc *fd, PRInt64 offset, int whence) PR_ASSERT((PRInt64)result >= 0); result += position; PR_ASSERT((PRInt64)result >= 0); - return (PRInt64)result; + return (PROffset64)result; } /* diff --git a/nsprpub/pr/src/md/windows/ntmisc.c b/nsprpub/pr/src/md/windows/ntmisc.c index 6ef02f6d8ed..6a60814c241 100644 --- a/nsprpub/pr/src/md/windows/ntmisc.c +++ b/nsprpub/pr/src/md/windows/ntmisc.c @@ -669,7 +669,7 @@ PRStatus _MD_CreateFileMap(PRFileMap *fmap, PRInt64 size) extern PRLogModuleInfo *_pr_shma_lm; void * _MD_MemMap( PRFileMap *fmap, - PRInt64 offset, + PROffset64 offset, PRUint32 len) { DWORD dwHi, dwLo; diff --git a/nsprpub/pr/src/md/windows/w95io.c b/nsprpub/pr/src/md/windows/w95io.c index af8c63e3db5..2b21efb983e 100644 --- a/nsprpub/pr/src/md/windows/w95io.c +++ b/nsprpub/pr/src/md/windows/w95io.c @@ -225,11 +225,11 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) return bytes; } /* --- end _PR_MD_WRITE() --- */ -PRInt32 -_PR_MD_LSEEK(PRFileDesc *fd, PRInt32 offset, PRSeekWhence whence) +PROffset32 +_PR_MD_LSEEK(PRFileDesc *fd, PROffset32 offset, PRSeekWhence whence) { DWORD moveMethod; - PRInt32 rv; + PROffset32 rv; switch (whence) { case PR_SEEK_SET: @@ -258,8 +258,8 @@ _PR_MD_LSEEK(PRFileDesc *fd, PRInt32 offset, PRSeekWhence whence) return rv; } -PRInt64 -_PR_MD_LSEEK64(PRFileDesc *fd, PRInt64 offset, PRSeekWhence whence) +PROffset64 +_PR_MD_LSEEK64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence) { DWORD moveMethod; LARGE_INTEGER li;