Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
88896855
Commit
88896855
authored
Sep 24, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suppress signed-vs-unsigned-char warnings.
parent
54a8af05
Changes
53
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
53 changed files
with
503 additions
and
515 deletions
+503
-515
src/backend/catalog/pg_conversion.c
src/backend/catalog/pg_conversion.c
+3
-3
src/backend/commands/copy.c
src/backend/commands/copy.c
+9
-12
src/backend/libpq/pqcomm.c
src/backend/libpq/pqcomm.c
+8
-8
src/backend/libpq/pqformat.c
src/backend/libpq/pqformat.c
+7
-7
src/backend/postmaster/pgstat.c
src/backend/postmaster/pgstat.c
+2
-3
src/backend/tcop/fastpath.c
src/backend/tcop/fastpath.c
+2
-4
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+2
-4
src/backend/utils/adt/ascii.c
src/backend/utils/adt/ascii.c
+5
-5
src/backend/utils/adt/encode.c
src/backend/utils/adt/encode.c
+37
-37
src/backend/utils/adt/like.c
src/backend/utils/adt/like.c
+28
-33
src/backend/utils/adt/like_match.c
src/backend/utils/adt/like_match.c
+5
-5
src/backend/utils/adt/regexp.c
src/backend/utils/adt/regexp.c
+15
-15
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/selfuncs.c
+29
-30
src/backend/utils/adt/varbit.c
src/backend/utils/adt/varbit.c
+2
-2
src/backend/utils/adt/varlena.c
src/backend/utils/adt/varlena.c
+3
-3
src/backend/utils/mb/conv.c
src/backend/utils/mb/conv.c
+2
-2
src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
...d/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
+5
-5
src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
...s/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
+53
-53
src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
...utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
+5
-5
src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
...ils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
+13
-13
src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
...utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
+5
-5
src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
...ils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
+15
-15
src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
.../conversion_procs/latin2_and_win1250/latin2_and_win1250.c
+15
-15
src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
...d/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
+13
-13
src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
...utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
...d/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
...mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
+13
-13
src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
...ils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
...ils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
...ils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
...ils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
...s/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
...end/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
...s/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
.../conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
...utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
...d/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
...end/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c
...s/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_win1252/utf8_and_win1252.c
...s/mb/conversion_procs/utf8_and_win1252/utf8_and_win1252.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c
...s/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_win1258/utf8_and_win1258.c
...s/mb/conversion_procs/utf8_and_win1258/utf8_and_win1258.c
+5
-5
src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c
...ils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c
+5
-5
src/backend/utils/mb/mbutils.c
src/backend/utils/mb/mbutils.c
+35
-35
src/backend/utils/mb/wchar.c
src/backend/utils/mb/wchar.c
+31
-25
src/bin/pg_dump/pg_backup_custom.c
src/bin/pg_dump/pg_backup_custom.c
+6
-8
src/bin/psql/mbprint.c
src/bin/psql/mbprint.c
+13
-13
src/bin/psql/mbprint.h
src/bin/psql/mbprint.h
+3
-5
src/bin/psql/print.c
src/bin/psql/print.c
+6
-6
src/include/mb/pg_wchar.h
src/include/mb/pg_wchar.h
+14
-14
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-exec.c
+3
-3
src/interfaces/libpq/fe-misc.c
src/interfaces/libpq/fe-misc.c
+3
-3
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-fe.h
+3
-3
No files found.
src/backend/catalog/pg_conversion.c
View file @
88896855
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.2
5 2005/07/07 20:39:57
tgl Exp $
* $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.2
6 2005/09/24 17:53:12
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -291,8 +291,8 @@ pg_convert_using(PG_FUNCTION_ARGS)
Oid
convoid
;
HeapTuple
tuple
;
Form_pg_conversion
body
;
unsigned
char
*
str
;
unsigned
char
*
result
;
char
*
str
;
char
*
result
;
int
len
;
/* Convert input string to null-terminated form */
...
...
src/backend/commands/copy.c
View file @
88896855
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.2
49 2005/09/01 15:34:31
tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.2
50 2005/09/24 17:53:12
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1194,9 +1194,8 @@ CopyTo(CopyState cstate)
* encoding, because it will be sent directly with CopySendString.
*/
if
(
cstate
->
need_transcoding
)
null_print_client
=
(
char
*
)
pg_server_to_client
((
unsigned
char
*
)
cstate
->
null_print
,
cstate
->
null_print_len
);
null_print_client
=
pg_server_to_client
(
cstate
->
null_print
,
cstate
->
null_print_len
);
/* if a header has been requested send the line */
if
(
cstate
->
header_line
)
...
...
@@ -2025,8 +2024,8 @@ CopyReadLine(CopyState cstate)
{
char
*
cvt
;
cvt
=
(
char
*
)
pg_client_to_server
((
unsigned
char
*
)
cstate
->
line_buf
.
data
,
cstate
->
line_buf
.
len
);
cvt
=
pg_client_to_server
(
cstate
->
line_buf
.
data
,
cstate
->
line_buf
.
len
);
if
(
cvt
!=
cstate
->
line_buf
.
data
)
{
/* transfer converted data back to line_buf */
...
...
@@ -2057,7 +2056,7 @@ CopyReadLineText(CopyState cstate)
int
copy_buf_len
;
bool
need_data
;
bool
hit_eof
;
unsigned
char
s
[
2
];
char
s
[
2
];
s
[
1
]
=
0
;
...
...
@@ -2331,7 +2330,7 @@ CopyReadLineCSV(CopyState cstate)
int
copy_buf_len
;
bool
need_data
;
bool
hit_eof
;
unsigned
char
s
[
2
];
char
s
[
2
];
bool
in_quote
=
false
,
last_was_esc
=
false
;
char
quotec
=
cstate
->
quote
[
0
];
char
escapec
=
cstate
->
escape
[
0
];
...
...
@@ -3100,8 +3099,7 @@ CopyAttributeOutText(CopyState cstate, char *server_string)
int
mblen
;
if
(
cstate
->
need_transcoding
)
string
=
(
char
*
)
pg_server_to_client
((
unsigned
char
*
)
server_string
,
strlen
(
server_string
));
string
=
pg_server_to_client
(
server_string
,
strlen
(
server_string
));
else
string
=
server_string
;
...
...
@@ -3170,8 +3168,7 @@ CopyAttributeOutCSV(CopyState cstate, char *server_string,
use_quote
=
true
;
if
(
cstate
->
need_transcoding
)
string
=
(
char
*
)
pg_server_to_client
((
unsigned
char
*
)
server_string
,
strlen
(
server_string
));
string
=
pg_server_to_client
(
server_string
,
strlen
(
server_string
));
else
string
=
server_string
;
...
...
src/backend/libpq/pqcomm.c
View file @
88896855
...
...
@@ -30,7 +30,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.1
79 2005/09/12 02:26:31
tgl Exp $
* $PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.1
80 2005/09/24 17:53:14
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -106,11 +106,11 @@ static char sock_path[MAXPGPATH];
#define PQ_BUFFER_SIZE 8192
static
unsigned
char
PqSendBuffer
[
PQ_BUFFER_SIZE
];
static
char
PqSendBuffer
[
PQ_BUFFER_SIZE
];
static
int
PqSendPointer
;
/* Next index to store a byte in
* PqSendBuffer */
static
unsigned
char
PqRecvBuffer
[
PQ_BUFFER_SIZE
];
static
char
PqRecvBuffer
[
PQ_BUFFER_SIZE
];
static
int
PqRecvPointer
;
/* Next index to read a byte from
* PqRecvBuffer */
static
int
PqRecvLength
;
/* End of data available in PqRecvBuffer */
...
...
@@ -482,7 +482,7 @@ Setup_AF_UNIX(void)
elog
(
WARNING
,
"configuration item unix_socket_group is not supported on this platform"
);
#else
char
*
endptr
;
unsigned
long
int
val
;
unsigned
long
val
;
gid_t
gid
;
val
=
strtoul
(
Unix_socket_group
,
&
endptr
,
10
);
...
...
@@ -741,7 +741,7 @@ pq_getbyte(void)
if
(
pq_recvbuf
())
/* If nothing in buffer, then recv some */
return
EOF
;
/* Failed to recv data */
}
return
PqRecvBuffer
[
PqRecvPointer
++
];
return
(
unsigned
char
)
PqRecvBuffer
[
PqRecvPointer
++
];
}
/* --------------------------------
...
...
@@ -758,7 +758,7 @@ pq_peekbyte(void)
if
(
pq_recvbuf
())
/* If nothing in buffer, then recv some */
return
EOF
;
/* Failed to recv data */
}
return
PqRecvBuffer
[
PqRecvPointer
];
return
(
unsigned
char
)
PqRecvBuffer
[
PqRecvPointer
];
}
/* --------------------------------
...
...
@@ -1029,8 +1029,8 @@ internal_flush(void)
{
static
int
last_reported_send_errno
=
0
;
unsigned
char
*
bufptr
=
PqSendBuffer
;
unsigned
char
*
bufend
=
PqSendBuffer
+
PqSendPointer
;
char
*
bufptr
=
PqSendBuffer
;
char
*
bufend
=
PqSendBuffer
+
PqSendPointer
;
while
(
bufptr
<
bufend
)
{
...
...
src/backend/libpq/pqformat.c
View file @
88896855
...
...
@@ -24,7 +24,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.3
8 2005/09/24 15:34:07
tgl Exp $
* $PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.3
9 2005/09/24 17:53:14
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -137,7 +137,7 @@ pq_sendcountedtext(StringInfo buf, const char *str, int slen,
int
extra
=
countincludesself
?
4
:
0
;
char
*
p
;
p
=
(
char
*
)
pg_server_to_client
((
unsigned
char
*
)
str
,
slen
);
p
=
pg_server_to_client
(
str
,
slen
);
if
(
p
!=
str
)
/* actual conversion has been done? */
{
slen
=
strlen
(
p
);
...
...
@@ -167,7 +167,7 @@ pq_sendtext(StringInfo buf, const char *str, int slen)
{
char
*
p
;
p
=
(
char
*
)
pg_server_to_client
((
unsigned
char
*
)
str
,
slen
);
p
=
pg_server_to_client
(
str
,
slen
);
if
(
p
!=
str
)
/* actual conversion has been done? */
{
slen
=
strlen
(
p
);
...
...
@@ -192,7 +192,7 @@ pq_sendstring(StringInfo buf, const char *str)
char
*
p
;
p
=
(
char
*
)
pg_server_to_client
((
unsigned
char
*
)
str
,
slen
);
p
=
pg_server_to_client
(
str
,
slen
);
if
(
p
!=
str
)
/* actual conversion has been done? */
{
slen
=
strlen
(
p
);
...
...
@@ -408,7 +408,7 @@ pq_puttextmessage(char msgtype, const char *str)
int
slen
=
strlen
(
str
);
char
*
p
;
p
=
(
char
*
)
pg_server_to_client
((
unsigned
char
*
)
str
,
slen
);
p
=
pg_server_to_client
(
str
,
slen
);
if
(
p
!=
str
)
/* actual conversion has been done? */
{
(
void
)
pq_putmessage
(
msgtype
,
p
,
strlen
(
p
)
+
1
);
...
...
@@ -635,7 +635,7 @@ pq_getmsgtext(StringInfo msg, int rawbytes, int *nbytes)
str
=
&
msg
->
data
[
msg
->
cursor
];
msg
->
cursor
+=
rawbytes
;
p
=
(
char
*
)
pg_client_to_server
((
unsigned
char
*
)
str
,
rawbytes
);
p
=
pg_client_to_server
(
str
,
rawbytes
);
if
(
p
!=
str
)
/* actual conversion has been done? */
*
nbytes
=
strlen
(
p
);
else
...
...
@@ -675,7 +675,7 @@ pq_getmsgstring(StringInfo msg)
errmsg
(
"invalid string in message"
)));
msg
->
cursor
+=
slen
+
1
;
return
(
const
char
*
)
pg_client_to_server
((
unsigned
char
*
)
str
,
slen
);
return
pg_client_to_server
(
str
,
slen
);
}
/* --------------------------------
...
...
src/backend/postmaster/pgstat.c
View file @
88896855
...
...
@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2005, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.10
7 2005/08/30 02:47:37
tgl Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.10
8 2005/09/24 17:53:14
tgl Exp $
* ----------
*/
#include "postgres.h"
...
...
@@ -788,8 +788,7 @@ pgstat_report_activity(const char *what)
return
;
len
=
strlen
(
what
);
len
=
pg_mbcliplen
((
const
unsigned
char
*
)
what
,
len
,
PGSTAT_ACTIVITY_SIZE
-
1
);
len
=
pg_mbcliplen
(
what
,
len
,
PGSTAT_ACTIVITY_SIZE
-
1
);
memcpy
(
msg
.
m_what
,
what
,
len
);
msg
.
m_what
[
len
]
=
'\0'
;
...
...
src/backend/tcop/fastpath.c
View file @
88896855
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.8
1 2005/07/10 21:13:58
tgl Exp $
* $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.8
2 2005/09/24 17:53:15
tgl Exp $
*
* NOTES
* This cruft is the server side of PQfn.
...
...
@@ -473,9 +473,7 @@ parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip,
* have to do encoding conversion before calling the typinput
* routine, though.
*/
pstring
=
(
char
*
)
pg_client_to_server
((
unsigned
char
*
)
abuf
.
data
,
argsize
);
pstring
=
pg_client_to_server
(
abuf
.
data
,
argsize
);
fcinfo
->
arg
[
i
]
=
OidFunctionCall3
(
typinput
,
CStringGetDatum
(
pstring
),
...
...
src/backend/tcop/postgres.c
View file @
88896855
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.46
1 2005/09/22 15:33:36 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.46
2 2005/09/24 17:53:15 tgl
Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
...
...
@@ -1548,9 +1548,7 @@ exec_bind_message(StringInfo input_message)
* We have to do encoding conversion before
* calling the typinput routine.
*/
pstring
=
(
char
*
)
pg_client_to_server
((
unsigned
char
*
)
pbuf
.
data
,
plength
);
pstring
=
pg_client_to_server
(
pbuf
.
data
,
plength
);
params
[
i
].
value
=
OidFunctionCall3
(
typinput
,
CStringGetDatum
(
pstring
),
...
...
src/backend/utils/adt/ascii.c
View file @
88896855
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1999-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/ascii.c,v 1.2
4 2005/01/01 05:43:07 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/ascii.c,v 1.2
5 2005/09/24 17:53:15 tgl
Exp $
*
*-----------------------------------------------------------------------
*/
...
...
@@ -42,7 +42,7 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *dest, int
/*
* ISO-8859-1 <range: 160 -- 255>
*/
ascii
=
" cL Y
\"
Ca -R 'u ., ?AAAAAAACEEEEIIII NOOOOOxOUUUUYTBaaaaaaaceeeeiiii nooooo/ouuuuyty"
;
ascii
=
(
const
unsigned
char
*
)
" cL Y
\"
Ca -R 'u ., ?AAAAAAACEEEEIIII NOOOOOxOUUUUYTBaaaaaaaceeeeiiii nooooo/ouuuuyty"
;
range
=
RANGE_160
;
}
else
if
(
enc
==
PG_LATIN2
)
...
...
@@ -50,7 +50,7 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *dest, int
/*
* ISO-8859-2 <range: 160 -- 255>
*/
ascii
=
" A L LS
\"
SSTZ-ZZ a,l'ls ,sstz
\"
zzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTBraaaalccceeeeiiddnnoooo/ruuuuyt."
;
ascii
=
(
const
unsigned
char
*
)
" A L LS
\"
SSTZ-ZZ a,l'ls ,sstz
\"
zzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTBraaaalccceeeeiiddnnoooo/ruuuuyt."
;
range
=
RANGE_160
;
}
else
if
(
enc
==
PG_LATIN9
)
...
...
@@ -58,7 +58,7 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *dest, int
/*
* ISO-8859-15 <range: 160 -- 255>
*/
ascii
=
" cL YS sCa -R Zu .z EeY?AAAAAAACEEEEIIII NOOOOOxOUUUUYTBaaaaaaaceeeeiiii nooooo/ouuuuyty"
;
ascii
=
(
const
unsigned
char
*
)
" cL YS sCa -R Zu .z EeY?AAAAAAACEEEEIIII NOOOOOxOUUUUYTBaaaaaaaceeeeiiii nooooo/ouuuuyty"
;
range
=
RANGE_160
;
}
else
if
(
enc
==
PG_WIN1250
)
...
...
@@ -66,7 +66,7 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *dest, int
/*
* Window CP1250 <range: 128 -- 255>
*/
ascii
=
" '
\"
%S<STZZ `'
\"\"
.-- s>stzz L A
\"
CS -RZ ,l'u .,as L
\"
lzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTBraaaalccceeeeiiddnnoooo/ruuuuyt "
;
ascii
=
(
const
unsigned
char
*
)
" '
\"
%S<STZZ `'
\"\"
.-- s>stzz L A
\"
CS -RZ ,l'u .,as L
\"
lzRAAAALCCCEEEEIIDDNNOOOOxRUUUUYTBraaaalccceeeeiiddnnoooo/ruuuuyt "
;
range
=
RANGE_128
;
}
else
...
...
src/backend/utils/adt/encode.c
View file @
88896855
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/encode.c,v 1.1
4 2005/01/01 05:43:07 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/encode.c,v 1.1
5 2005/09/24 17:53:15 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -20,10 +20,10 @@
struct
pg_encoding
{
unsigned
(
*
encode_len
)
(
const
uint8
*
data
,
unsigned
dlen
);
unsigned
(
*
decode_len
)
(
const
uint8
*
data
,
unsigned
dlen
);
unsigned
(
*
encode
)
(
const
uint8
*
data
,
unsigned
dlen
,
uint8
*
res
);
unsigned
(
*
decode
)
(
const
uint8
*
data
,
unsigned
dlen
,
uint8
*
res
);
unsigned
(
*
encode_len
)
(
const
char
*
data
,
unsigned
dlen
);
unsigned
(
*
decode_len
)
(
const
char
*
data
,
unsigned
dlen
);
unsigned
(
*
encode
)
(
const
char
*
data
,
unsigned
dlen
,
char
*
res
);
unsigned
(
*
decode
)
(
const
char
*
data
,
unsigned
dlen
,
char
*
res
);
};
static
struct
pg_encoding
*
pg_find_encoding
(
const
char
*
name
);
...
...
@@ -123,9 +123,9 @@ static const int8 hexlookup[128] = {
};
static
unsigned
hex_encode
(
const
uint8
*
src
,
unsigned
len
,
uint8
*
dst
)
hex_encode
(
const
char
*
src
,
unsigned
len
,
char
*
dst
)
{
const
uint8
*
end
=
src
+
len
;
const
char
*
end
=
src
+
len
;
while
(
src
<
end
)
{
...
...
@@ -136,28 +136,28 @@ hex_encode(const uint8 *src, unsigned len, uint8 *dst)
return
len
*
2
;
}
static
uint8
get_hex
(
unsigned
c
)
static
char
get_hex
(
char
c
)
{
int
res
=
-
1
;
if
(
c
>
0
&&
c
<
127
)
res
=
hexlookup
[
c
];
res
=
hexlookup
[
(
unsigned
char
)
c
];
if
(
res
<
0
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
errmsg
(
"invalid hexadecimal digit:
\"
%c
\"
"
,
c
)));
return
(
uint8
)
res
;
return
(
char
)
res
;
}
static
unsigned
hex_decode
(
const
uint8
*
src
,
unsigned
len
,
uint8
*
dst
)
hex_decode
(
const
char
*
src
,
unsigned
len
,
char
*
dst
)
{
const
uint8
*
s
,
const
char
*
s
,
*
srcend
;
uint8
v1
,
char
v1
,
v2
,
*
p
=
dst
;
...
...
@@ -185,13 +185,13 @@ hex_decode(const uint8 *src, unsigned len, uint8 *dst)
}
static
unsigned
hex_enc_len
(
const
uint8
*
src
,
unsigned
srclen
)
hex_enc_len
(
const
char
*
src
,
unsigned
srclen
)
{
return
srclen
<<
1
;
}
static
unsigned
hex_dec_len
(
const
uint8
*
src
,
unsigned
srclen
)
hex_dec_len
(
const
char
*
src
,
unsigned
srclen
)
{
return
srclen
>>
1
;
}
...
...
@@ -200,7 +200,7 @@ hex_dec_len(const uint8 *src, unsigned srclen)
* BASE64
*/
static
const
unsigned
char
_base64
[]
=
static
const
char
_base64
[]
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
;
static
const
int8
b64lookup
[
128
]
=
{
...
...
@@ -215,11 +215,11 @@ static const int8 b64lookup[128] = {
};
static
unsigned
b64_encode
(
const
uint8
*
src
,
unsigned
len
,
uint8
*
dst
)
b64_encode
(
const
char
*
src
,
unsigned
len
,
char
*
dst
)
{
uint8
*
p
,
char
*
p
,
*
lend
=
dst
+
76
;
const
uint8
*
s
,
const
char
*
s
,
*
end
=
src
+
len
;
int
pos
=
2
;
uint32
buf
=
0
;
...
...
@@ -229,7 +229,7 @@ b64_encode(const uint8 *src, unsigned len, uint8 *dst)
while
(
s
<
end
)
{
buf
|=
*
s
<<
(
pos
<<
3
);
buf
|=
(
unsigned
char
)
*
s
<<
(
pos
<<
3
);
pos
--
;
s
++
;
...
...
@@ -262,12 +262,12 @@ b64_encode(const uint8 *src, unsigned len, uint8 *dst)
}
static
unsigned
b64_decode
(
const
uint8
*
src
,
unsigned
len
,
uint8
*
dst
)
b64_decode
(
const
char
*
src
,
unsigned
len
,
char
*
dst
)
{
const
char
*
srcend
=
src
+
len
,
*
s
=
src
;
uint8
*
p
=
dst
;
unsigned
c
;
char
*
p
=
dst
;
char
c
;
int
b
=
0
;
uint32
buf
=
0
;
int
pos
=
0
,
...
...
@@ -300,7 +300,7 @@ b64_decode(const uint8 *src, unsigned len, uint8 *dst)
{
b
=
-
1
;
if
(
c
>
0
&&
c
<
127
)
b
=
b64lookup
[
c
];
b
=
b64lookup
[
(
unsigned
char
)
c
];
if
(
b
<
0
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_INVALID_PARAMETER_VALUE
),
...
...
@@ -331,14 +331,14 @@ b64_decode(const uint8 *src, unsigned len, uint8 *dst)
static
unsigned
b64_enc_len
(
const
uint8
*
src
,
unsigned
srclen
)
b64_enc_len
(
const
char
*
src
,
unsigned
srclen
)
{
/* 3 bytes will be converted to 4, linefeed after 76 chars */
return
(
srclen
+
2
)
*
4
/
3
+
srclen
/
(
76
*
3
/
4
);
}
static
unsigned
b64_dec_len
(
const
uint8
*
src
,
unsigned
srclen
)
b64_dec_len
(
const
char
*
src
,
unsigned
srclen
)
{
return
(
srclen
*
3
)
>>
2
;
}
...
...
@@ -358,10 +358,10 @@ b64_dec_len(const uint8 *src, unsigned srclen)
#define DIG(VAL) ((VAL) + '0')
static
unsigned
esc_encode
(
const
uint8
*
src
,
unsigned
srclen
,
uint8
*
dst
)
esc_encode
(
const
char
*
src
,
unsigned
srclen
,
char
*
dst
)
{
const
uint8
*
end
=
src
+
srclen
;
uint8
*
rp
=
dst
;
const
char
*
end
=
src
+
srclen
;
char
*
rp
=
dst
;
int
len
=
0
;
while
(
src
<
end
)
...
...
@@ -395,10 +395,10 @@ esc_encode(const uint8 *src, unsigned srclen, uint8 *dst)
}
static
unsigned
esc_decode
(
const
uint8
*
src
,
unsigned
srclen
,
uint8
*
dst
)
esc_decode
(
const
char
*
src
,
unsigned
srclen
,
char
*
dst
)
{
const
uint8
*
end
=
src
+
srclen
;
uint8
*
rp
=
dst
;
const
char
*
end
=
src
+
srclen
;
char
*
rp
=
dst
;
int
len
=
0
;
while
(
src
<
end
)
...
...
@@ -443,9 +443,9 @@ esc_decode(const uint8 *src, unsigned srclen, uint8 *dst)
}
static
unsigned
esc_enc_len
(
const
uint8
*
src
,
unsigned
srclen
)
esc_enc_len
(
const
char
*
src
,
unsigned
srclen
)
{
const
uint8
*
end
=
src
+
srclen
;
const
char
*
end
=
src
+
srclen
;
int
len
=
0
;
while
(
src
<
end
)
...
...
@@ -464,9 +464,9 @@ esc_enc_len(const uint8 *src, unsigned srclen)
}
static
unsigned
esc_dec_len
(
const
uint8
*
src
,
unsigned
srclen
)
esc_dec_len
(
const
char
*
src
,
unsigned
srclen
)
{
const
uint8
*
end
=
src
+
srclen
;
const
char
*
end
=
src
+
srclen
;
int
len
=
0
;
while
(
src
<
end
)
...
...
src/backend/utils/adt/like.c
View file @
88896855
...
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/like.c,v 1.6
0 2005/05/25 22:59:33 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/like.c,v 1.6
1 2005/09/24 17:53:15 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -28,18 +28,13 @@
#define LIKE_ABORT (-1)
static
int
MatchText
(
unsigned
char
*
t
,
int
tlen
,
unsigned
char
*
p
,
int
plen
);
static
int
MatchTextIC
(
unsigned
char
*
t
,
int
tlen
,
unsigned
char
*
p
,
int
plen
);
static
int
MatchBytea
(
unsigned
char
*
t
,
int
tlen
,
unsigned
char
*
p
,
int
plen
);
static
int
MatchText
(
char
*
t
,
int
tlen
,
char
*
p
,
int
plen
);
static
int
MatchTextIC
(
char
*
t
,
int
tlen
,
char
*
p
,
int
plen
);
static
int
MatchBytea
(
char
*
t
,
int
tlen
,
char
*
p
,
int
plen
);
static
text
*
do_like_escape
(
text
*
,
text
*
);
static
int
MBMatchText
(
unsigned
char
*
t
,
int
tlen
,
unsigned
char
*
p
,
int
plen
);
static
int
MBMatchTextIC
(
unsigned
char
*
t
,
int
tlen
,
unsigned
char
*
p
,
int
plen
);
static
int
MBMatchText
(
char
*
t
,
int
tlen
,
char
*
p
,
int
plen
);
static
int
MBMatchTextIC
(
char
*
t
,
int
tlen
,
char
*
p
,
int
plen
);
static
text
*
MB_do_like_escape
(
text
*
,
text
*
);
/*--------------------
...
...
@@ -48,7 +43,7 @@ static text *MB_do_like_escape(text *, text *);
*--------------------
*/
static
int
wchareq
(
unsigned
char
*
p1
,
unsigned
char
*
p2
)
wchareq
(
char
*
p1
,
char
*
p2
)
{
int
p1_len
;
...
...
@@ -78,9 +73,9 @@ wchareq(unsigned char *p1, unsigned char *p2)
#define CHARMAX 0x80
static
int
iwchareq
(
unsigned
char
*
p1
,
unsigned
char
*
p2
)
iwchareq
(
char
*
p1
,
char
*
p2
)
{
int
c1
[
2
],
pg_wchar
c1
[
2
],
c2
[
2
];
int
l
;
...
...
@@ -88,14 +83,14 @@ iwchareq(unsigned char *p1, unsigned char *p2)
* short cut. if *p1 and *p2 is lower than CHARMAX, then we could
* assume they are ASCII
*/
if
(
*
p1
<
CHARMAX
&&
*
p2
<
CHARMAX
)
return
(
tolower
(
*
p1
)
==
tolower
(
*
p2
));
if
(
(
unsigned
char
)
*
p1
<
CHARMAX
&&
(
unsigned
char
)
*
p2
<
CHARMAX
)
return
(
tolower
(
(
unsigned
char
)
*
p1
)
==
tolower
((
unsigned
char
)
*
p2
));
/*
* if one of them is an ASCII while the other is not, then they must
* be different characters
*/
else
if
(
*
p1
<
CHARMAX
||
*
p2
<
CHARMAX
)
else
if
(
(
unsigned
char
)
*
p1
<
CHARMAX
||
(
unsigned
char
)
*
p2
<
CHARMAX
)
return
(
0
);
/*
...
...
@@ -103,10 +98,10 @@ iwchareq(unsigned char *p1, unsigned char *p2)
* characters
*/
l
=
pg_mblen
(
p1
);
(
void
)
pg_mb2wchar_with_len
(
p1
,
(
pg_wchar
*
)
c1
,
l
);
(
void
)
pg_mb2wchar_with_len
(
p1
,
c1
,
l
);
c1
[
0
]
=
tolower
(
c1
[
0
]);
l
=
pg_mblen
(
p2
);
(
void
)
pg_mb2wchar_with_len
(
p2
,
(
pg_wchar
*
)
c2
,
l
);
(
void
)
pg_mb2wchar_with_len
(
p2
,
c2
,
l
);
c2
[
0
]
=
tolower
(
c2
[
0
]);
return
(
c1
[
0
]
==
c2
[
0
]);
}
...
...
@@ -135,7 +130,7 @@ iwchareq(unsigned char *p1, unsigned char *p2)
#undef do_like_escape
#define CHAREQ(p1, p2) (*(p1) == *(p2))
#define ICHAREQ(p1, p2) (tolower(
*(p1)) == tolower(
*(p2)))
#define ICHAREQ(p1, p2) (tolower(
(unsigned char) *(p1)) == tolower((unsigned char)
*(p2)))
#define NextChar(p, plen) ((p)++, (plen)--)
#define CopyAdvChar(dst, src, srclen) (*(dst)++ = *(src)++, (srclen)--)
...
...
@@ -154,7 +149,7 @@ namelike(PG_FUNCTION_ARGS)
Name
str
=
PG_GETARG_NAME
(
0
);
text
*
pat
=
PG_GETARG_TEXT_P
(
1
);
bool
result
;
unsigned
char
*
s
,
char
*
s
,
*
p
;
int
slen
,
plen
;
...
...
@@ -178,7 +173,7 @@ namenlike(PG_FUNCTION_ARGS)
Name
str
=
PG_GETARG_NAME
(
0
);
text
*
pat
=
PG_GETARG_TEXT_P
(
1
);
bool
result
;
unsigned
char
*
s
,
char
*
s
,
*
p
;
int
slen
,
plen
;
...
...
@@ -202,7 +197,7 @@ textlike(PG_FUNCTION_ARGS)
text
*
str
=
PG_GETARG_TEXT_P
(
0
);
text
*
pat
=
PG_GETARG_TEXT_P
(
1
);
bool
result
;
unsigned
char
*
s
,
char
*
s
,
*
p
;
int
slen
,
plen
;
...
...
@@ -226,7 +221,7 @@ textnlike(PG_FUNCTION_ARGS)
text
*
str
=
PG_GETARG_TEXT_P
(
0
);
text
*
pat
=
PG_GETARG_TEXT_P
(
1
);
bool
result
;
unsigned
char
*
s
,
char
*
s
,
*
p
;
int
slen
,
plen
;
...
...
@@ -250,7 +245,7 @@ bytealike(PG_FUNCTION_ARGS)
bytea
*
str
=
PG_GETARG_BYTEA_P
(
0
);
bytea
*
pat
=
PG_GETARG_BYTEA_P
(
1
);
bool
result
;
unsigned
char
*
s
,
char
*
s
,
*
p
;
int
slen
,
plen
;
...
...
@@ -271,7 +266,7 @@ byteanlike(PG_FUNCTION_ARGS)
bytea
*
str
=
PG_GETARG_BYTEA_P
(
0
);
bytea
*
pat
=
PG_GETARG_BYTEA_P
(
1
);
bool
result
;
unsigned
char
*
s
,
char
*
s
,
*
p
;
int
slen
,
plen
;
...
...
@@ -296,7 +291,7 @@ nameiclike(PG_FUNCTION_ARGS)
Name
str
=
PG_GETARG_NAME
(
0
);
text
*
pat
=
PG_GETARG_TEXT_P
(
1
);
bool
result
;
unsigned
char
*
s
,
char
*
s
,
*
p
;
int
slen
,
plen
;
...
...
@@ -320,7 +315,7 @@ nameicnlike(PG_FUNCTION_ARGS)
Name
str
=
PG_GETARG_NAME
(
0
);
text
*
pat
=
PG_GETARG_TEXT_P
(
1
);
bool
result
;
unsigned
char
*
s
,
char
*
s
,
*
p
;
int
slen
,
plen
;
...
...
@@ -344,7 +339,7 @@ texticlike(PG_FUNCTION_ARGS)
text
*
str
=
PG_GETARG_TEXT_P
(
0
);
text
*
pat
=
PG_GETARG_TEXT_P
(
1
);
bool
result
;
unsigned
char
*
s
,
char
*
s
,
*
p
;
int
slen
,
plen
;
...
...
@@ -368,7 +363,7 @@ texticnlike(PG_FUNCTION_ARGS)
text
*
str
=
PG_GETARG_TEXT_P
(
0
);
text
*
pat
=
PG_GETARG_TEXT_P
(
1
);
bool
result
;
unsigned
char
*
s
,
char
*
s
,
*
p
;
int
slen
,
plen
;
...
...
@@ -415,7 +410,7 @@ like_escape_bytea(PG_FUNCTION_ARGS)
bytea
*
pat
=
PG_GETARG_BYTEA_P
(
0
);
bytea
*
esc
=
PG_GETARG_BYTEA_P
(
1
);
bytea
*
result
;
unsigned
char
*
p
,
char
*
p
,
*
e
,
*
r
;
int
plen
,
...
...
@@ -500,7 +495,7 @@ like_escape_bytea(PG_FUNCTION_ARGS)
}
}
VARATT_SIZEP
(
result
)
=
r
-
((
unsigned
char
*
)
result
);
VARATT_SIZEP
(
result
)
=
r
-
((
char
*
)
result
);
PG_RETURN_BYTEA_P
(
result
);
}
...
...
@@ -509,7 +504,7 @@ like_escape_bytea(PG_FUNCTION_ARGS)
* Same as above, but specifically for bytea (binary) datatype
*/
static
int
MatchBytea
(
unsigned
char
*
t
,
int
tlen
,
unsigned
char
*
p
,
int
plen
)
MatchBytea
(
char
*
t
,
int
tlen
,
char
*
p
,
int
plen
)
{
/* Fast path for match-everything pattern */
if
((
plen
==
1
)
&&
(
*
p
==
'%'
))
...
...
src/backend/utils/adt/like_match.c
View file @
88896855
...
...
@@ -19,7 +19,7 @@
* Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.1
0 2004/12/31 22:01:22 pgsq
l Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.1
1 2005/09/24 17:53:15 tg
l Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -71,7 +71,7 @@
*/
static
int
MatchText
(
unsigned
char
*
t
,
int
tlen
,
unsigned
char
*
p
,
int
plen
)
MatchText
(
char
*
t
,
int
tlen
,
char
*
p
,
int
plen
)
{
/* Fast path for match-everything pattern */
if
((
plen
==
1
)
&&
(
*
p
==
'%'
))
...
...
@@ -157,7 +157,7 @@ MatchText(unsigned char *t, int tlen, unsigned char *p, int plen)
* Same as above, but ignore case
*/
static
int
MatchTextIC
(
unsigned
char
*
t
,
int
tlen
,
unsigned
char
*
p
,
int
plen
)
MatchTextIC
(
char
*
t
,
int
tlen
,
char
*
p
,
int
plen
)
{
/* Fast path for match-everything pattern */
if
((
plen
==
1
)
&&
(
*
p
==
'%'
))
...
...
@@ -247,7 +247,7 @@ static text *
do_like_escape
(
text
*
pat
,
text
*
esc
)
{
text
*
result
;
unsigned
char
*
p
,
char
*
p
,
*
e
,
*
r
;
int
plen
,
...
...
@@ -332,7 +332,7 @@ do_like_escape(text *pat, text *esc)
}
}
VARATT_SIZEP
(
result
)
=
r
-
((
unsigned
char
*
)
result
);
VARATT_SIZEP
(
result
)
=
r
-
((
char
*
)
result
);
return
result
;
}
src/backend/utils/adt/regexp.c
View file @
88896855
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.5
7 2005/07/10 04:54:30 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.5
8 2005/09/24 17:53:15 tgl
Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
...
...
@@ -134,7 +134,7 @@ RE_compile_and_cache(text *text_re, int cflags)
/* Convert pattern string to wide characters */
pattern
=
(
pg_wchar
*
)
palloc
((
text_re_len
-
VARHDRSZ
+
1
)
*
sizeof
(
pg_wchar
));
pattern_len
=
pg_mb2wchar_with_len
(
(
unsigned
char
*
)
VARDATA
(
text_re
),
pattern_len
=
pg_mb2wchar_with_len
(
VARDATA
(
text_re
),
pattern
,
text_re_len
-
VARHDRSZ
);
...
...
@@ -206,7 +206,7 @@ RE_compile_and_cache(text *text_re, int cflags)
* convert to array of pg_wchar which is what Spencer's regex package wants.
*/
static
bool
RE_compile_and_execute
(
text
*
text_re
,
unsigned
char
*
dat
,
int
dat_len
,
RE_compile_and_execute
(
text
*
text_re
,
char
*
dat
,
int
dat_len
,
int
cflags
,
int
nmatch
,
regmatch_t
*
pmatch
)
{
pg_wchar
*
data
;
...
...
@@ -287,7 +287,7 @@ nameregexeq(PG_FUNCTION_ARGS)
text
*
p
=
PG_GETARG_TEXT_P
(
1
);
PG_RETURN_BOOL
(
RE_compile_and_execute
(
p
,
(
unsigned
char
*
)
NameStr
(
*
n
),
NameStr
(
*
n
),
strlen
(
NameStr
(
*
n
)),
regex_flavor
,
0
,
NULL
));
...
...
@@ -300,7 +300,7 @@ nameregexne(PG_FUNCTION_ARGS)
text
*
p
=
PG_GETARG_TEXT_P
(
1
);
PG_RETURN_BOOL
(
!
RE_compile_and_execute
(
p
,
(
unsigned
char
*
)
NameStr
(
*
n
),
NameStr
(
*
n
),
strlen
(
NameStr
(
*
n
)),
regex_flavor
,
0
,
NULL
));
...
...
@@ -313,7 +313,7 @@ textregexeq(PG_FUNCTION_ARGS)
text
*
p
=
PG_GETARG_TEXT_P
(
1
);
PG_RETURN_BOOL
(
RE_compile_and_execute
(
p
,
(
unsigned
char
*
)
VARDATA
(
s
),
VARDATA
(
s
),
VARSIZE
(
s
)
-
VARHDRSZ
,
regex_flavor
,
0
,
NULL
));
...
...
@@ -326,7 +326,7 @@ textregexne(PG_FUNCTION_ARGS)
text
*
p
=
PG_GETARG_TEXT_P
(
1
);
PG_RETURN_BOOL
(
!
RE_compile_and_execute
(
p
,
(
unsigned
char
*
)
VARDATA
(
s
),
VARDATA
(
s
),
VARSIZE
(
s
)
-
VARHDRSZ
,
regex_flavor
,
0
,
NULL
));
...
...
@@ -346,7 +346,7 @@ nameicregexeq(PG_FUNCTION_ARGS)
text
*
p
=
PG_GETARG_TEXT_P
(
1
);
PG_RETURN_BOOL
(
RE_compile_and_execute
(
p
,
(
unsigned
char
*
)
NameStr
(
*
n
),
NameStr
(
*
n
),
strlen
(
NameStr
(
*
n
)),
regex_flavor
|
REG_ICASE
,
0
,
NULL
));
...
...
@@ -359,7 +359,7 @@ nameicregexne(PG_FUNCTION_ARGS)
text
*
p
=
PG_GETARG_TEXT_P
(
1
);
PG_RETURN_BOOL
(
!
RE_compile_and_execute
(
p
,
(
unsigned
char
*
)
NameStr
(
*
n
),
NameStr
(
*
n
),
strlen
(
NameStr
(
*
n
)),
regex_flavor
|
REG_ICASE
,
0
,
NULL
));
...
...
@@ -372,7 +372,7 @@ texticregexeq(PG_FUNCTION_ARGS)
text
*
p
=
PG_GETARG_TEXT_P
(
1
);
PG_RETURN_BOOL
(
RE_compile_and_execute
(
p
,
(
unsigned
char
*
)
VARDATA
(
s
),
VARDATA
(
s
),
VARSIZE
(
s
)
-
VARHDRSZ
,
regex_flavor
|
REG_ICASE
,
0
,
NULL
));
...
...
@@ -385,7 +385,7 @@ texticregexne(PG_FUNCTION_ARGS)
text
*
p
=
PG_GETARG_TEXT_P
(
1
);
PG_RETURN_BOOL
(
!
RE_compile_and_execute
(
p
,
(
unsigned
char
*
)
VARDATA
(
s
),
VARDATA
(
s
),
VARSIZE
(
s
)
-
VARHDRSZ
,
regex_flavor
|
REG_ICASE
,
0
,
NULL
));
...
...
@@ -411,7 +411,7 @@ textregexsubstr(PG_FUNCTION_ARGS)
* matched; else return what the whole regexp matched.
*/
match
=
RE_compile_and_execute
(
p
,
(
unsigned
char
*
)
VARDATA
(
s
),
VARDATA
(
s
),
VARSIZE
(
s
)
-
VARHDRSZ
,
regex_flavor
,
2
,
pmatch
);
...
...
@@ -524,7 +524,7 @@ similar_escape(PG_FUNCTION_ARGS)
text
*
pat_text
;
text
*
esc_text
;
text
*
result
;
unsigned
char
*
p
,
char
*
p
,
*
e
,
*
r
;
int
plen
,
...
...
@@ -566,7 +566,7 @@ similar_escape(PG_FUNCTION_ARGS)
while
(
plen
>
0
)
{
unsigned
char
pchar
=
*
p
;
char
pchar
=
*
p
;
if
(
afterescape
)
{
...
...
@@ -604,7 +604,7 @@ similar_escape(PG_FUNCTION_ARGS)
*
r
++
=
'$'
;
VARATT_SIZEP
(
result
)
=
r
-
((
unsigned
char
*
)
result
);
VARATT_SIZEP
(
result
)
=
r
-
((
char
*
)
result
);
PG_RETURN_TEXT_P
(
result
);
}
src/backend/utils/adt/selfuncs.c
View file @
88896855
...
...
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.18
7 2005/07/21 04:41:43 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.18
8 2005/09/24 17:53:16 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -135,11 +135,11 @@ static bool convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
Datum
lobound
,
Datum
hibound
,
Oid
boundstypid
,
double
*
scaledlobound
,
double
*
scaledhibound
);
static
double
convert_numeric_to_scalar
(
Datum
value
,
Oid
typid
);
static
void
convert_string_to_scalar
(
unsigned
char
*
value
,
static
void
convert_string_to_scalar
(
char
*
value
,
double
*
scaledvalue
,
unsigned
char
*
lobound
,
char
*
lobound
,
double
*
scaledlobound
,
unsigned
char
*
hibound
,
char
*
hibound
,
double
*
scaledhibound
);
static
void
convert_bytea_to_scalar
(
Datum
value
,
double
*
scaledvalue
,
...
...
@@ -147,11 +147,11 @@ static void convert_bytea_to_scalar(Datum value,
double
*
scaledlobound
,
Datum
hibound
,
double
*
scaledhibound
);
static
double
convert_one_string_to_scalar
(
unsigned
char
*
value
,
static
double
convert_one_string_to_scalar
(
char
*
value
,
int
rangelo
,
int
rangehi
);
static
double
convert_one_bytea_to_scalar
(
unsigned
char
*
value
,
int
valuelen
,
int
rangelo
,
int
rangehi
);
static
unsigned
char
*
convert_string_datum
(
Datum
value
,
Oid
typid
);
static
char
*
convert_string_datum
(
Datum
value
,
Oid
typid
);
static
double
convert_timevalue_to_scalar
(
Datum
value
,
Oid
typid
);
static
bool
get_restriction_variable
(
PlannerInfo
*
root
,
List
*
args
,
int
varRelid
,
VariableStatData
*
vardata
,
Node
**
other
,
...
...
@@ -2350,9 +2350,9 @@ convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
case
TEXTOID
:
case
NAMEOID
:
{
unsigned
char
*
valstr
=
convert_string_datum
(
value
,
valuetypid
);
unsigned
char
*
lostr
=
convert_string_datum
(
lobound
,
boundstypid
);
unsigned
char
*
histr
=
convert_string_datum
(
hibound
,
boundstypid
);
char
*
valstr
=
convert_string_datum
(
value
,
valuetypid
);
char
*
lostr
=
convert_string_datum
(
lobound
,
boundstypid
);
char
*
histr
=
convert_string_datum
(
hibound
,
boundstypid
);
convert_string_to_scalar
(
valstr
,
scaledvalue
,
lostr
,
scaledlobound
,
...
...
@@ -2471,31 +2471,31 @@ convert_numeric_to_scalar(Datum value, Oid typid)
* so this is more likely to happen than you might think.)
*/
static
void
convert_string_to_scalar
(
unsigned
char
*
value
,
convert_string_to_scalar
(
char
*
value
,
double
*
scaledvalue
,
unsigned
char
*
lobound
,
char
*
lobound
,
double
*
scaledlobound
,
unsigned
char
*
hibound
,
char
*
hibound
,
double
*
scaledhibound
)
{
int
rangelo
,
rangehi
;
unsigned
char
*
sptr
;
char
*
sptr
;
rangelo
=
rangehi
=
hibound
[
0
];
rangelo
=
rangehi
=
(
unsigned
char
)
hibound
[
0
];
for
(
sptr
=
lobound
;
*
sptr
;
sptr
++
)
{
if
(
rangelo
>
*
sptr
)
rangelo
=
*
sptr
;
if
(
rangehi
<
*
sptr
)
rangehi
=
*
sptr
;
if
(
rangelo
>
(
unsigned
char
)
*
sptr
)
rangelo
=
(
unsigned
char
)
*
sptr
;
if
(
rangehi
<
(
unsigned
char
)
*
sptr
)
rangehi
=
(
unsigned
char
)
*
sptr
;
}
for
(
sptr
=
hibound
;
*
sptr
;
sptr
++
)
{
if
(
rangelo
>
*
sptr
)
rangelo
=
*
sptr
;
if
(
rangehi
<
*
sptr
)
rangehi
=
*
sptr
;
if
(
rangelo
>
(
unsigned
char
)
*
sptr
)
rangelo
=
(
unsigned
char
)
*
sptr
;
if
(
rangehi
<
(
unsigned
char
)
*
sptr
)
rangehi
=
(
unsigned
char
)
*
sptr
;
}
/* If range includes any upper-case ASCII chars, make it include all */
if
(
rangelo
<=
'Z'
&&
rangehi
>=
'A'
)
...
...
@@ -2551,9 +2551,9 @@ convert_string_to_scalar(unsigned char *value,
}
static
double
convert_one_string_to_scalar
(
unsigned
char
*
value
,
int
rangelo
,
int
rangehi
)
convert_one_string_to_scalar
(
char
*
value
,
int
rangelo
,
int
rangehi
)
{
int
slen
=
strlen
(
(
char
*
)
value
);
int
slen
=
strlen
(
value
);
double
num
,
denom
,
base
;
...
...
@@ -2574,7 +2574,7 @@ convert_one_string_to_scalar(unsigned char *value, int rangelo, int rangehi)
denom
=
base
;
while
(
slen
--
>
0
)
{
int
ch
=
*
value
++
;
int
ch
=
(
unsigned
char
)
*
value
++
;
if
(
ch
<
rangelo
)
ch
=
rangelo
-
1
;
...
...
@@ -2593,7 +2593,7 @@ convert_one_string_to_scalar(unsigned char *value, int rangelo, int rangehi)
* When using a non-C locale, we must pass the string through strxfrm()
* before continuing, so as to generate correct locale-specific results.
*/
static
unsigned
char
*
static
char
*
convert_string_datum
(
Datum
value
,
Oid
typid
)
{
char
*
val
;
...
...
@@ -2660,7 +2660,7 @@ convert_string_datum(Datum value, Oid typid)
val
=
xfrmstr
;
}
return
(
unsigned
char
*
)
val
;
return
val
;
}
/*
...
...
@@ -4104,8 +4104,7 @@ make_greater_string(const Const *str_const)
if
(
datatype
!=
BYTEAOID
)
{
/* do not generate invalid encoding sequences */
if
(
!
pg_verifymbstr
((
const
unsigned
char
*
)
workstr
,
len
,
true
))
if
(
!
pg_verifymbstr
(
workstr
,
len
,
true
))
continue
;
workstr_const
=
string_to_const
(
workstr
,
datatype
);
}
...
...
@@ -4124,7 +4123,7 @@ make_greater_string(const Const *str_const)
* byte, depending on the character encoding.
*/
if
(
datatype
!=
BYTEAOID
&&
pg_database_encoding_max_length
()
>
1
)
len
=
pg_mbcliplen
(
(
const
unsigned
char
*
)
workstr
,
len
,
len
-
1
);
len
=
pg_mbcliplen
(
workstr
,
len
,
len
-
1
);
else
len
-=
1
;
...
...
src/backend/utils/adt/varbit.c
View file @
88896855
...
...
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.4
5 2005/07/10 21:13:59
tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.4
6 2005/09/24 17:53:16
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -555,7 +555,7 @@ varbit_send(PG_FUNCTION_ARGS)
pq_begintypsend
(
&
buf
);
pq_sendint
(
&
buf
,
VARBITLEN
(
s
),
sizeof
(
int32
));
pq_sendbytes
(
&
buf
,
VARBITS
(
s
),
VARBITBYTES
(
s
));
pq_sendbytes
(
&
buf
,
(
char
*
)
VARBITS
(
s
),
VARBITBYTES
(
s
));
PG_RETURN_BYTEA_P
(
pq_endtypsend
(
&
buf
));
}
...
...
src/backend/utils/adt/varlena.c
View file @
88896855
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.13
4 2005/09/16 04:13:17 neilc
Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.13
5 2005/09/24 17:53:16 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -793,10 +793,10 @@ text_position(text *t1, text *t2, int matchnum)
*
ps2
;
ps1
=
p1
=
(
pg_wchar
*
)
palloc
((
len1
+
1
)
*
sizeof
(
pg_wchar
));
(
void
)
pg_mb2wchar_with_len
(
(
unsigned
char
*
)
VARDATA
(
t1
),
p1
,
len1
);
(
void
)
pg_mb2wchar_with_len
(
VARDATA
(
t1
),
p1
,
len1
);
len1
=
pg_wchar_strlen
(
p1
);
ps2
=
p2
=
(
pg_wchar
*
)
palloc
((
len2
+
1
)
*
sizeof
(
pg_wchar
));
(
void
)
pg_mb2wchar_with_len
(
(
unsigned
char
*
)
VARDATA
(
t2
),
p2
,
len2
);
(
void
)
pg_mb2wchar_with_len
(
VARDATA
(
t2
),
p2
,
len2
);
len2
=
pg_wchar_strlen
(
p2
);
/* no use in searching str past point where search_str will fit */
...
...
src/backend/utils/mb/conv.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.5
3 2005/06/15 00:15:08 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.5
4 2005/09/24 17:53:17 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -421,7 +421,7 @@ LocalToUtf(unsigned char *iso, unsigned char *utf,
continue
;
}
l
=
pg_encoding_mblen
(
encoding
,
iso
);
l
=
pg_encoding_mblen
(
encoding
,
(
char
*
)
iso
);
if
(
l
==
1
)
iiso
=
*
iso
++
;
...
...
src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.
9 2004/12/31 22:01:45 pgsq
l Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.
10 2005/09/24 17:53:17 tg
l Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -35,8 +35,8 @@ extern Datum mic_to_ascii(PG_FUNCTION_ARGS);
Datum
ascii_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_SQL_ASCII
);
...
...
@@ -51,8 +51,8 @@ ascii_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_ascii
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
View file @
88896855
This diff is collapsed.
Click to expand it.
src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.
9 2004/12/31 22:01:51 pgsq
l Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.
10 2005/09/24 17:53:18 tg
l Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -38,8 +38,8 @@ static void mic2euc_cn(unsigned char *mic, unsigned char *p, int len);
Datum
euc_cn_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_EUC_CN
);
...
...
@@ -54,8 +54,8 @@ euc_cn_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_euc_cn
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.1
1 2005/06/24 13:56:39 ishii
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.1
2 2005/09/24 17:53:18 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -64,8 +64,8 @@ static void sjis2euc_jp(unsigned char *mic, unsigned char *p, int len);
Datum
euc_jp_to_sjis
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_EUC_JP
);
...
...
@@ -80,8 +80,8 @@ euc_jp_to_sjis(PG_FUNCTION_ARGS)
Datum
sjis_to_euc_jp
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_SJIS
);
...
...
@@ -96,8 +96,8 @@ sjis_to_euc_jp(PG_FUNCTION_ARGS)
Datum
euc_jp_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_EUC_JP
);
...
...
@@ -112,8 +112,8 @@ euc_jp_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_euc_jp
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
@@ -128,8 +128,8 @@ mic_to_euc_jp(PG_FUNCTION_ARGS)
Datum
sjis_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_SJIS
);
...
...
@@ -144,8 +144,8 @@ sjis_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_sjis
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.
9 2004/12/31 22:01:56 pgsq
l Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.
10 2005/09/24 17:53:19 tg
l Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -38,8 +38,8 @@ static void mic2euc_kr(unsigned char *mic, unsigned char *p, int len);
Datum
euc_kr_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_EUC_KR
);
...
...
@@ -54,8 +54,8 @@ euc_kr_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_euc_kr
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.
9 2004/12/31 22:02:07 pgsq
l Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.
10 2005/09/24 17:53:19 tg
l Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -50,8 +50,8 @@ static void mic2euc_tw(unsigned char *mic, unsigned char *p, int len);
Datum
euc_tw_to_big5
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
unsigned
char
*
buf
;
...
...
@@ -61,7 +61,7 @@ euc_tw_to_big5(PG_FUNCTION_ARGS)
buf
=
palloc
(
len
*
ENCODING_GROWTH_RATE
);
euc_tw2mic
(
src
,
buf
,
len
);
mic2big5
(
buf
,
dest
,
strlen
(
buf
));
mic2big5
(
buf
,
dest
,
strlen
(
(
char
*
)
buf
));
pfree
(
buf
);
PG_RETURN_VOID
();
...
...
@@ -70,8 +70,8 @@ euc_tw_to_big5(PG_FUNCTION_ARGS)
Datum
big5_to_euc_tw
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
unsigned
char
*
buf
;
...
...
@@ -81,7 +81,7 @@ big5_to_euc_tw(PG_FUNCTION_ARGS)
buf
=
palloc
(
len
*
ENCODING_GROWTH_RATE
);
big52mic
(
src
,
buf
,
len
);
mic2euc_tw
(
buf
,
dest
,
strlen
(
buf
));
mic2euc_tw
(
buf
,
dest
,
strlen
(
(
char
*
)
buf
));
pfree
(
buf
);
PG_RETURN_VOID
();
...
...
@@ -90,8 +90,8 @@ big5_to_euc_tw(PG_FUNCTION_ARGS)
Datum
euc_tw_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_EUC_TW
);
...
...
@@ -106,8 +106,8 @@ euc_tw_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_euc_tw
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
@@ -122,8 +122,8 @@ mic_to_euc_tw(PG_FUNCTION_ARGS)
Datum
big5_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_BIG5
);
...
...
@@ -138,8 +138,8 @@ big5_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_big5
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.
9 2004/12/31 22:02:08 pgsq
l Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.
10 2005/09/24 17:53:19 tg
l Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -50,8 +50,8 @@ static void mic2win1250(unsigned char *mic, unsigned char *p, int len);
Datum
latin2_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_LATIN2
);
...
...
@@ -66,8 +66,8 @@ latin2_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_latin2
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
@@ -82,8 +82,8 @@ mic_to_latin2(PG_FUNCTION_ARGS)
Datum
win1250_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_WIN1250
);
...
...
@@ -98,8 +98,8 @@ win1250_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_win1250
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
@@ -114,8 +114,8 @@ mic_to_win1250(PG_FUNCTION_ARGS)
Datum
latin2_to_win1250
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
unsigned
char
*
buf
;
...
...
@@ -125,7 +125,7 @@ latin2_to_win1250(PG_FUNCTION_ARGS)
buf
=
palloc
(
len
*
ENCODING_GROWTH_RATE
);
latin22mic
(
src
,
buf
,
len
);
mic2win1250
(
buf
,
dest
,
strlen
(
buf
));
mic2win1250
(
buf
,
dest
,
strlen
(
(
char
*
)
buf
));
pfree
(
buf
);
PG_RETURN_VOID
();
...
...
@@ -134,8 +134,8 @@ latin2_to_win1250(PG_FUNCTION_ARGS)
Datum
win1250_to_latin2
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
unsigned
char
*
buf
;
...
...
@@ -145,7 +145,7 @@ win1250_to_latin2(PG_FUNCTION_ARGS)
buf
=
palloc
(
len
*
ENCODING_GROWTH_RATE
);
win12502mic
(
src
,
buf
,
len
);
mic2latin2
(
buf
,
dest
,
strlen
(
buf
));
mic2latin2
(
buf
,
dest
,
strlen
(
(
char
*
)
buf
));
pfree
(
buf
);
PG_RETURN_VOID
();
...
...
src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.
9 2004/12/31 22:02:10 pgsq
l Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.
10 2005/09/24 17:53:19 tg
l Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -50,8 +50,8 @@ static void mic2latin4(unsigned char *mic, unsigned char *p, int len);
Datum
latin1_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_LATIN1
);
...
...
@@ -66,8 +66,8 @@ latin1_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_latin1
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
@@ -82,8 +82,8 @@ mic_to_latin1(PG_FUNCTION_ARGS)
Datum
latin3_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_LATIN3
);
...
...
@@ -98,8 +98,8 @@ latin3_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_latin3
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
@@ -114,8 +114,8 @@ mic_to_latin3(PG_FUNCTION_ARGS)
Datum
latin4_to_mic
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_LATIN4
);
...
...
@@ -130,8 +130,8 @@ latin4_to_mic(PG_FUNCTION_ARGS)
Datum
mic_to_latin4
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_MULE_INTERNAL
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.1
0 2005/03/07 04:30:52 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.1
1 2005/09/24 17:53:20 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -35,8 +35,8 @@ extern Datum utf8_to_ascii(PG_FUNCTION_ARGS);
Datum
ascii_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_SQL_ASCII
);
...
...
@@ -51,8 +51,8 @@ ascii_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_ascii
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.1
0 2005/03/07 04:30:53 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.1
1 2005/09/24 17:53:20 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_big5(PG_FUNCTION_ARGS);
Datum
big5_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_BIG5
);
...
...
@@ -53,8 +53,8 @@ big5_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_big5
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.1
0 2005/03/07 04:30:53 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.1
1 2005/09/24 17:53:20 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -49,8 +49,8 @@ extern Datum win866_to_utf8(PG_FUNCTION_ARGS);
Datum
utf8_to_koi8r
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
@@ -66,8 +66,8 @@ utf8_to_koi8r(PG_FUNCTION_ARGS)
Datum
koi8r_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_KOI8R
);
...
...
@@ -83,8 +83,8 @@ koi8r_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_win1251
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
@@ -100,8 +100,8 @@ utf8_to_win1251(PG_FUNCTION_ARGS)
Datum
win1251_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_WIN1251
);
...
...
@@ -117,8 +117,8 @@ win1251_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_win866
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
@@ -134,8 +134,8 @@ utf8_to_win866(PG_FUNCTION_ARGS)
Datum
win866_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_WIN866
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.1
0 2005/03/07 04:30:53 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.1
1 2005/09/24 17:53:21 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_euc_cn(PG_FUNCTION_ARGS);
Datum
euc_cn_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_EUC_CN
);
...
...
@@ -53,8 +53,8 @@ euc_cn_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_euc_cn
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.1
0 2005/03/07 04:30:53 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.1
1 2005/09/24 17:53:21 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_euc_jp(PG_FUNCTION_ARGS);
Datum
euc_jp_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_EUC_JP
);
...
...
@@ -53,8 +53,8 @@ euc_jp_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_euc_jp
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.1
0 2005/03/07 04:30:53 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.1
1 2005/09/24 17:53:22 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_euc_kr(PG_FUNCTION_ARGS);
Datum
euc_kr_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_EUC_KR
);
...
...
@@ -53,8 +53,8 @@ euc_kr_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_euc_kr
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.1
0 2005/03/07 04:30:53 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.1
1 2005/09/24 17:53:22 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_euc_tw(PG_FUNCTION_ARGS);
Datum
euc_tw_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_EUC_TW
);
...
...
@@ -53,8 +53,8 @@ euc_tw_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_euc_tw
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.1
0 2005/03/07 04:30:53 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.1
1 2005/09/24 17:53:23 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_gb18030(PG_FUNCTION_ARGS);
Datum
gb18030_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_GB18030
);
...
...
@@ -53,8 +53,8 @@ gb18030_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_gb18030
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.1
0 2005/03/07 04:30:53 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.1
1 2005/09/24 17:53:23 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_gbk(PG_FUNCTION_ARGS);
Datum
gbk_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_GBK
);
...
...
@@ -53,8 +53,8 @@ gbk_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_gbk
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.1
3 2005/03/14 18:31:21 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.1
4 2005/09/24 17:53:23 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -128,8 +128,8 @@ Datum
iso8859_to_utf8
(
PG_FUNCTION_ARGS
)
{
int
encoding
=
PG_GETARG_INT32
(
0
);
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
1
)
==
PG_UTF8
);
...
...
@@ -144,8 +144,8 @@ Datum
utf8_to_iso8859
(
PG_FUNCTION_ARGS
)
{
int
encoding
=
PG_GETARG_INT32
(
1
);
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.1
1 2005/03/07 04:30:54 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.1
2 2005/09/24 17:53:24 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -35,8 +35,8 @@ extern Datum utf8_to_iso8859_1(PG_FUNCTION_ARGS);
Datum
iso8859_1_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
unsigned
short
c
;
...
...
@@ -62,8 +62,8 @@ iso8859_1_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_iso8859_1
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
unsigned
short
c
,
c1
,
...
...
src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.1
0 2005/03/07 04:30:54 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.1
1 2005/09/24 17:53:24 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_johab(PG_FUNCTION_ARGS);
Datum
johab_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_JOHAB
);
...
...
@@ -53,8 +53,8 @@ johab_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_johab
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.1
0 2005/03/07 04:30:54 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.1
1 2005/09/24 17:53:24 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_sjis(PG_FUNCTION_ARGS);
Datum
sjis_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_SJIS
);
...
...
@@ -53,8 +53,8 @@ sjis_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_sjis
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.1
0 2005/03/07 04:30:54 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.1
1 2005/09/24 17:53:25 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_uhc(PG_FUNCTION_ARGS);
Datum
uhc_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UHC
);
...
...
@@ -53,8 +53,8 @@ uhc_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_uhc
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c,v 1.1
1 2005/03/14 18:31:21 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c,v 1.1
2 2005/09/24 17:53:25 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -37,8 +37,8 @@ extern Datum win1250_to_utf8(PG_FUNCTION_ARGS);
Datum
utf8_to_win1250
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
@@ -54,8 +54,8 @@ utf8_to_win1250(PG_FUNCTION_ARGS)
Datum
win1250_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_WIN1250
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_win1252/utf8_and_win1252.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1252/utf8_and_win1252.c,v 1.
3 2005/03/14 18:31:22 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1252/utf8_and_win1252.c,v 1.
4 2005/09/24 17:53:25 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -37,8 +37,8 @@ extern Datum win1252_to_utf8(PG_FUNCTION_ARGS);
Datum
utf8_to_win1252
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
@@ -54,8 +54,8 @@ utf8_to_win1252(PG_FUNCTION_ARGS)
Datum
win1252_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_WIN1252
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c,v 1.1
1 2005/03/14 18:31:22 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c,v 1.1
2 2005/09/24 17:53:26 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -37,8 +37,8 @@ extern Datum win1256_to_utf8(PG_FUNCTION_ARGS);
Datum
utf8_to_win1256
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
@@ -54,8 +54,8 @@ utf8_to_win1256(PG_FUNCTION_ARGS)
Datum
win1256_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_WIN1256
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_win1258/utf8_and_win1258.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1258/utf8_and_win1258.c,v 1.
1 2005/03/07 04:30:55 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1258/utf8_and_win1258.c,v 1.
2 2005/09/24 17:53:26 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -36,8 +36,8 @@ extern Datum utf8_to_win1258(PG_FUNCTION_ARGS);
Datum
win1258_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_WIN1258
);
...
...
@@ -53,8 +53,8 @@ win1258_to_utf8(PG_FUNCTION_ARGS)
Datum
utf8_to_win1258
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c
View file @
88896855
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c,v 1.1
1 2005/03/14 18:31:22 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c,v 1.1
2 2005/09/24 17:53:26 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -37,8 +37,8 @@ extern Datum win874_to_utf8(PG_FUNCTION_ARGS);
Datum
utf8_to_win874
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_UTF8
);
...
...
@@ -54,8 +54,8 @@ utf8_to_win874(PG_FUNCTION_ARGS)
Datum
win874_to_utf8
(
PG_FUNCTION_ARGS
)
{
unsigned
char
*
src
=
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
PG_GETARG_CSTRING
(
3
);
unsigned
char
*
src
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
2
);
unsigned
char
*
dest
=
(
unsigned
char
*
)
PG_GETARG_CSTRING
(
3
);
int
len
=
PG_GETARG_INT32
(
4
);
Assert
(
PG_GETARG_INT32
(
0
)
==
PG_WIN874
);
...
...
src/backend/utils/mb/mbutils.c
View file @
88896855
...
...
@@ -4,7 +4,7 @@
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
*
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.5
0 2005/07/10 21:13:59
tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.5
1 2005/09/24 17:53:17
tgl Exp $
*/
#include "postgres.h"
...
...
@@ -43,9 +43,9 @@ static int pending_client_encoding = PG_SQL_ASCII;
/* Internal functions */
static
unsigned
char
*
perform_default_encoding_conversion
(
unsigned
char
*
src
,
static
char
*
perform_default_encoding_conversion
(
const
char
*
src
,
int
len
,
bool
is_client_to_server
);
static
int
cliplen
(
const
unsigned
char
*
str
,
int
len
,
int
limit
);
static
int
cliplen
(
const
char
*
str
,
int
len
,
int
limit
);
/*
...
...
@@ -303,7 +303,7 @@ pg_convert(PG_FUNCTION_ARGS)
}
/*
* Convert string using encoding_na
n
me.
* Convert string using encoding_name.
*
* TEXT convert2(TEXT string, NAME src_encoding_name, NAME dest_encoding_name)
*/
...
...
@@ -346,7 +346,7 @@ pg_convert2(PG_FUNCTION_ARGS)
* textin assumes that input string encoding is same as database
* encoding.
*/
len
=
strlen
(
result
)
+
VARHDRSZ
;
len
=
strlen
(
(
char
*
)
result
)
+
VARHDRSZ
;
retval
=
palloc
(
len
);
VARATT_SIZEP
(
retval
)
=
len
;
memcpy
(
VARDATA
(
retval
),
result
,
len
-
VARHDRSZ
);
...
...
@@ -364,14 +364,14 @@ pg_convert2(PG_FUNCTION_ARGS)
/*
* convert client encoding to server encoding.
*/
unsigned
char
*
pg_client_to_server
(
unsigned
char
*
s
,
int
len
)
char
*
pg_client_to_server
(
const
char
*
s
,
int
len
)
{
Assert
(
DatabaseEncoding
);
Assert
(
ClientEncoding
);
if
(
ClientEncoding
->
encoding
==
DatabaseEncoding
->
encoding
)
return
s
;
return
(
char
*
)
s
;
return
perform_default_encoding_conversion
(
s
,
len
,
true
);
}
...
...
@@ -379,14 +379,14 @@ pg_client_to_server(unsigned char *s, int len)
/*
* convert server encoding to client encoding.
*/
unsigned
char
*
pg_server_to_client
(
unsigned
char
*
s
,
int
len
)
char
*
pg_server_to_client
(
const
char
*
s
,
int
len
)
{
Assert
(
DatabaseEncoding
);
Assert
(
ClientEncoding
);
if
(
ClientEncoding
->
encoding
==
DatabaseEncoding
->
encoding
)
return
s
;
return
(
char
*
)
s
;
return
perform_default_encoding_conversion
(
s
,
len
,
false
);
}
...
...
@@ -398,16 +398,16 @@ pg_server_to_client(unsigned char *s, int len)
* before calling this function. Otherwise no conversion is
* performed.
*/
static
unsigned
char
*
perform_default_encoding_conversion
(
unsigned
char
*
src
,
int
len
,
bool
is_client_to_server
)
static
char
*
perform_default_encoding_conversion
(
const
char
*
src
,
int
len
,
bool
is_client_to_server
)
{
unsigned
char
*
result
;
char
*
result
;
int
src_encoding
,
dest_encoding
;
FmgrInfo
*
flinfo
;
if
(
len
<=
0
)
return
src
;
return
(
char
*
)
src
;
if
(
is_client_to_server
)
{
...
...
@@ -423,13 +423,13 @@ perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_
}
if
(
flinfo
==
NULL
)
return
src
;
return
(
char
*
)
src
;
if
(
src_encoding
==
dest_encoding
)
return
src
;
return
(
char
*
)
src
;
if
(
src_encoding
==
PG_SQL_ASCII
||
dest_encoding
==
PG_SQL_ASCII
)
return
src
;
return
(
char
*
)
src
;
result
=
palloc
(
len
*
4
+
1
);
...
...
@@ -444,41 +444,41 @@ perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_
/* convert a multibyte string to a wchar */
int
pg_mb2wchar
(
const
unsigned
char
*
from
,
pg_wchar
*
to
)
pg_mb2wchar
(
const
char
*
from
,
pg_wchar
*
to
)
{
return
(
*
pg_wchar_table
[
DatabaseEncoding
->
encoding
].
mb2wchar_with_len
)
(
from
,
to
,
strlen
(
from
));
return
(
*
pg_wchar_table
[
DatabaseEncoding
->
encoding
].
mb2wchar_with_len
)
(
(
const
unsigned
char
*
)
from
,
to
,
strlen
(
from
));
}
/* convert a multibyte string to a wchar with a limited length */
int
pg_mb2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
pg_mb2wchar_with_len
(
const
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
return
(
*
pg_wchar_table
[
DatabaseEncoding
->
encoding
].
mb2wchar_with_len
)
(
from
,
to
,
len
);
return
(
*
pg_wchar_table
[
DatabaseEncoding
->
encoding
].
mb2wchar_with_len
)
(
(
const
unsigned
char
*
)
from
,
to
,
len
);
}
/* returns the byte length of a multibyte word */
int
pg_mblen
(
const
unsigned
char
*
mbstr
)
pg_mblen
(
const
char
*
mbstr
)
{
return
((
*
pg_wchar_table
[
DatabaseEncoding
->
encoding
].
mblen
)
(
mbstr
));
return
((
*
pg_wchar_table
[
DatabaseEncoding
->
encoding
].
mblen
)
(
(
const
unsigned
char
*
)
mbstr
));
}
/* returns the display length of a multibyte word */
int
pg_dsplen
(
const
unsigned
char
*
mbstr
)
pg_dsplen
(
const
char
*
mbstr
)
{
return
((
*
pg_wchar_table
[
DatabaseEncoding
->
encoding
].
dsplen
)
(
mbstr
));
return
((
*
pg_wchar_table
[
DatabaseEncoding
->
encoding
].
dsplen
)
(
(
const
unsigned
char
*
)
mbstr
));
}
/* returns the length (counted
as a wchar
) of a multibyte string */
/* returns the length (counted
in wchars
) of a multibyte string */
int
pg_mbstrlen
(
const
unsigned
char
*
mbstr
)
pg_mbstrlen
(
const
char
*
mbstr
)
{
int
len
=
0
;
/* optimization for single byte encoding */
if
(
pg_database_encoding_max_length
()
==
1
)
return
strlen
(
(
char
*
)
mbstr
);
return
strlen
(
mbstr
);
while
(
*
mbstr
)
{
...
...
@@ -488,11 +488,11 @@ pg_mbstrlen(const unsigned char *mbstr)
return
(
len
);
}
/* returns the length (counted
as a wchar
) of a multibyte string
/* returns the length (counted
in wchars
) of a multibyte string
* (not necessarily NULL terminated)
*/
int
pg_mbstrlen_with_len
(
const
unsigned
char
*
mbstr
,
int
limit
)
pg_mbstrlen_with_len
(
const
char
*
mbstr
,
int
limit
)
{
int
len
=
0
;
...
...
@@ -518,7 +518,7 @@ pg_mbstrlen_with_len(const unsigned char *mbstr, int limit)
* this function does not break multibyte word boundary.
*/
int
pg_mbcliplen
(
const
unsigned
char
*
mbstr
,
int
len
,
int
limit
)
pg_mbcliplen
(
const
char
*
mbstr
,
int
len
,
int
limit
)
{
int
clen
=
0
;
int
l
;
...
...
@@ -545,7 +545,7 @@ pg_mbcliplen(const unsigned char *mbstr, int len, int limit)
* Similar to pg_mbcliplen except the limit parameter specifies the
* character length, not the byte length. */
int
pg_mbcharcliplen
(
const
unsigned
char
*
mbstr
,
int
len
,
int
limit
)
pg_mbcharcliplen
(
const
char
*
mbstr
,
int
len
,
int
limit
)
{
int
clen
=
0
;
int
nch
=
0
;
...
...
@@ -613,10 +613,10 @@ pg_client_encoding(PG_FUNCTION_ARGS)
}
static
int
cliplen
(
const
unsigned
char
*
str
,
int
len
,
int
limit
)
cliplen
(
const
char
*
str
,
int
len
,
int
limit
)
{
int
l
=
0
;
const
unsigned
char
*
s
;
const
char
*
s
;
for
(
s
=
str
;
*
s
;
s
++
,
l
++
)
{
...
...
src/backend/utils/mb/wchar.c
View file @
88896855
/*
* conversion functions between pg_wchar and multibyte streams.
* Tatsuo Ishii
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.4
4 2005/06/15 00:15:08 momjian
Exp $
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.4
5 2005/09/24 17:53:17 tgl
Exp $
*
* WIN1250 client encoding updated by Pavel Behal
*
...
...
@@ -769,28 +769,28 @@ pg_mic_mblen(const unsigned char *mbstr)
* Returns the byte length of a multibyte word.
*/
int
pg_encoding_mblen
(
int
encoding
,
const
unsigned
char
*
mbstr
)
pg_encoding_mblen
(
int
encoding
,
const
char
*
mbstr
)
{
Assert
(
PG_VALID_ENCODING
(
encoding
));
return
((
encoding
>=
0
&&
encoding
<
sizeof
(
pg_wchar_table
)
/
sizeof
(
pg_wchar_tbl
))
?
((
*
pg_wchar_table
[
encoding
].
mblen
)
(
mbstr
))
:
((
*
pg_wchar_table
[
PG_SQL_ASCII
].
mblen
)
(
mbstr
)));
((
*
pg_wchar_table
[
encoding
].
mblen
)
(
(
const
unsigned
char
*
)
mbstr
))
:
((
*
pg_wchar_table
[
PG_SQL_ASCII
].
mblen
)
(
(
const
unsigned
char
*
)
mbstr
)));
}
/*
* Returns the display length of a multibyte word.
*/
int
pg_encoding_dsplen
(
int
encoding
,
const
unsigned
char
*
mbstr
)
pg_encoding_dsplen
(
int
encoding
,
const
char
*
mbstr
)
{
Assert
(
PG_VALID_ENCODING
(
encoding
));
return
((
encoding
>=
0
&&
encoding
<
sizeof
(
pg_wchar_table
)
/
sizeof
(
pg_wchar_tbl
))
?
((
*
pg_wchar_table
[
encoding
].
dsplen
)
(
mbstr
))
:
((
*
pg_wchar_table
[
PG_SQL_ASCII
].
dsplen
)
(
mbstr
)));
((
*
pg_wchar_table
[
encoding
].
dsplen
)
(
(
const
unsigned
char
*
)
mbstr
))
:
((
*
pg_wchar_table
[
PG_SQL_ASCII
].
dsplen
)
(
(
const
unsigned
char
*
)
mbstr
)));
}
/*
...
...
@@ -840,7 +840,7 @@ bool pg_utf8_islegal(const unsigned char *source, int length) {
* true; when noError is false, ereport() a descriptive message.
*/
bool
pg_verifymbstr
(
const
unsigned
char
*
mbstr
,
int
len
,
bool
noError
)
pg_verifymbstr
(
const
char
*
mbstr
,
int
len
,
bool
noError
)
{
int
l
;
int
i
;
...
...
@@ -857,24 +857,30 @@ pg_verifymbstr(const unsigned char *mbstr, int len, bool noError)
l
=
pg_mblen
(
mbstr
);
/* special UTF-8 check */
if
(
encoding
==
PG_UTF8
)
{
if
(
!
pg_utf8_islegal
(
mbstr
,
l
))
{
if
(
noError
)
return
false
;
ereport
(
ERROR
,(
errcode
(
ERRCODE_CHARACTER_NOT_IN_REPERTOIRE
),
errmsg
(
"Invalid UNICODE byte sequence detected near byte %c"
,
*
mbstr
)));
if
(
encoding
==
PG_UTF8
)
{
if
(
!
pg_utf8_islegal
((
const
unsigned
char
*
)
mbstr
,
l
))
{
if
(
noError
)
return
false
;
ereport
(
ERROR
,
(
errcode
(
ERRCODE_CHARACTER_NOT_IN_REPERTOIRE
),
errmsg
(
"invalid UNICODE byte sequence detected near byte 0x%02x"
,
(
unsigned
char
)
*
mbstr
)));
}
}
else
{
for
(
i
=
1
;
i
<
l
;
i
++
)
{
/*
* we expect that every multibyte char consists of bytes
* having the 8th bit set
*/
if
(
i
>=
len
||
(
mbstr
[
i
]
&
0x80
)
==
0
)
{
char
buf
[
8
*
2
+
1
];
char
*
p
=
buf
;
int
j
,
jlimit
;
/*
* we expect that every multibyte char consists of bytes
* having the 8th bit set
*/
if
(
i
>=
len
||
(
mbstr
[
i
]
&
0x80
)
==
0
)
{
char
buf
[
8
*
2
+
1
];
char
*
p
=
buf
;
int
j
,
jlimit
;
if
(
noError
)
return
false
;
...
...
@@ -883,12 +889,12 @@ pg_verifymbstr(const unsigned char *mbstr, int len, bool noError)
jlimit
=
Min
(
jlimit
,
8
);
/* prevent buffer overrun */
for
(
j
=
0
;
j
<
jlimit
;
j
++
)
p
+=
sprintf
(
p
,
"%02x"
,
mbstr
[
j
]);
p
+=
sprintf
(
p
,
"%02x"
,
(
unsigned
char
)
mbstr
[
j
]);
ereport
(
ERROR
,
(
errcode
(
ERRCODE_CHARACTER_NOT_IN_REPERTOIRE
),
errmsg
(
"invalid byte sequence for encoding
\"
%s
\"
: 0x%s"
,
GetDatabaseEncodingName
(),
buf
)));
errmsg
(
"invalid byte sequence for encoding
\"
%s
\"
: 0x%s"
,
GetDatabaseEncodingName
(),
buf
)));
}
}
}
...
...
src/bin/pg_dump/pg_backup_custom.c
View file @
88896855
...
...
@@ -19,7 +19,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.3
1 2005/06/21 20:45:44
tgl Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.3
2 2005/09/24 17:53:27
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -27,8 +27,6 @@
#include "pg_backup.h"
#include "pg_backup_archiver.h"
#include <errno.h>
/*--------
* Routines in the format interface
*--------
...
...
@@ -548,7 +546,7 @@ _PrintData(ArchiveHandle *AH)
ctx
->
filePos
+=
blkLen
;
zp
->
next_in
=
in
;
zp
->
next_in
=
(
void
*
)
in
;
zp
->
avail_in
=
blkLen
;
#ifdef HAVE_LIBZ
...
...
@@ -557,7 +555,7 @@ _PrintData(ArchiveHandle *AH)
{
while
(
zp
->
avail_in
!=
0
)
{
zp
->
next_out
=
out
;
zp
->
next_out
=
(
void
*
)
out
;
zp
->
avail_out
=
zlibOutSize
;
res
=
inflate
(
zp
,
0
);
if
(
res
!=
Z_OK
&&
res
!=
Z_STREAM_END
)
...
...
@@ -587,7 +585,7 @@ _PrintData(ArchiveHandle *AH)
zp
->
avail_in
=
0
;
while
(
res
!=
Z_STREAM_END
)
{
zp
->
next_out
=
out
;
zp
->
next_out
=
(
void
*
)
out
;
zp
->
avail_out
=
zlibOutSize
;
res
=
inflate
(
zp
,
0
);
if
(
res
!=
Z_OK
&&
res
!=
Z_STREAM_END
)
...
...
@@ -891,7 +889,7 @@ _StartDataCompressor(ArchiveHandle *AH, TocEntry *te)
#endif
/* Just be paranoid - maybe End is called after Start, with no Write */
zp
->
next_out
=
ctx
->
zlibOut
;
zp
->
next_out
=
(
void
*
)
ctx
->
zlibOut
;
zp
->
avail_out
=
zlibOutSize
;
}
...
...
@@ -937,7 +935,7 @@ _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush)
die_horribly
(
AH
,
modulename
,
"could not write compressed chunk
\n
"
);
ctx
->
filePos
+=
zlibOutSize
-
zp
->
avail_out
;
}
zp
->
next_out
=
out
;
zp
->
next_out
=
(
void
*
)
out
;
zp
->
avail_out
=
zlibOutSize
;
}
}
...
...
src/bin/psql/mbprint.c
View file @
88896855
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.1
6 2005/01/01 05:43:08 momjian
Exp $
* $PostgreSQL: pgsql/src/bin/psql/mbprint.c,v 1.1
7 2005/09/24 17:53:27 tgl
Exp $
*/
#include "postgres_fe.h"
...
...
@@ -158,7 +158,7 @@ ucs_wcwidth(pg_wchar ucs)
(
ucs
>=
0x20000
&&
ucs
<=
0x2ffff
)));
}
pg_wchar
static
pg_wchar
utf2ucs
(
const
unsigned
char
*
c
)
{
/*
...
...
@@ -195,7 +195,7 @@ utf2ucs(const unsigned char *c)
/* mb_utf_wcwidth : calculate column length for the utf8 string pwcs
*/
static
int
mb_utf_wcswidth
(
unsigned
char
*
pwcs
,
size_t
len
)
mb_utf_wcswidth
(
const
unsigned
char
*
pwcs
,
size_t
len
)
{
int
w
,
l
=
0
;
...
...
@@ -272,15 +272,15 @@ utf_charcheck(const unsigned char *c)
return
-
1
;
}
static
unsigned
char
*
static
void
mb_utf_validate
(
unsigned
char
*
pwcs
)
{
int
l
=
0
;
unsigned
char
*
p
=
pwcs
;
unsigned
char
*
p0
=
pwcs
;
while
(
*
pwcs
)
{
int
l
;
if
((
l
=
utf_charcheck
(
pwcs
))
>
0
)
{
if
(
p
!=
pwcs
)
...
...
@@ -304,7 +304,6 @@ mb_utf_validate(unsigned char *pwcs)
}
if
(
p
!=
pwcs
)
*
p
=
'\0'
;
return
p0
;
}
/*
...
...
@@ -312,10 +311,10 @@ mb_utf_validate(unsigned char *pwcs)
*/
int
pg_wcswidth
(
unsigned
char
*
pwcs
,
size_t
len
,
int
encoding
)
pg_wcswidth
(
const
char
*
pwcs
,
size_t
len
,
int
encoding
)
{
if
(
encoding
==
PG_UTF8
)
return
mb_utf_wcswidth
(
pwcs
,
len
);
return
mb_utf_wcswidth
(
(
const
unsigned
char
*
)
pwcs
,
len
);
else
{
/*
...
...
@@ -326,17 +325,18 @@ pg_wcswidth(unsigned char *pwcs, size_t len, int encoding)
}
}
unsigned
char
*
mbvalidate
(
unsigned
char
*
pwcs
,
int
encoding
)
char
*
mbvalidate
(
char
*
pwcs
,
int
encoding
)
{
if
(
encoding
==
PG_UTF8
)
return
mb_utf_validate
(
pwcs
);
mb_utf_validate
((
unsigned
char
*
)
pwcs
);
else
{
/*
* other encodings needing validation should add their own
* routines here
*/
return
pwcs
;
}
return
pwcs
;
}
src/bin/psql/mbprint.h
View file @
88896855
/* $PostgreSQL: pgsql/src/bin/psql/mbprint.h,v 1.
7 2003/11/29 22:40:49 pgsq
l Exp $ */
/* $PostgreSQL: pgsql/src/bin/psql/mbprint.h,v 1.
8 2005/09/24 17:53:27 tg
l Exp $ */
#ifndef MBPRINT_H
#define MBPRINT_H
#include "mb/pg_wchar.h"
pg_wchar
utf2ucs
(
const
unsigned
char
*
c
);
extern
char
*
mbvalidate
(
char
*
pwcs
,
int
encoding
);
unsigned
char
*
mbvalidate
(
unsigned
char
*
pwcs
,
int
encoding
);
int
pg_wcswidth
(
unsigned
char
*
pwcs
,
size_t
len
,
int
encoding
);
extern
int
pg_wcswidth
(
const
char
*
pwcs
,
size_t
len
,
int
encoding
);
#endif
/* MBPRINT_H */
src/bin/psql/print.c
View file @
88896855
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.7
3 2005/09/22 15:51:51 momjian
Exp $
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.7
4 2005/09/24 17:53:27 tgl
Exp $
*/
#include "postgres_fe.h"
#include "common.h"
...
...
@@ -391,7 +391,7 @@ print_aligned_text(const char *title, const char *const *headers,
/* calc column widths */
for
(
i
=
0
;
i
<
col_count
;
i
++
)
{
tmp
=
pg_wcswidth
(
(
unsigned
char
*
)
headers
[
i
],
strlen
(
headers
[
i
]),
encoding
);
tmp
=
pg_wcswidth
(
headers
[
i
],
strlen
(
headers
[
i
]),
encoding
);
if
(
tmp
>
widths
[
i
])
widths
[
i
]
=
tmp
;
head_w
[
i
]
=
tmp
;
...
...
@@ -406,7 +406,7 @@ print_aligned_text(const char *title, const char *const *headers,
else
numeric_locale_len
=
0
;
tmp
=
pg_wcswidth
(
(
unsigned
char
*
)
*
ptr
,
strlen
(
*
ptr
),
encoding
)
+
numeric_locale_len
;
tmp
=
pg_wcswidth
(
*
ptr
,
strlen
(
*
ptr
),
encoding
)
+
numeric_locale_len
;
if
(
tmp
>
widths
[
i
%
col_count
])
widths
[
i
%
col_count
]
=
tmp
;
cell_w
[
i
]
=
tmp
;
...
...
@@ -425,7 +425,7 @@ print_aligned_text(const char *title, const char *const *headers,
/* print title */
if
(
title
&&
!
opt_tuples_only
)
{
tmp
=
pg_wcswidth
(
(
unsigned
char
*
)
title
,
strlen
(
title
),
encoding
);
tmp
=
pg_wcswidth
(
title
,
strlen
(
title
),
encoding
);
if
(
tmp
>=
total_w
)
fprintf
(
fout
,
"%s
\n
"
,
title
);
else
...
...
@@ -591,7 +591,7 @@ print_aligned_vertical(const char *title, const char *const *headers,
for
(
i
=
0
;
i
<
col_count
;
i
++
)
{
tmp
=
pg_wcswidth
(
(
unsigned
char
*
)
headers
[
i
],
strlen
(
headers
[
i
]),
encoding
);
tmp
=
pg_wcswidth
(
headers
[
i
],
strlen
(
headers
[
i
]),
encoding
);
if
(
tmp
>
hwidth
)
hwidth
=
tmp
;
head_w
[
i
]
=
tmp
;
...
...
@@ -623,7 +623,7 @@ print_aligned_vertical(const char *title, const char *const *headers,
else
numeric_locale_len
=
0
;
tmp
=
pg_wcswidth
(
(
unsigned
char
*
)
*
ptr
,
strlen
(
*
ptr
),
encoding
)
+
numeric_locale_len
;
tmp
=
pg_wcswidth
(
*
ptr
,
strlen
(
*
ptr
),
encoding
)
+
numeric_locale_len
;
if
(
tmp
>
dwidth
)
dwidth
=
tmp
;
cell_w
[
i
]
=
tmp
;
...
...
src/include/mb/pg_wchar.h
View file @
88896855
/* $PostgreSQL: pgsql/src/include/mb/pg_wchar.h,v 1.6
1 2005/08/05 15:01:48
tgl Exp $ */
/* $PostgreSQL: pgsql/src/include/mb/pg_wchar.h,v 1.6
2 2005/09/24 17:53:27
tgl Exp $ */
#ifndef PG_WCHAR_H
#define PG_WCHAR_H
...
...
@@ -280,22 +280,22 @@ typedef struct
unsigned
int
utf
;
/* UTF8 */
}
pg_local_to_utf
;
extern
int
pg_mb2wchar
(
const
unsigned
char
*
from
,
pg_wchar
*
to
);
extern
int
pg_mb2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
);
extern
int
pg_mb2wchar
(
const
char
*
from
,
pg_wchar
*
to
);
extern
int
pg_mb2wchar_with_len
(
const
char
*
from
,
pg_wchar
*
to
,
int
len
);
extern
int
pg_char_and_wchar_strcmp
(
const
char
*
s1
,
const
pg_wchar
*
s2
);
extern
int
pg_wchar_strncmp
(
const
pg_wchar
*
s1
,
const
pg_wchar
*
s2
,
size_t
n
);
extern
int
pg_char_and_wchar_strncmp
(
const
char
*
s1
,
const
pg_wchar
*
s2
,
size_t
n
);
extern
size_t
pg_wchar_strlen
(
const
pg_wchar
*
wstr
);
extern
int
pg_mblen
(
const
unsigned
char
*
mbstr
);
extern
int
pg_dsplen
(
const
unsigned
char
*
mbstr
);
extern
int
pg_encoding_mblen
(
int
encoding
,
const
unsigned
char
*
mbstr
);
extern
int
pg_encoding_dsplen
(
int
encoding
,
const
unsigned
char
*
mbstr
);
extern
int
pg_mblen
(
const
char
*
mbstr
);
extern
int
pg_dsplen
(
const
char
*
mbstr
);
extern
int
pg_encoding_mblen
(
int
encoding
,
const
char
*
mbstr
);
extern
int
pg_encoding_dsplen
(
int
encoding
,
const
char
*
mbstr
);
extern
int
pg_mule_mblen
(
const
unsigned
char
*
mbstr
);
extern
int
pg_mic_mblen
(
const
unsigned
char
*
mbstr
);
extern
int
pg_mbstrlen
(
const
unsigned
char
*
mbstr
);
extern
int
pg_mbstrlen_with_len
(
const
unsigned
char
*
mbstr
,
int
len
);
extern
int
pg_mbcliplen
(
const
unsigned
char
*
mbstr
,
int
len
,
int
limit
);
extern
int
pg_mbcharcliplen
(
const
unsigned
char
*
mbstr
,
int
len
,
int
imit
);
extern
int
pg_mbstrlen
(
const
char
*
mbstr
);
extern
int
pg_mbstrlen_with_len
(
const
char
*
mbstr
,
int
len
);
extern
int
pg_mbcliplen
(
const
char
*
mbstr
,
int
len
,
int
limit
);
extern
int
pg_mbcharcliplen
(
const
char
*
mbstr
,
int
len
,
int
imit
);
extern
int
pg_encoding_max_length
(
int
encoding
);
extern
int
pg_database_encoding_max_length
(
void
);
...
...
@@ -317,8 +317,8 @@ extern unsigned char *pg_do_encoding_conversion(unsigned char *src, int len,
int
src_encoding
,
int
dest_encoding
);
extern
unsigned
char
*
pg_client_to_server
(
unsigned
char
*
s
,
int
len
);
extern
unsigned
char
*
pg_server_to_client
(
unsigned
char
*
s
,
int
len
);
extern
char
*
pg_client_to_server
(
const
char
*
s
,
int
len
);
extern
char
*
pg_server_to_client
(
const
char
*
s
,
int
len
);
extern
unsigned
short
BIG5toCNS
(
unsigned
short
big5
,
unsigned
char
*
lc
);
extern
unsigned
short
CNStoBIG5
(
unsigned
short
cns
,
unsigned
char
lc
);
...
...
@@ -329,7 +329,7 @@ extern void LocalToUtf(unsigned char *iso, unsigned char *utf,
extern
void
UtfToLocal
(
unsigned
char
*
utf
,
unsigned
char
*
iso
,
pg_utf_to_local
*
map
,
int
size
,
int
len
);
extern
bool
pg_verifymbstr
(
const
unsigned
char
*
mbstr
,
int
len
,
bool
noError
);
extern
bool
pg_verifymbstr
(
const
char
*
mbstr
,
int
len
,
bool
noError
);
extern
void
pg_ascii2mic
(
unsigned
char
*
src
,
unsigned
char
*
dest
,
int
len
);
extern
void
pg_mic2ascii
(
unsigned
char
*
src
,
unsigned
char
*
dest
,
int
len
);
...
...
src/interfaces/libpq/fe-exec.c
View file @
88896855
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.17
4 2005/08/23 21:02:03 momjian
Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.17
5 2005/09/24 17:53:28 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -2429,7 +2429,7 @@ PQescapeBytea(const unsigned char *bintext, size_t binlen, size_t *bytealen)
{
if
(
*
vp
<
0x20
||
*
vp
>
0x7e
)
{
(
void
)
sprintf
(
rp
,
"
\\\\
%03o"
,
*
vp
);
(
void
)
sprintf
(
(
char
*
)
rp
,
"
\\\\
%03o"
,
*
vp
);
rp
+=
5
;
}
else
if
(
*
vp
==
'\''
)
...
...
@@ -2483,7 +2483,7 @@ PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
if
(
strtext
==
NULL
)
return
NULL
;
strtextlen
=
strlen
(
strtext
);
strtextlen
=
strlen
(
(
const
char
*
)
strtext
);
/*
* Length of input is max length of output, but add one to avoid
...
...
src/interfaces/libpq/fe-misc.c
View file @
88896855
...
...
@@ -23,7 +23,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.1
19 2005/08/23 21:02:03 momjian
Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-misc.c,v 1.1
20 2005/09/24 17:53:28 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1092,7 +1092,7 @@ pqSocketPoll(int sock, int forRead, int forWrite, time_t end_time)
* specified encoding.
*/
int
PQmblen
(
const
unsigned
char
*
s
,
int
encoding
)
PQmblen
(
const
char
*
s
,
int
encoding
)
{
return
(
pg_encoding_mblen
(
encoding
,
s
));
}
...
...
@@ -1102,7 +1102,7 @@ PQmblen(const unsigned char *s, int encoding)
* specified encoding.
*/
int
PQdsplen
(
const
unsigned
char
*
s
,
int
encoding
)
PQdsplen
(
const
char
*
s
,
int
encoding
)
{
return
(
pg_encoding_dsplen
(
encoding
,
s
));
}
...
...
src/interfaces/libpq/libpq-fe.h
View file @
88896855
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.11
8 2005/06/13 02:26:53
tgl Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.11
9 2005/09/24 17:53:28
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -489,10 +489,10 @@ extern int lo_export(PGconn *conn, Oid lobjId, const char *filename);
/* === in fe-misc.c === */
/* Determine length of multibyte encoded char at *s */
extern
int
PQmblen
(
const
unsigned
char
*
s
,
int
encoding
);
extern
int
PQmblen
(
const
char
*
s
,
int
encoding
);
/* Determine display length of multibyte encoded char at *s */
extern
int
PQdsplen
(
const
unsigned
char
*
s
,
int
encoding
);
extern
int
PQdsplen
(
const
char
*
s
,
int
encoding
);
/* Get encoding id from environment variable PGCLIENTENCODING */
extern
int
PQenv2encoding
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment