Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbd041d8

Browse files
committed
multi-byte fix from Tatsuo Ishii
1 parentd73f73a commitbd041d8

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

‎src/backend/utils/adt/varchar.c

Lines changed: 7 additions & 8 deletions
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.40 1998/09/2501:46:21 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.41 1998/09/2515:51:02 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -147,14 +147,7 @@ bpchar(char *s, int32 len)
147147
if ((len==-1)|| (len==VARSIZE(s)))
148148
returns;
149149

150-
#ifdefMULTIBYTE
151-
/* truncate multi-byte string in a way not to break
152-
multi-byte boundary */
153-
rlen=pg_mbcliplen(VARDATA(s),len-VARHDRSZ,len-VARHDRSZ);
154-
len=rlen+VARHDRSZ;
155-
#else
156150
rlen=len-VARHDRSZ;
157-
#endif
158151

159152
if (rlen>4096)
160153
elog(ERROR,"bpchar: length of char() must be less than 4096");
@@ -167,7 +160,13 @@ bpchar(char *s, int32 len)
167160
result= (char*)palloc(len);
168161
VARSIZE(result)=len;
169162
r=VARDATA(result);
163+
#ifdefMULTIBYTE
164+
/* truncate multi-byte string in a way not to break
165+
multi-byte boundary */
166+
slen=pg_mbcliplen(VARDATA(s),rlen,rlen);
167+
#else
170168
slen=VARSIZE(s)-VARHDRSZ;
169+
#endif
171170
s=VARDATA(s);
172171

173172
#ifdefSTRINGDEBUG

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp