.
So i took the opportunity to fix some stuff:
1. Made the thing compile (typos & needed definitions) with the new pqsecure_* s
tuff, and added fe-secure.c to the win32.mak makefile.
2. Fixed some MULTIBYTE compile errors (when building without MB support).
3. Made it do that you can build with debug info: "nmake -f win32.mak DEBUG=1".
4. Misc small compiler speedup changes.
The resulting .dll has been tested in production, and everything seems ok.
I CC:ed -hackers because i'm not sure about two things:
1. In libpq-int.h I typedef ssize_t as an int because Visual C (v6.0)
doesn't de fine ssize_t. Is that ok, or is there any standard about what
type should be use d for ssize_t?
2. To keep the .dll api consistent regarding MULTIBYTE I just return -1
in fe-connect.c:PQsetClientEncoding() instead of taking away the whole
function. I wonder if i should do any compares with the
conn->client_encoding and return 0 if not hing would have changed (if so
how do i check that?).
Regards
Magnus Naeslund
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.67 2002/06/20 20:29:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.68 2002/07/20 05:43:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
char username[128];
DWORD namesize = sizeof(username) - 1;
- if (GetUserNameFromId(username, &namesize))
+ if (GetUserName(username, &namesize))
name = username;
#else
struct passwd *pw = getpwuid(geteuid());
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.189 2002/07/18 02:02:30 ishii Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.190 2002/07/20 05:43:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
int
PQsetClientEncoding(PGconn *conn, const char *encoding)
{
+
+#ifdef MULTIBYTE
+
char qbuf[128];
static char query[] = "set client_encoding to '%s'";
PGresult *res;
}
PQclear(res);
return (status);
+#else
+ return -1; /* Multibyte support isn't compiled in */
+#endif
}
void
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.9 2002/06/23 20:30:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.10 2002/07/20 05:43:31 momjian Exp $
*
* NOTES
* The client *requires* a valid server certificate. Since
#include "strdup.h"
#endif
+#ifndef WIN32
#include <pwd.h>
+#endif
#include <sys/stat.h>
#ifdef USE_SSL
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq-int.h,v 1.51 2002/06/20 20:29:54 momjian Exp $
+ * $Id: libpq-int.h,v 1.52 2002/07/20 05:43:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef LIBPQ_INT_H
#define LIBPQ_INT_H
+#if defined(WIN32) && (!defined(ssize_t))
+ typedef int ssize_t; /* ssize_t doesn't exist in VC (atleast not VC6) */
+#endif
+
/* We assume libpq-fe.h has already been included. */
#include "postgres_fe.h"
#define WIN32_LEAN_AND_MEAN
+#include <winsock.h>
#include <windows.h>
#include "win32.h"
*
*/
+/* Make stuff compile faster by excluding not used stuff */
+
#define WIN32_LEAN_AND_MEAN
+#define WIN32_EXTRA_LEAN
+#define VC_EXTRALEAN
+#define NOGDI
+#define NOCRYPT
+
#include <windows.h>
#include <winsock.h>
#include <stdio.h>
-#include <winsock.h>
+#ifndef __win32_h_included
+#define __win32_h_included
/*
* strcasecmp() is not in Windows, stricmp is, though
* support for handling Windows Socket errors
*/
extern const char *winsock_strerror(int eno);
+
+
+#endif
!ERROR An invalid configuration was specified.
!ENDIF
+!IFDEF DEBUG
+OPT=/Od
+LOPT=/debug
+DEBUGDEF=/D _DEBUG
+!ELSE
+OPT=/O2
+LOPT=
+DEBUGDEF=/D NDEBUG
+!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
-@erase "$(INTDIR)\fe-lobj.obj"
-@erase "$(INTDIR)\fe-misc.obj"
-@erase "$(INTDIR)\fe-print.obj"
+ -@erase "$(INTDIR)\fe-secure.obj"
-@erase "$(INTDIR)\pqexpbuffer.obj"
-@erase "$(OUTDIR)\libpqdll.obj"
-@erase "$(OUTDIR)\win32.obj"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\..\include" /D "FRONTEND" /D "NDEBUG" /D\
+CPP_PROJ=/nologo /MD /W3 /GX $(OPT) /I "..\..\include" /D "FRONTEND" $(DEBUGDEF) /D\
"WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" /YX\
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c /D "HAVE_VSNPRINTF" /D "HAVE_STRDUP"
CPP_SBRS=.
LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\libpq.lib"
+LIB32_FLAGS=$(LOPT) /nologo /out:"$(OUTDIR)\libpq.lib"
LIB32_OBJS= \
"$(OUTDIR)\win32.obj" \
"$(INTDIR)\dllist.obj" \
"$(INTDIR)\fe-lobj.obj" \
"$(INTDIR)\fe-misc.obj" \
"$(INTDIR)\fe-print.obj" \
+ "$(INTDIR)\fe-secure.obj" \
"$(INTDIR)\pqexpbuffer.obj"
!IFDEF MULTIBYTE
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib wsock32.lib\
- /nologo /subsystem:windows /dll /incremental:no\
+ /nologo /subsystem:windows /dll $(LOPT) /incremental:no\
/pdb:"$(OUTDIR)\libpqdll.pdb" /machine:I386 /out:"$(OUTDIR)\libpq.dll"\
/implib:"$(OUTDIR)\libpqdll.lib" /def:libpqdll.def
LINK32_OBJS= \