From ce53791b2abe9f00fefe4a6272fac9574bca60a6 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 19 Apr 2009 22:37:13 +0000 Subject: [PATCH] Assorted portability fixes for Borland C, from Pavel Golub. --- src/include/libpq/libpq-be.h | 5 ++++- src/include/port/win32.h | 22 ++++++++++++++++++++-- src/interfaces/libpq/bcc32.mak | 2 +- src/interfaces/libpq/libpq-int.h | 5 ++++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index d08f32241b..1e74ddfd95 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -11,7 +11,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.69 2009/01/01 17:23:59 momjian Exp $ + * $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.70 2009/04/19 22:37:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -47,6 +47,9 @@ #ifdef ENABLE_SSPI #define SECURITY_WIN32 +#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER) +#include +#endif #include #undef SECURITY_WIN32 diff --git a/src/include/port/win32.h b/src/include/port/win32.h index 16773c41bf..d3a4a08d6b 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.86 2009/01/21 10:30:02 mha Exp $ */ +/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.87 2009/04/19 22:37:13 tgl Exp $ */ #if defined(_MSC_VER) || defined(__BORLANDC__) #define WIN32_ONLY_COMPILER @@ -297,7 +297,7 @@ extern void pgwin32_unsetenv(const char *); #define putenv(x) pgwin32_putenv(x) #define unsetenv(x) pgwin32_unsetenv(x) -/* Things that exist in MingW headers, but need to be added to MSVC */ +/* Things that exist in MingW headers, but need to be added to MSVC & BCC */ #ifdef WIN32_ONLY_COMPILER typedef long ssize_t; #ifndef __BORLANDC__ @@ -335,4 +335,22 @@ typedef unsigned short mode_t; /* Pulled from Makefile.port in mingw */ #define DLSUFFIX ".dll" +#ifdef __BORLANDC__ + +/* for port/dirent.c */ +#ifndef INVALID_FILE_ATTRIBUTES +#define INVALID_FILE_ATTRIBUTES ((DWORD) -1) +#endif + +/* for port/open.c */ +#ifndef O_RANDOM +#define O_RANDOM 0x0010 /* File access is primarily random */ +#define O_SEQUENTIAL 0x0020 /* File access is primarily sequential */ +#define O_TEMPORARY 0x0040 /* Temporary file bit */ +#define O_SHORT_LIVED 0x1000 /* Temporary storage file, try not to flush */ +#define _O_SHORT_LIVED O_SHORT_LIVED +#endif /* ifndef O_RANDOM */ + +#endif /* __BORLANDC__ */ + #endif diff --git a/src/interfaces/libpq/bcc32.mak b/src/interfaces/libpq/bcc32.mak index f45b245138..f109f27a36 100644 --- a/src/interfaces/libpq/bcc32.mak +++ b/src/interfaces/libpq/bcc32.mak @@ -62,7 +62,7 @@ OUTFILENAME=blibpq USERDEFINES=FRONTEND;NDEBUG;WIN32;_WINDOWS CPP=bcc32.exe -CPP_PROJ = -I$(BCB)\include;..\..\include;..\..\include\port\win32;..\..\include\port\win32_msvc;..\..\port -n"$(INTDIR)" -WD -c -D$(USERDEFINES) -tWM \ +CPP_PROJ = -I..\..\include\port\win32_msvc;$(BCB)\include;..\..\include;..\..\include\port\win32;..\..\port -n"$(INTDIR)" -WD -c -D$(USERDEFINES) -tWM \ -a8 -X -w-use -w-par -w-pia -w-csu -w-aus -w-ccc !IFDEF DEBUG diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index 4d60bf6f4c..597c8e77da 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.139 2009/01/01 17:24:03 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-int.h,v 1.140 2009/04/19 22:37:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -55,6 +55,9 @@ #ifdef ENABLE_SSPI #define SECURITY_WIN32 +#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER) +#include +#endif #include #undef SECURITY_WIN32