crt: Remove the unused mingw-fseek.c
The functions in this file, __mingw_fseek/__mingw_fseeko64/__mingw_fwrite
haven't ever been used within mingw-w64 throughout the SCM history,
but were originally intended to work around issues with seeking past
the end of files on Win9x.
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 95d5ae9..a49bb07 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -442,7 +442,7 @@
misc/feraiseexcept.c misc/fesetenv.c misc/fesetexceptflag.c misc/fesetround.c misc/fetestexcept.c \
misc/feupdateenv.c misc/ftruncate.c misc/fwide.c misc/getlogin.c misc/getopt.c \
misc/gettimeofday.c misc/imaxabs.c misc/imaxdiv.c misc/isblank.c misc/iswblank.c \
- misc/mempcpy.c misc/mingw-aligned-malloc.c misc/mingw-fseek.c \
+ misc/mempcpy.c misc/mingw-aligned-malloc.c \
misc/mingw_matherr.c misc/mingw_mbwc_convert.c misc/mingw_usleep.c misc/mingw_wcstod.c misc/mingw_wcstof.c \
misc/mingw_wcstold.c misc/mkstemp.c misc/seterrno.c misc/sleep.c \
misc/strnlen.c misc/strsafe.c \
diff --git a/mingw-w64-crt/misc/mingw-fseek.c b/mingw-w64-crt/misc/mingw-fseek.c
deleted file mode 100644
index 3ae7d85..0000000
--- a/mingw-w64-crt/misc/mingw-fseek.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is part of the mingw-w64 runtime package.
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
- */
-#include <windows.h>
-#include <stdio.h>
-#include <io.h>
-#include <stdlib.h>
-
-#define ZEROBLOCKSIZE 512
-static int __mingw_fseek_called;
-
-int __mingw_fseek (FILE *fp, int offset, int whence);
-
-int
-__mingw_fseek (FILE *fp, int offset, int whence)
-{
-# undef fseek
- __mingw_fseek_called = 1;
- return fseek (fp, offset, whence);
-}
-
-int __mingw_fseeko64 (FILE *fp, long offset, int whence);
-
-int
-__mingw_fseeko64 (FILE *fp, long offset, int whence)
-{
-# undef fseeko64
- __mingw_fseek_called = 1;
- return fseeko64 (fp, offset, whence);
-}
-
-size_t __mingw_fwrite (const void *buffer, size_t size, size_t count, FILE *fp);
-
-size_t
-__mingw_fwrite (const void *buffer, size_t size, size_t count, FILE *fp)
-{
-# undef fwrite
- if ((_osver & 0x8000) && __mingw_fseek_called)
- {
- ULARGE_INTEGER actual_length;
- LARGE_INTEGER current_position;
-
- memset (¤t_position, 0, sizeof (LARGE_INTEGER));
- __mingw_fseek_called = 0;
- fflush (fp);
- actual_length.LowPart = GetFileSize ((HANDLE) _get_osfhandle (fileno (fp)),
- &actual_length.HighPart);
- if (actual_length.LowPart == 0xFFFFFFFF
- && GetLastError() != NO_ERROR )
- return -1;
- current_position.LowPart = SetFilePointer ((HANDLE) _get_osfhandle (fileno (fp)),
- current_position.LowPart,
- ¤t_position.HighPart,
- FILE_CURRENT);
- if (current_position.LowPart == 0xFFFFFFFF
- && GetLastError() != NO_ERROR )
- return -1;
-
-#ifdef DEBUG
- printf ("__mingw_fwrite: current %I64u, actual %I64u\n",
- current_position.QuadPart, actual_length.QuadPart);
-#endif /* DEBUG */
- if ((size_t)current_position.QuadPart > (size_t)actual_length.QuadPart)
- {
- static char __mingw_zeros[ZEROBLOCKSIZE];
- long long numleft;
-
- SetFilePointer ((HANDLE) _get_osfhandle (fileno (fp)),
- 0, 0, FILE_END);
- numleft = current_position.QuadPart - actual_length.QuadPart;
-
-#ifdef DEBUG
- printf ("__mingw_fwrite: Seeking %I64d bytes past end\n", numleft);
-#endif /* DEBUG */
- while (numleft > 0LL)
- {
- DWORD nzeros = (numleft > ZEROBLOCKSIZE)
- ? ZEROBLOCKSIZE : numleft;
- DWORD written;
- if (! WriteFile ((HANDLE) _get_osfhandle (fileno (fp)),
- __mingw_zeros, nzeros, &written, NULL))
- {
- /* Best we can hope for, or at least DJ says so. */
- SetFilePointer ((HANDLE) _get_osfhandle (fileno (fp)),
- 0, 0, FILE_BEGIN);
- return -1;
- }
- if (written < nzeros)
- {
- /* Likewise. */
- SetFilePointer ((HANDLE) _get_osfhandle (fileno (fp)),
- 0, 0, FILE_BEGIN);
- return -1;
- }
-
- numleft -= written;
- }
- FlushFileBuffers ((HANDLE) _get_osfhandle (fileno (fp)));
- }
- }
- return fwrite (buffer, size, count, fp);
-}