aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1998-10-06 03:02:29 +0000
committerBruce Momjian <bruce@momjian.us>1998-10-06 03:02:29 +0000
commite1ebac319d1491e54dd8e3e457d48aa766771366 (patch)
tree48a57b8f779c2b8a1d68ef953f4b173168d5c3a6 /src
parentc77a29a14efe69851a087989e3520ed560fa8862 (diff)
downloadpostgresql-e1ebac319d1491e54dd8e3e457d48aa766771366.tar.gz
postgresql-e1ebac319d1491e54dd8e3e457d48aa766771366.zip
Here are the patches against the current source tree. I have run the
regression test on a FreeBSD box with both non-MULTIBYTE and MULTIBYTE-enabled, and confirmed that the results are same. However I do not tested on PCs(I don't have access to win). Please let me know if the patches break anything on PCs. Also please note that the patch for varchar.c is a fix for a nasty bug of char(n) types that I introduced and I believe at least this should be applied. Tatsuo Ishii
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/adt/varchar.c8
-rw-r--r--src/backend/utils/mb/common.c13
-rw-r--r--src/bin/psql/win32.mak8
-rw-r--r--src/interfaces/libpq/fe-print.c14
-rw-r--r--src/interfaces/libpq/libpqdll.def3
-rw-r--r--src/interfaces/libpq/win32.mak14
-rw-r--r--src/win32.mak8
7 files changed, 58 insertions, 10 deletions
diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c
index 8d2352358a0..6413f488eb8 100644
--- a/src/backend/utils/adt/varchar.c
+++ b/src/backend/utils/adt/varchar.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.41 1998/09/25 15:51:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.42 1998/10/06 03:02:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -163,7 +163,11 @@ bpchar(char *s, int32 len)
#ifdef MULTIBYTE
/* truncate multi-byte string in a way not to break
multi-byte boundary */
- slen = pg_mbcliplen(VARDATA(s), rlen, rlen);
+ if (VARSIZE(s) > len) {
+ slen = pg_mbcliplen(VARDATA(s), VARSIZE(s)-VARHDRSZ, rlen);
+ } else {
+ slen = VARSIZE(s) - VARHDRSZ;
+ }
#else
slen = VARSIZE(s) - VARHDRSZ;
#endif
diff --git a/src/backend/utils/mb/common.c b/src/backend/utils/mb/common.c
index dc71122ed38..b6bcae3b156 100644
--- a/src/backend/utils/mb/common.c
+++ b/src/backend/utils/mb/common.c
@@ -2,9 +2,18 @@
* This file contains some public functions
* usable for both the backend and the frontend.
* Tatsuo Ishii
- * $Id: common.c,v 1.2 1998/09/01 04:33:19 momjian Exp $ */
+ * $Id: common.c,v 1.3 1998/10/06 03:02:21 momjian Exp $ */
+
+#include <stdlib.h>
+
+#ifdef WIN32
+#include "win32.h"
+#else
+#if !defined(NO_UNISTD_H)
+#include <unistd.h>
+#endif
+#endif
-#include <stdio.h>
#include <string.h>
#include "mb/pg_wchar.h"
diff --git a/src/bin/psql/win32.mak b/src/bin/psql/win32.mak
index f414594e18b..65d7e192136 100644
--- a/src/bin/psql/win32.mak
+++ b/src/bin/psql/win32.mak
@@ -29,6 +29,14 @@ CLEAN :
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D\
"_MBCS" /Fp"$(INTDIR)\psql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
/I ..\..\include /I ..\..\interfaces\libpq
+
+!IFDEF MULTIBYTE
+!IFNDEF MBFLAGS
+MBFLAGS="-DMULTIBYTE=$(MULTIBYTE)"
+!ENDIF
+CPP_PROJ=$(MBFLAGS) $(CPP_PROJ)
+!ENDIF
+
CPP_OBJS=.\Release/
CPP_SBRS=.
diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c
index fc998d9458b..a987f2039bf 100644
--- a/src/interfaces/libpq/fe-print.c
+++ b/src/interfaces/libpq/fe-print.c
@@ -9,7 +9,7 @@
* didn't really belong there.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.13 1998/10/04 20:46:39 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.14 1998/10/06 03:02:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -513,7 +513,17 @@ PQmblen(unsigned char *s)
return (pg_encoding_mblen(encoding, s));
}
-#endif
+#else
+
+#ifdef WIN32
+int
+PQmblen(unsigned char *s)
+{
+}
+#endif /* WIN32 */
+
+
+#endif /* MULTIBYTE */
static void
do_field(PQprintOpt *po, PGresult *res,
diff --git a/src/interfaces/libpq/libpqdll.def b/src/interfaces/libpq/libpqdll.def
index a7c9b28ef80..ee8b6384928 100644
--- a/src/interfaces/libpq/libpqdll.def
+++ b/src/interfaces/libpq/libpqdll.def
@@ -63,4 +63,5 @@ EXPORTS
lo_unlink @ 60
lo_import @ 61
lo_export @ 62
- PQresultErrorMessage @ 63
+ pgresStatus @ 63
+ PQmblen @ 64
diff --git a/src/interfaces/libpq/win32.mak b/src/interfaces/libpq/win32.mak
index 71d57dc4643..7260f977ab8 100644
--- a/src/interfaces/libpq/win32.mak
+++ b/src/interfaces/libpq/win32.mak
@@ -33,7 +33,7 @@ CLEAN :
-@erase "$(OUTDIR)\libpq.lib"
-@erase "$(OUTDIR)\libpq.dll"
-@erase "$(OUTDIR)\libpq.res"
- -@erase "$(OUTDIR)\vc*.*"
+ -@erase "vc50.pch"
-@erase "$(OUTDIR)\libpq.pch"
-@erase "$(OUTDIR)\libpqdll.exp"
-@erase "$(OUTDIR)\libpqdll.lib"
@@ -44,6 +44,14 @@ CLEAN :
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D\
"WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" /YX\
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+
+!IFDEF MULTIBYTE
+!IFNDEF MBFLAGS
+MBFLAGS="-DMULTIBYTE=$(MULTIBYTE)"
+!ENDIF
+CPP_PROJ = $(CPP_PROJ) $(MBFLAGS)
+!ENDIF
+
CPP_OBJS=.\Release/
CPP_SBRS=.
@@ -58,6 +66,10 @@ LIB32_OBJS= \
"$(INTDIR)\fe-misc.obj" \
"$(INTDIR)\fe-print.obj"
+!IFDEF MULTIBYTE
+LIB32_OBJS = $(LIB32_OBJS) $(INTDIR)\common.obj $(INTDIR)\wchar.obj $(INTDIR)\conv.obj
+!ENDIF
+
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res"
LINK32=link.exe
diff --git a/src/win32.mak b/src/win32.mak
index 48edd8e33d5..a7264acf543 100644
--- a/src/win32.mak
+++ b/src/win32.mak
@@ -10,10 +10,14 @@ NULL=
NULL=nul
!ENDIF
+!IFDEF MULTIBYTE
+MAKEMACRO = "MULTIBYTE=$(MULTIBYTE)"
+!ENDIF
+
ALL:
cd interfaces\libpq
- nmake /f win32.mak
+ nmake /f win32.mak $(MAKEMACRO)
cd ..\..\bin\psql
- nmake /f win32.mak
+ nmake /f win32.mak $(MAKEMACRO)
cd ..\..
echo All Win32 parts have been built!