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

Commit61a93ed

Browse files
committed
Add multi-byte support to lztextlen()
1 parent95997e1 commit61a93ed

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

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

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* ----------
22
* lztext.c -
33
*
4-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/lztext.c,v 1.2 1999/11/17 22:18:45 wieck Exp $
4+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/lztext.c,v 1.3 1999/11/24 03:45:12 ishii Exp $
55
*
66
*Text type with internal LZ compressed representation. Uses the
77
*standard PostgreSQL compression method.
@@ -21,7 +21,9 @@
2121
#include"utils/builtins.h"
2222
#include"utils/palloc.h"
2323
#include"utils/pg_lzcompress.h"
24-
24+
#ifdefMULTIBYTE
25+
#include"mb/pg_wchar.h"
26+
#endif
2527

2628
/* ----------
2729
* lztextin -
@@ -134,18 +136,39 @@ lztextout(lztext *lz)
134136
int32
135137
lztextlen(lztext*lz)
136138
{
139+
#ifdefMULTIBYTE
140+
unsignedchar*s1,*s2;
141+
intlen;
142+
intl;
143+
intwl;
144+
#endif
137145
/* ----------
138146
* Handle NULL
139147
* ----------
140148
*/
141149
if (lz==NULL)
142150
return0;
143151

152+
#ifdefMULTIBYTE
153+
len=0;
154+
s1=s2= (unsignedchar*)lztextout(lz);
155+
l=PGLZ_RAW_SIZE(lz);
156+
while (l>0)
157+
{
158+
wl=pg_mblen(s1);
159+
l-=wl;
160+
s1+=wl;
161+
len++;
162+
}
163+
pfree((char*)s2);
164+
return (len);
165+
#else
144166
/* ----------
145167
* without multibyte support, it's the remembered rawsize
146168
* ----------
147169
*/
148170
returnPGLZ_RAW_SIZE(lz);
171+
#endif
149172
}
150173

151174

@@ -228,8 +251,6 @@ text_lztext(text *txt)
228251
}
229252

230253
returnresult;
231-
232-
233254
}
234255

235256

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp