* libc/include/stdio.h: Declare fgetpos, fsetpos, fseeko and ftello
with internal (_fpos_t and _off_t) datatypes when compiling newlib. * libc/include/sys/unistd.h: Declare _lseek using _off_t. * libc/reent/lseekr.c (_lseek_r): Use _off_t instead of off_t. * libc/stdio/fseeko.c (fseeko): Ditto. * libc/stdio/ftello.c (ftello): Ditto. * libc/stdio/stdio.c (__swrite): Ditto. (__sseek): Ditto. * libc/stdio/fgetpos.c (fgetpos): Use _fpos_t instead of fpos_t. * libc/stdio/fseek.c (fseek): Ditto. * libc/stdio/fsetpos.c (fsetpos): Ditto. * libc/stdio/ftell.c (ftell): Ditto. * libc/stdio/local.h: Declare __sseek using _off_t.
This commit is contained in:
		| @@ -1,3 +1,19 @@ | ||||
| 2003-03-10  Corinna Vinschen  <corinna@vinschen.de>      | ||||
|  | ||||
| 	* libc/include/stdio.h: Declare fgetpos, fsetpos, fseeko and ftello | ||||
| 	with internal (_fpos_t and _off_t) datatypes when compiling newlib. | ||||
| 	* libc/include/sys/unistd.h: Declare _lseek using _off_t. | ||||
| 	* libc/reent/lseekr.c (_lseek_r): Use _off_t instead of off_t. | ||||
| 	* libc/stdio/fseeko.c (fseeko): Ditto. | ||||
| 	* libc/stdio/ftello.c (ftello): Ditto. | ||||
| 	* libc/stdio/stdio.c (__swrite): Ditto. | ||||
| 	(__sseek): Ditto. | ||||
| 	* libc/stdio/fgetpos.c (fgetpos): Use _fpos_t instead of fpos_t. | ||||
| 	* libc/stdio/fseek.c (fseek): Ditto. | ||||
| 	* libc/stdio/fsetpos.c (fsetpos): Ditto. | ||||
| 	* libc/stdio/ftell.c (ftell): Ditto. | ||||
| 	* libc/stdio/local.h: Declare __sseek using _off_t. | ||||
|  | ||||
| 2003-03-09  Corinna Vinschen  <corinna@vinschen.de> | ||||
|  | ||||
| 	* libc/reent/lseekr.c (lseek_r): Use _off_t instead of off_t. | ||||
|   | ||||
| @@ -195,9 +195,17 @@ int	_EXFUN(puts, (const char *)); | ||||
| int	_EXFUN(ungetc, (int, FILE *)); | ||||
| size_t	_EXFUN(fread, (_PTR, size_t _size, size_t _n, FILE *)); | ||||
| size_t	_EXFUN(fwrite, (const _PTR , size_t _size, size_t _n, FILE *)); | ||||
| #ifdef _COMPILING_NEWLIB | ||||
| int	_EXFUN(fgetpos, (FILE *, _fpos_t *)); | ||||
| #else | ||||
| int	_EXFUN(fgetpos, (FILE *, fpos_t *)); | ||||
| #endif | ||||
| int	_EXFUN(fseek, (FILE *, long, int)); | ||||
| #ifdef _COMPILING_NEWLIB | ||||
| int	_EXFUN(fsetpos, (FILE *, const _fpos_t *)); | ||||
| #else | ||||
| int	_EXFUN(fsetpos, (FILE *, const fpos_t *)); | ||||
| #endif | ||||
| long	_EXFUN(ftell, ( FILE *)); | ||||
| void	_EXFUN(rewind, (FILE *)); | ||||
| void	_EXFUN(clearerr, (FILE *)); | ||||
| @@ -212,8 +220,13 @@ int	_EXFUN(rename, (const char *, const char *)); | ||||
| #endif | ||||
| #ifndef __STRICT_ANSI__ | ||||
| int	_EXFUN(asprintf, (char **, const char *, ...)); | ||||
| #ifdef _COMPILING_NEWLIB | ||||
| int	_EXFUN(fseeko, (FILE *, _off_t, int)); | ||||
| _off_t	_EXFUN(ftello, ( FILE *)); | ||||
| #else | ||||
| int	_EXFUN(fseeko, (FILE *, off_t, int)); | ||||
| off_t	_EXFUN(ftello, ( FILE *)); | ||||
| #endif | ||||
| int	_EXFUN(vfiprintf, (FILE *, const char *, __VALIST)); | ||||
| int	_EXFUN(iprintf, (const char *, ...)); | ||||
| int	_EXFUN(fiprintf, (FILE *, const char *, ...)); | ||||
|   | ||||
| @@ -165,7 +165,7 @@ int     _EXFUN(_close, (int __fildes )); | ||||
| pid_t   _EXFUN(_fork, (void )); | ||||
| pid_t   _EXFUN(_getpid, (void )); | ||||
| int     _EXFUN(_link, (const char *__path1, const char *__path2 )); | ||||
| off_t   _EXFUN(_lseek, (int __fildes, off_t __offset, int __whence )); | ||||
| _off_t   _EXFUN(_lseek, (int __fildes, _off_t __offset, int __whence )); | ||||
| _READ_WRITE_RETURN_TYPE _EXFUN(_read, (int __fd, void *__buf, size_t __nbyte )); | ||||
| void *  _EXFUN(_sbrk,  (ptrdiff_t __incr)); | ||||
| int     _EXFUN(_unlink, (const char *__path )); | ||||
|   | ||||
| @@ -52,10 +52,10 @@ _lseek_r (ptr, fd, pos, whence) | ||||
|      _off_t pos; | ||||
|      int whence; | ||||
| { | ||||
|   off_t ret; | ||||
|   _off_t ret; | ||||
|  | ||||
|   errno = 0; | ||||
|   if ((ret = _lseek (fd, pos, whence)) == (off_t) -1 && errno != 0) | ||||
|   if ((ret = _lseek (fd, pos, whence)) == (_off_t) -1 && errno != 0) | ||||
|     ptr->_errno = errno; | ||||
|   return ret; | ||||
| } | ||||
|   | ||||
| @@ -51,7 +51,7 @@ No supporting OS subroutines are required. | ||||
| int | ||||
| _DEFUN (fgetpos, (fp, pos), | ||||
| 	FILE * fp _AND | ||||
| 	fpos_t * pos) | ||||
| 	_fpos_t * pos) | ||||
| { | ||||
|   _flockfile(fp); | ||||
|   *pos = ftell (fp); | ||||
|   | ||||
| @@ -86,7 +86,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>, | ||||
| #include <sys/stat.h> | ||||
| #include "local.h" | ||||
|  | ||||
| #define	POS_ERR	(-(fpos_t)1) | ||||
| #define	POS_ERR	(-(_fpos_t)1) | ||||
|  | ||||
| /* | ||||
|  * Seek the given file to the given offset. | ||||
| @@ -100,8 +100,8 @@ fseek (fp, offset, whence) | ||||
|      int whence; | ||||
| { | ||||
|   struct _reent *ptr; | ||||
|   fpos_t _EXFUN ((*seekfn), (void *, fpos_t, int)); | ||||
|   fpos_t target, curoff; | ||||
|   _fpos_t _EXFUN ((*seekfn), (void *, _fpos_t, int)); | ||||
|   _fpos_t target, curoff; | ||||
|   size_t n; | ||||
|   struct stat st; | ||||
|   int havepos; | ||||
| @@ -149,7 +149,7 @@ fseek (fp, offset, whence) | ||||
| 	curoff = fp->_offset; | ||||
|       else | ||||
| 	{ | ||||
| 	  curoff = (*seekfn) (fp->_cookie, (fpos_t) 0, SEEK_CUR); | ||||
| 	  curoff = (*seekfn) (fp->_cookie, (_fpos_t) 0, SEEK_CUR); | ||||
| 	  if (curoff == -1L) | ||||
| 	    { | ||||
| 	      _funlockfile(fp); | ||||
|   | ||||
| @@ -20,7 +20,7 @@ | ||||
| int | ||||
| fseeko (fp, offset, whence) | ||||
|         register FILE *fp; | ||||
|         off_t offset; | ||||
|         _off_t offset; | ||||
|         int whence; | ||||
| { | ||||
|   /* for now we simply cast since off_t should be long */ | ||||
|   | ||||
| @@ -44,7 +44,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>, | ||||
| int | ||||
| _DEFUN (fsetpos, (iop, pos), | ||||
| 	FILE * iop _AND | ||||
| 	_CONST fpos_t * pos) | ||||
| 	_CONST _fpos_t * pos) | ||||
| { | ||||
|   int x = fseek (iop, *pos, SEEK_SET); | ||||
|  | ||||
|   | ||||
| @@ -87,7 +87,7 @@ long | ||||
| _DEFUN (ftell, (fp), | ||||
| 	register FILE * fp) | ||||
| { | ||||
|   fpos_t pos; | ||||
|   _fpos_t pos; | ||||
|  | ||||
|   _flockfile(fp); | ||||
|  | ||||
| @@ -109,7 +109,7 @@ _DEFUN (ftell, (fp), | ||||
|     pos = fp->_offset; | ||||
|   else | ||||
|     { | ||||
|       pos = (*fp->_seek) (fp->_cookie, (fpos_t) 0, SEEK_CUR); | ||||
|       pos = (*fp->_seek) (fp->_cookie, (_fpos_t) 0, SEEK_CUR); | ||||
|       if (pos == -1L) | ||||
|         { | ||||
|           _funlockfile(fp); | ||||
|   | ||||
| @@ -17,10 +17,10 @@ | ||||
|  | ||||
| #include <stdio.h> | ||||
|  | ||||
| off_t | ||||
| _off_t | ||||
| _DEFUN (ftello, (fp), | ||||
| 	register FILE * fp) | ||||
| { | ||||
|   /* for now we simply cast since off_t should be long */ | ||||
|   return (off_t)ftell (fp); | ||||
|   return (_off_t)ftell (fp); | ||||
| } | ||||
|   | ||||
| @@ -33,7 +33,7 @@ extern int    _EXFUN(__sflags,(struct _reent *,_CONST char*, int*)); | ||||
| extern int    _EXFUN(__srefill,(FILE *)); | ||||
| extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(void *, char *, int)); | ||||
| extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(void *, char const *, int)); | ||||
| extern fpos_t _EXFUN(__sseek,(void *, fpos_t, int)); | ||||
| extern _fpos_t _EXFUN(__sseek,(void *, _fpos_t, int)); | ||||
| extern int    _EXFUN(__sclose,(void *)); | ||||
| extern int    _EXFUN(__stextmode,(int)); | ||||
| extern void   _EXFUN(__sinit,(struct _reent *)); | ||||
|   | ||||
| @@ -72,7 +72,7 @@ __swrite (cookie, buf, n) | ||||
| #endif | ||||
|  | ||||
|   if (fp->_flags & __SAPP) | ||||
|     (void) _lseek_r (fp->_data, fp->_file, (off_t) 0, SEEK_END); | ||||
|     (void) _lseek_r (fp->_data, fp->_file, (_off_t) 0, SEEK_END); | ||||
|   fp->_flags &= ~__SOFF;	/* in case O_APPEND mode is set */ | ||||
|  | ||||
| #ifdef __SCLE | ||||
| @@ -90,16 +90,16 @@ __swrite (cookie, buf, n) | ||||
|   return w; | ||||
| } | ||||
|  | ||||
| fpos_t | ||||
| _fpos_t | ||||
| __sseek (cookie, offset, whence) | ||||
|      _PTR cookie; | ||||
|      fpos_t offset; | ||||
|      _fpos_t offset; | ||||
|      int whence; | ||||
| { | ||||
|   register FILE *fp = (FILE *) cookie; | ||||
|   register off_t ret; | ||||
|   register _off_t ret; | ||||
|  | ||||
|   ret = _lseek_r (fp->_data, fp->_file, (off_t) offset, whence); | ||||
|   ret = _lseek_r (fp->_data, fp->_file, (_off_t) offset, whence); | ||||
|   if (ret == -1L) | ||||
|     fp->_flags &= ~__SOFF; | ||||
|   else | ||||
|   | ||||
		Reference in New Issue
	
	Block a user