зеркало из https://github.com/mozilla/pjs.git
BugZilla 17374. Add PROffset types
This commit is contained in:
Родитель
b2ea5b4c45
Коммит
d4279e6ad9
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче