[MPlayer-cvslog] r21874 - in trunk: configure osdep/Makefile osdep/fseeko.c osdep/ftello.c
diego
subversion at mplayerhq.hu
Wed Jan 10 20:35:41 CET 2007
Author: diego
Date: Wed Jan 10 20:35:41 2007
New Revision: 21874
Added:
trunk/osdep/ftello.c
- copied, changed from r21867, /trunk/osdep/fseeko.c
Modified:
trunk/configure
trunk/osdep/Makefile
trunk/osdep/fseeko.c
Log:
Split fseeko.c into fseeko.c and ftello.c, move #ifdefs into the build system.
Modified: trunk/configure
==============================================================================
--- trunk/configure (original)
+++ trunk/configure Wed Jan 10 20:35:41 2007
@@ -3439,8 +3439,10 @@
cc_check && _fseeko=yes
if test "$_fseeko" = yes ; then
_def_fseeko='#define HAVE_FSEEKO 1'
+ _need_fseeko=no
else
_def_fseeko='#undef HAVE_FSEEKO'
+ _need_fseeko=yes
fi
echores "$_fseeko"
@@ -7234,8 +7236,10 @@
cc_check && _ftello=yes
if test "$_ftello" = yes ; then
_def_ftello='#define HAVE_FTELLO 1'
+ _need_ftello=no
else
_def_ftello='#undef HAVE_FTELLO'
+ _need_ftello=yes
fi
echores "$_ftello"
@@ -7479,6 +7483,8 @@
HAVE_SYS_MMAN_H = _mman
+NEED_FSEEKO = $_need_fseeko
+NEED_FTELLO = $_need_ftello
NEED_GLOB = $_need_glob
NEED_SCANDIR = $_need_scandir
NEED_SETENV = $_need_setenv
Modified: trunk/osdep/Makefile
==============================================================================
--- trunk/osdep/Makefile (original)
+++ trunk/osdep/Makefile Wed Jan 10 20:35:41 2007
@@ -4,7 +4,6 @@
LIBNAME = libosdep.a
SRCS= strl.c \
- fseeko.c \
SRCS-$(HAVE_SYS_MMAN_H) += mmap_anon.c
SRCS-$(MACOSX_FINDER_SUPPORT) += macosx_finder_args.c
@@ -12,6 +11,8 @@
SRCS-$(STREAM_CACHE) += shmem.c
endif
+SRCS-$(NEED_FSEEKO) += fseeko.c
+SRCS-$(NEED_FTELLO) += ftello.c
SRCS-$(NEED_GETTIMEOFDAY) += gettimeofday.c
SRCS-$(NEED_SCANDIR) += scandir.c
SRCS-$(NEED_SETENV) += setenv.c
Modified: trunk/osdep/fseeko.c
==============================================================================
--- trunk/osdep/fseeko.c (original)
+++ trunk/osdep/fseeko.c Wed Jan 10 20:35:41 2007
@@ -4,13 +4,11 @@
*/
#include "config.h"
-
-#if !defined(HAVE_FSEEKO) || !defined(HAVE_FTELLO)
+
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
-#endif
#ifdef WIN32
#define flockfile
@@ -25,7 +23,6 @@
* This is thread-safe on BSD/OS using flockfile/funlockfile.
*/
-#ifndef HAVE_FSEEKO
int
fseeko(FILE *stream, off_t offset, int whence)
{
@@ -68,17 +65,3 @@
funlockfile(stream);
return -1;
}
-#endif
-
-
-#ifndef HAVE_FTELLO
-off_t
-ftello(FILE *stream)
-{
- fpos_t floc;
-
- if (fgetpos(stream, &floc) != 0)
- return -1;
- return floc;
-}
-#endif
Copied: trunk/osdep/ftello.c (from r21867, /trunk/osdep/fseeko.c)
==============================================================================
--- /trunk/osdep/fseeko.c (original)
+++ trunk/osdep/ftello.c Wed Jan 10 20:35:41 2007
@@ -1,77 +1,13 @@
/*
- * fseeko.c
- * 64-bit versions of fseeko/ftello() for systems which do not have them
+ * ftello.c
+ * 64-bit version of ftello() for systems which do not have it
*/
#include "config.h"
-
-#if !defined(HAVE_FSEEKO) || !defined(HAVE_FTELLO)
+
#include <stdio.h>
#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#endif
-
-#ifdef WIN32
-#define flockfile
-#define funlockfile
-#endif
-
-/*
- * On BSD/OS and NetBSD (and perhaps others), off_t and fpos_t are the
- * same. Standards say off_t is an arithmetic type, but not necessarily
- * integral, while fpos_t might be neither.
- *
- * This is thread-safe on BSD/OS using flockfile/funlockfile.
- */
-
-#ifndef HAVE_FSEEKO
-int
-fseeko(FILE *stream, off_t offset, int whence)
-{
- fpos_t floc;
- struct stat filestat;
-
- switch (whence)
- {
- case SEEK_CUR:
- flockfile(stream);
- if (fgetpos(stream, &floc) != 0)
- goto failure;
- floc += offset;
- if (fsetpos(stream, &floc) != 0)
- goto failure;
- funlockfile(stream);
- return 0;
- break;
- case SEEK_SET:
- if (fsetpos(stream, &offset) != 0)
- return -1;
- return 0;
- break;
- case SEEK_END:
- flockfile(stream);
- if (fstat(fileno(stream), &filestat) != 0)
- goto failure;
- floc = filestat.st_size;
- if (fsetpos(stream, &floc) != 0)
- goto failure;
- funlockfile(stream);
- return 0;
- break;
- default:
- errno = EINVAL;
- return -1;
- }
-
-failure:
- funlockfile(stream);
- return -1;
-}
-#endif
-
-#ifndef HAVE_FTELLO
off_t
ftello(FILE *stream)
{
@@ -81,4 +17,3 @@
return -1;
return floc;
}
-#endif
More information about the MPlayer-cvslog
mailing list