diff options
author | Bruce Momjian <bruce@momjian.us> | 1998-10-06 03:02:29 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1998-10-06 03:02:29 +0000 |
commit | e1ebac319d1491e54dd8e3e457d48aa766771366 (patch) | |
tree | 48a57b8f779c2b8a1d68ef953f4b173168d5c3a6 /src/backend | |
parent | c77a29a14efe69851a087989e3520ed560fa8862 (diff) | |
download | postgresql-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/backend')
-rw-r--r-- | src/backend/utils/adt/varchar.c | 8 | ||||
-rw-r--r-- | src/backend/utils/mb/common.c | 13 |
2 files changed, 17 insertions, 4 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" |