www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/02/04/12:41:39.1

From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Sun, 4 Feb 2001 12:40:14 -0500
MIME-Version: 1.0
Subject: Re: lfilelength doc change
Message-ID: <3A7D4DAE.28481.24E113@localhost>
In-reply-to: <5.0.2.1.0.20010202202533.03ad6ec0@pop5.banet.net>
References: <3A7ACD7F DOT 17659 DOT AE1F6A AT localhost>
X-mailer: Pegasus Mail for Win32 (v3.12c)
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> OK by me, but then make it 2^63-1 instead of 2^64-2.  2^63-1 is the 
> largest *positive* integer that will fit into a "long long", if I'm not 

I made that change. lfilelength has also been adjusted to return EOVERFLOW when the 
file size is > 2^63-1 since that will cause a negative value to be returned.

Index: libc/posix/sys/stat/lfilelen.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/lfilelen.txh,v
retrieving revision 1.2
diff -c -p -r1.2 lfilelen.txh
*** lfilelen.txh	2001/01/26 18:50:45	1.2
--- lfilelen.txh	2001/02/04 17:34:01
*************** The size of the file in bytes, or (if an
*** 19,25 ****
  @var{errno} set to a value describing the cause of the failure.
  
  The return value is of type @code{long long} which allows file sizes of
! @math{2^64-2} bytes to be returned.  Note that FAT16 limits files to near
  @math{2^31} bytes and FAT32 limits files to @math{2^32-2} bytes.
  
  @subheading Portability
--- 19,25 ----
  @var{errno} set to a value describing the cause of the failure.
  
  The return value is of type @code{long long} which allows file sizes of
! @math{2^63-1} bytes to be returned.  Note that FAT16 limits files to near
  @math{2^31} bytes and FAT32 limits files to @math{2^32-2} bytes.
  
  @subheading Portability
Index: libc/posix/sys/stat/lfilelen.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/lfilelen.c,v
retrieving revision 1.2
diff -c -p -r1.2 lfilelen.c
*** lfilelen.c	2001/01/28 16:19:21	1.2
--- lfilelen.c	2001/02/04 17:34:01
*************** lfilelength(int fhandle)
*** 43,48 ****
--- 43,54 ----
        long retval_l = _farpeekl (_dos_ds, __tb + 0x24);
        long retval_h = _farpeekl (_dos_ds, __tb + 0x20);
  
+       if (retval_h < 0)
+       {
+         errno = EOVERFLOW;
+         return -1;
+       }
+ 
        retval = retval_l + retval_h * (1LL << 32);
        return retval;
      }
Index: docs/kb/wc204.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc204.txi,v
retrieving revision 1.48
diff -c -p -r1.48 wc204.txi
*** wc204.txi	2001/02/02 15:10:41	1.48
--- wc204.txi	2001/02/04 17:34:03
*************** that OS.
*** 228,234 ****
  
  @findex lfilelength AT r{, and FAT32}
  The function @code{lfilelength} added with return type @code{long long}
! to support file sizes of up to @math{2^64-2}.
  
  @pindex djasm AT r{, documentation}
  Texinfo documentation (WIP) for @code{djasm} has been added.
--- 228,234 ----
  
  @findex lfilelength AT r{, and FAT32}
  The function @code{lfilelength} added with return type @code{long long}
! to support file sizes of up to @math{2^63-1}.
  
  @pindex djasm AT r{, documentation}
  Texinfo documentation (WIP) for @code{djasm} has been added.
Index: libc/ansi/errno/errno.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/errno/errno.txh,v
retrieving revision 1.8
diff -c -p -r1.8 errno.txh
*** errno.txh	2001/01/26 17:08:16	1.8
--- errno.txh	2001/02/04 17:34:05
*************** file handling function in library. Usual
*** 247,253 ****
  
  EOVERFLOW -- Value too large.  @code{filelength} can assign this to
  @code{errno} when a file's length is larger than @math{2^31-2}
! (@pxref{filelength}).
  
  @end table
  
--- 247,254 ----
  
  EOVERFLOW -- Value too large.  @code{filelength} can assign this to
  @code{errno} when a file's length is larger than @math{2^31-2}
! (@pxref{filelength}). @code{lfilelength} can assign this to @code{errno}
! when a file's length is larger than @math{2^63-1} (@pxref{lfilelength}).
  
  @end table
  

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019