Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e1ebac3

Browse files
committed
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
1 parent c77a29a commit e1ebac3

File tree

7 files changed

+58
-10
lines changed

7 files changed

+58
-10
lines changed

src/backend/utils/adt/varchar.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.41 1998/09/25 15:51:02 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.42 1998/10/06 03:02:20 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -163,7 +163,11 @@ bpchar(char *s, int32 len)
163163
#ifdef MULTIBYTE
164164
/* truncate multi-byte string in a way not to break
165165
multi-byte boundary */
166-
slen = pg_mbcliplen(VARDATA(s), rlen, rlen);
166+
if (VARSIZE(s) > len) {
167+
slen = pg_mbcliplen(VARDATA(s), VARSIZE(s)-VARHDRSZ, rlen);
168+
} else {
169+
slen = VARSIZE(s) - VARHDRSZ;
170+
}
167171
#else
168172
slen = VARSIZE(s) - VARHDRSZ;
169173
#endif

src/backend/utils/mb/common.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@
22
* This file contains some public functions
33
* usable for both the backend and the frontend.
44
* Tatsuo Ishii
5-
* $Id: common.c,v 1.2 1998/09/01 04:33:19 momjian Exp $ */
5+
* $Id: common.c,v 1.3 1998/10/06 03:02:21 momjian Exp $ */
6+
7+
#include <stdlib.h>
8+
9+
#ifdef WIN32
10+
#include "win32.h"
11+
#else
12+
#if !defined(NO_UNISTD_H)
13+
#include <unistd.h>
14+
#endif
15+
#endif
616

7-
#include <stdio.h>
817
#include <string.h>
918

1019
#include "mb/pg_wchar.h"

src/bin/psql/win32.mak

+8
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ CLEAN :
2929
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D\
3030
"_MBCS" /Fp"$(INTDIR)\psql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
3131
/I ..\..\include /I ..\..\interfaces\libpq
32+
33+
!IFDEF MULTIBYTE
34+
!IFNDEF MBFLAGS
35+
MBFLAGS="-DMULTIBYTE=$(MULTIBYTE)"
36+
!ENDIF
37+
CPP_PROJ=$(MBFLAGS) $(CPP_PROJ)
38+
!ENDIF
39+
3240
CPP_OBJS=.\Release/
3341
CPP_SBRS=.
3442

src/interfaces/libpq/fe-print.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* didn't really belong there.
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.13 1998/10/04 20:46:39 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.14 1998/10/06 03:02:25 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -513,7 +513,17 @@ PQmblen(unsigned char *s)
513513
return (pg_encoding_mblen(encoding, s));
514514
}
515515

516-
#endif
516+
#else
517+
518+
#ifdef WIN32
519+
int
520+
PQmblen(unsigned char *s)
521+
{
522+
}
523+
#endif /* WIN32 */
524+
525+
526+
#endif /* MULTIBYTE */
517527

518528
static void
519529
do_field(PQprintOpt *po, PGresult *res,

src/interfaces/libpq/libpqdll.def

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,5 @@ EXPORTS
6363
lo_unlink @ 60
6464
lo_import @ 61
6565
lo_export @ 62
66-
PQresultErrorMessage @ 63
66+
pgresStatus @ 63
67+
PQmblen @ 64

src/interfaces/libpq/win32.mak

+13-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ CLEAN :
3333
-@erase "$(OUTDIR)\libpq.lib"
3434
-@erase "$(OUTDIR)\libpq.dll"
3535
-@erase "$(OUTDIR)\libpq.res"
36-
-@erase "$(OUTDIR)\vc*.*"
36+
-@erase "vc50.pch"
3737
-@erase "$(OUTDIR)\libpq.pch"
3838
-@erase "$(OUTDIR)\libpqdll.exp"
3939
-@erase "$(OUTDIR)\libpqdll.lib"
@@ -44,6 +44,14 @@ CLEAN :
4444
CPP_PROJ=/nologo /ML /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D\
4545
"WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" /YX\
4646
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
47+
48+
!IFDEF MULTIBYTE
49+
!IFNDEF MBFLAGS
50+
MBFLAGS="-DMULTIBYTE=$(MULTIBYTE)"
51+
!ENDIF
52+
CPP_PROJ = $(CPP_PROJ) $(MBFLAGS)
53+
!ENDIF
54+
4755
CPP_OBJS=.\Release/
4856
CPP_SBRS=.
4957

@@ -58,6 +66,10 @@ LIB32_OBJS= \
5866
"$(INTDIR)\fe-misc.obj" \
5967
"$(INTDIR)\fe-print.obj"
6068

69+
!IFDEF MULTIBYTE
70+
LIB32_OBJS = $(LIB32_OBJS) $(INTDIR)\common.obj $(INTDIR)\wchar.obj $(INTDIR)\conv.obj
71+
!ENDIF
72+
6173
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res"
6274

6375
LINK32=link.exe

src/win32.mak

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ NULL=
1010
NULL=nul
1111
!ENDIF
1212

13+
!IFDEF MULTIBYTE
14+
MAKEMACRO = "MULTIBYTE=$(MULTIBYTE)"
15+
!ENDIF
16+
1317
ALL:
1418
cd interfaces\libpq
15-
nmake /f win32.mak
19+
nmake /f win32.mak $(MAKEMACRO)
1620
cd ..\..\bin\psql
17-
nmake /f win32.mak
21+
nmake /f win32.mak $(MAKEMACRO)
1822
cd ..\..
1923
echo All Win32 parts have been built!

0 commit comments

Comments
 (0)