File tree 1 file changed +25
-4
lines changed
1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change 1
1
/* ----------
2
2
* lztext.c -
3
3
*
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 $
5
5
*
6
6
* Text type with internal LZ compressed representation. Uses the
7
7
* standard PostgreSQL compression method.
21
21
#include "utils/builtins.h"
22
22
#include "utils/palloc.h"
23
23
#include "utils/pg_lzcompress.h"
24
-
24
+ #ifdef MULTIBYTE
25
+ #include "mb/pg_wchar.h"
26
+ #endif
25
27
26
28
/* ----------
27
29
* lztextin -
@@ -134,18 +136,39 @@ lztextout(lztext *lz)
134
136
int32
135
137
lztextlen (lztext * lz )
136
138
{
139
+ #ifdef MULTIBYTE
140
+ unsigned char * s1 ,* s2 ;
141
+ int len ;
142
+ int l ;
143
+ int wl ;
144
+ #endif
137
145
/* ----------
138
146
* Handle NULL
139
147
* ----------
140
148
*/
141
149
if (lz == NULL )
142
150
return 0 ;
143
151
152
+ #ifdef MULTIBYTE
153
+ len = 0 ;
154
+ s1 = s2 = (unsigned char * )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
144
166
/* ----------
145
167
* without multibyte support, it's the remembered rawsize
146
168
* ----------
147
169
*/
148
170
return PGLZ_RAW_SIZE (lz );
171
+ #endif
149
172
}
150
173
151
174
@@ -228,8 +251,6 @@ text_lztext(text *txt)
228
251
}
229
252
230
253
return result ;
231
-
232
-
233
254
}
234
255
235
256
You can’t perform that action at this time.
0 commit comments