From mint-bounce@lists.fishpool.fi Fri May 23 10:49:05 2008 X-Virus-Scanned: amavisd-new at demon.co.uk Subject: [MiNT] mintlib patch From: Alan Hourihane To: mint Content-Type: multipart/mixed; boundary="=-xTTYjDO7wOW/V4fS6/WK" Date: Fri, 23 May 2008 15:39:16 +0100 Message-Id: <1211553556.10463.26.camel@jetpack.demon.co.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.12.3 X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: alanh@fairlite.demon.co.uk Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: --=-xTTYjDO7wOW/V4fS6/WK Content-Type: text/plain Content-Transfer-Encoding: 7bit Attached is a patch to mintlib which adds new functions ftello/fseeko which essentially call their ftell/fseek counterparts as they're defined as using off_t instead of long int. If we ever get 64bit support then this would need fixing, but for now they work just the same. Alan. --=-xTTYjDO7wOW/V4fS6/WK Content-Disposition: attachment; filename=mintlib.patch Content-Type: text/x-patch; name=mintlib.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: include/stdio.h =================================================================== RCS file: /mint/mintlib/include/stdio.h,v retrieving revision 1.5 diff -u -r1.5 stdio.h --- include/stdio.h 27 Feb 2008 09:45:39 -0000 1.5 +++ include/stdio.h 23 May 2008 14:38:36 -0000 @@ -708,7 +708,6 @@ FILE *__restrict __stream)); #endif - /* Seek to a certain position on STREAM. */ extern int fseek __P ((FILE *__stream, long int __off, int __whence)); /* Return the current position of STREAM. */ @@ -716,6 +715,26 @@ /* Rewind to the beginning of STREAM. */ extern void rewind __P ((FILE *__stream)); +/* The Single Unix Specification, Version 2, specifies an alternative, + more adequate interface for the two functions above which deal with + file offset. `long int' is not the right type. These definitions + are originally defined in the Large File Support API. */ + +#if defined __USE_LARGEFILE || defined __USE_XOPEN2K +# ifndef __USE_FILE_OFFSET64 +/* Seek to a certain position on STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence)); +/* Return the current position of STREAM. + + This function is a possible cancellation point and therefore not + marked with __THROW. */ +extern __off_t ftello __P ((FILE *__stream)); +# endif +#endif + /* Get STREAM's position. */ extern int fgetpos __P ((FILE *__restrict __stream, fpos_t *__restrict __pos)); /* Set STREAM's position. */ Index: stdio/fseek.c =================================================================== RCS file: /mint/mintlib/stdio/fseek.c,v retrieving revision 1.2 diff -u -r1.2 fseek.c --- stdio/fseek.c 2 Apr 2008 06:44:42 -0000 1.2 +++ stdio/fseek.c 23 May 2008 14:38:36 -0000 @@ -138,3 +138,13 @@ which will move to the target file position before reading or writing. */ return 0; } + +/* Just use fseek for now */ +int +fseeko (stream, offset, whence) + register FILE *stream; + off_t offset; + int whence; +{ + return fseek(stream, (long int)offset, whence); +} Index: stdio/ftell.c =================================================================== RCS file: /mint/mintlib/stdio/ftell.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 ftell.c --- stdio/ftell.c 12 Oct 2000 10:56:54 -0000 1.1.1.1 +++ stdio/ftell.c 23 May 2008 14:38:36 -0000 @@ -52,3 +52,11 @@ return pos; } + +/* Just use ftell for now */ +off_t +ftello (stream) + FILE *stream; +{ + return (off_t)ftell(stream); +} --=-xTTYjDO7wOW/V4fS6/WK--