Skip to content

Commit d00a347

Browse files
committed
Update MinGW so it handles fseeko() similar to Unix.
1 parent 7e518a3 commit d00a347

File tree

5 files changed

+24
-25
lines changed

5 files changed

+24
-25
lines changed

configure

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18999,7 +18999,8 @@ done
1899918999

1900019000
case $host_os in
1900119001
# BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
19002-
bsdi*|netbsd*)
19002+
# Mingw uses macros to access Win32 API calls
19003+
bsdi*|netbsd*|mingw*)
1900319004

1900419005
cat >>confdefs.h <<\_ACEOF
1900519006
#define HAVE_FSEEKO 1

configure.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.582 2009/01/06 17:27:06 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.583 2009/01/07 03:39:33 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -1319,7 +1319,8 @@ AC_CHECK_FUNCS(atexit, [],
13191319
AC_REPLACE_FUNCS(fseeko)
13201320
case $host_os in
13211321
# BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
1322-
bsdi*|netbsd*)
1322+
# Mingw uses macros to access Win32 API calls
1323+
bsdi*|netbsd*|mingw*)
13231324
AC_DEFINE(HAVE_FSEEKO, 1, [Define to 1 because replacement version used.])
13241325
ac_cv_func_fseeko=yes;;
13251326
*)

src/bin/pg_dump/pg_dump.h

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.h,v 1.145 2009/01/01 17:23:54 momjian Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.h,v 1.146 2009/01/07 03:39:33 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -16,25 +16,6 @@
1616

1717
#include "postgres_fe.h"
1818

19-
/*
20-
* WIN32 does not provide 64-bit off_t, but does provide the functions operating
21-
* with 64-bit offsets.
22-
*/
23-
#ifdef WIN32
24-
#define pgoff_t __int64
25-
#undef fseeko
26-
#undef ftello
27-
#ifdef WIN32_ONLY_COMPILER
28-
#define fseeko(stream, offset, origin) _fseeki64(stream, offset, origin)
29-
#define ftello(stream) _ftelli64(stream)
30-
#else
31-
#define fseeko(stream, offset, origin) fseeko64(stream, offset, origin)
32-
#define ftello(stream) ftello64(stream)
33-
#endif
34-
#else
35-
#define pgoff_t off_t
36-
#endif
37-
3819
/*
3920
* pg_dump uses two different mechanisms for identifying database objects:
4021
*

src/include/port.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.123 2009/01/01 17:23:55 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.124 2009/01/07 03:39:33 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -341,10 +341,14 @@ extern int gettimeofday(struct timeval * tp, struct timezone * tzp);
341341
extern char *crypt(const char *key, const char *setting);
342342
#endif
343343

344+
/* WIN32 handled in port/win32.h */
345+
#ifndef WIN32
346+
#define pgoff_t off_t
344347
#if defined(bsdi) || defined(netbsd)
345348
extern int fseeko(FILE *stream, off_t offset, int whence);
346349
extern off_t ftello(FILE *stream);
347350
#endif
351+
#endif
348352

349353
#ifndef HAVE_FSEEKO
350354
#define fseeko(a, b, c) fseek(a, b, c)

src/include/port/win32.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.84 2008/02/17 02:09:31 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.85 2009/01/07 03:39:33 momjian Exp $ */
22

33
#if defined(_MSC_VER) || defined(__BORLANDC__)
44
#define WIN32_ONLY_COMPILER
@@ -190,6 +190,18 @@ struct itimerval
190190

191191
int setitimer(int which, const struct itimerval * value, struct itimerval * ovalue);
192192

193+
/*
194+
* WIN32 does not provide 64-bit off_t, but does provide the functions operating
195+
* with 64-bit offsets.
196+
*/
197+
#define pgoff_t __int64
198+
#ifdef WIN32_ONLY_COMPILER
199+
#define fseeko(stream, offset, origin) _fseeki64(stream, offset, origin)
200+
#define ftello(stream) _ftelli64(stream)
201+
#else
202+
#define fseeko(stream, offset, origin) fseeko64(stream, offset, origin)
203+
#define ftello(stream) ftello64(stream)
204+
#endif
193205

194206
/*
195207
* Supplement to <sys/types.h>.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy