Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
bfdd6a71
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bfdd6a71
编写于
8月 27, 2000
作者:
T
Tatsuo Ishii
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change pg_mblen and pg_encoding_mblen return types from void
to int so that they return the number of whcars.
上级
86ff9d29
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
64 addition
and
89 deletion
+64
-89
src/backend/utils/mb/Makefile
src/backend/utils/mb/Makefile
+17
-4
src/backend/utils/mb/conv.c
src/backend/utils/mb/conv.c
+1
-68
src/backend/utils/mb/mbutils.c
src/backend/utils/mb/mbutils.c
+5
-5
src/backend/utils/mb/wchar.c
src/backend/utils/mb/wchar.c
+41
-12
未找到文件。
src/backend/utils/mb/Makefile
浏览文件 @
bfdd6a71
...
...
@@ -4,7 +4,7 @@
# Makefile for utils/mb
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/utils/mb/Makefile,v 1.
8 2000/05/29 05:45:34 tgl
Exp $
# $Header: /cvsroot/pgsql/src/backend/utils/mb/Makefile,v 1.
9 2000/08/27 10:40:48 ishii
Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -19,9 +19,22 @@ all: SUBSYS.o
SUBSYS.o
:
$(OBJS)
$(LD)
$(LDREL)
$(LDOUT)
SUBSYS.o
$(OBJS)
sjistest
:
$(OBJS)
$(CC)
-c
$(CFLAGS)
-DDEBUGMAIN
conv.c
$(CC)
-o
sjistest conv.o
\
palloc.o
:
palloc.c
$(CC)
-c
$(CFLAGS)
palloc.c
sjistest.o
:
sjistest.c
$(CC)
-c
$(CFLAGS)
sjistest.c
liketest.o
:
liketest.c
$(CC)
-c
$(CFLAGS)
liketest.c
sjistest
:
$(OBJS) sjistest.o palloc.o
$(CC)
-o
sjistest sjistest.o palloc.o
\
common.o mbutils.o wchar.o wstrcmp.o wstrncmp.o variable.o
\
big5.o
$(LDFLAGS)
liketest
:
$(OBJS) liketest.o palloc.o
$(CC)
-o
liketest liketest.o palloc.o conv.o
\
common.o mbutils.o wchar.o wstrcmp.o wstrncmp.o variable.o
\
big5.o
$(LDFLAGS)
...
...
src/backend/utils/mb/conv.c
浏览文件 @
bfdd6a71
...
...
@@ -6,7 +6,7 @@
* WIN1250 client encoding support contributed by Pavel Behal
* SJIS UDC (NEC selection IBM kanji) support contributed by Eiji Tokuya
*
* $Id: conv.c,v 1.1
6 2000/06/28 03:32:45 tgl
Exp $
* $Id: conv.c,v 1.1
7 2000/08/27 10:40:48 ishii
Exp $
*
*
*/
...
...
@@ -1519,70 +1519,3 @@ pg_encoding_conv_tbl pg_conv_tbl[] = {
{
WIN1250
,
"WIN1250"
,
1
,
win12502mic
,
mic2win1250
},
/* WIN 1250 */
{
-
1
,
""
,
0
,
0
,
0
}
/* end mark */
};
#ifdef DEBUGMAIN
#include "postgres.h"
#include "utils/memutils.h"
/*
* testing for sjis2mic() and mic2sjis()
*/
int
main
()
{
unsigned
char
eucbuf
[
1024
];
unsigned
char
sjisbuf
[
1024
];
unsigned
char
sjis
[]
=
{
0x81
,
0x40
,
0xa1
,
0xf0
,
0x40
,
0xf0
,
0x9e
,
0xf5
,
0x40
,
0xfa
,
0x40
,
0xfa
,
0x54
,
0xfa
,
0x7b
,
0x00
};
int
i
;
sjis2mic
(
sjis
,
eucbuf
,
1024
);
for
(
i
=
0
;
i
<
1024
;
i
++
)
{
if
(
eucbuf
[
i
])
printf
(
"%02x "
,
eucbuf
[
i
]);
else
{
printf
(
"
\n
"
);
break
;
}
}
mic2sjis
(
eucbuf
,
sjisbuf
,
1024
);
for
(
i
=
0
;
i
<
1024
;
i
++
)
{
if
(
sjisbuf
[
i
])
printf
(
"%02x "
,
sjisbuf
[
i
]);
else
{
printf
(
"
\n
"
);
break
;
}
}
return
(
0
);
}
void
elog
(
int
lev
,
const
char
*
fmt
,...)
{
}
MemoryContext
CurrentMemoryContext
;
void
*
MemoryContextAlloc
(
MemoryContext
context
,
Size
size
)
{
}
void
pfree
(
void
*
pointer
)
{
}
void
*
repalloc
(
void
*
pointer
,
Size
size
)
{
}
#endif
src/backend/utils/mb/mbutils.c
浏览文件 @
bfdd6a71
...
...
@@ -3,7 +3,7 @@
* client encoding and server internal encoding.
* (currently mule internal code (mic) is used)
* Tatsuo Ishii
* $Id: mbutils.c,v 1.1
0 2000/06/13 07:35:12 tgl
Exp $ */
* $Id: mbutils.c,v 1.1
1 2000/08/27 10:40:48 ishii
Exp $ */
#include "postgres.h"
...
...
@@ -173,17 +173,17 @@ pg_server_to_client(unsigned char *s, int len)
}
/* convert a multi-byte string to a wchar */
void
int
pg_mb2wchar
(
const
unsigned
char
*
from
,
pg_wchar
*
to
)
{
(
*
pg_wchar_table
[
GetDatabaseEncoding
()].
mb2wchar_with_len
)
(
from
,
to
,
strlen
(
from
));
return
(
*
pg_wchar_table
[
GetDatabaseEncoding
()].
mb2wchar_with_len
)
(
from
,
to
,
strlen
(
from
));
}
/* convert a multi-byte string to a wchar with a limited length */
void
int
pg_mb2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
(
*
pg_wchar_table
[
GetDatabaseEncoding
()].
mb2wchar_with_len
)
(
from
,
to
,
len
);
return
(
*
pg_wchar_table
[
GetDatabaseEncoding
()].
mb2wchar_with_len
)
(
from
,
to
,
len
);
}
/* returns the byte length of a multi-byte word */
...
...
src/backend/utils/mb/wchar.c
浏览文件 @
bfdd6a71
/*
* conversion functions between pg_wchar and multi-byte streams.
* Tatsuo Ishii
* $Id: wchar.c,v 1.1
1 2000/04/12 17:16:06 momjian
Exp $
* $Id: wchar.c,v 1.1
2 2000/08/27 10:40:48 ishii
Exp $
*
* WIN1250 client encoding updated by Pavel Behal
*
...
...
@@ -20,15 +20,19 @@
/*
* SQL/ASCII
*/
static
void
pg_ascii2wchar_with_len
static
int
pg_ascii2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
int
cnt
=
0
;
while
(
*
from
&&
len
>
0
)
{
*
to
++
=
*
from
++
;
len
--
;
cnt
++
;
}
*
to
=
0
;
return
(
cnt
);
}
static
int
...
...
@@ -41,9 +45,11 @@ pg_ascii_mblen(const unsigned char *s)
* EUC
*/
static
void
pg_euc2wchar_with_len
static
int
pg_euc2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
int
cnt
=
0
;
while
(
*
from
&&
len
>
0
)
{
if
(
*
from
==
SS2
)
...
...
@@ -72,8 +78,10 @@ static void pg_euc2wchar_with_len
len
--
;
}
to
++
;
cnt
++
;
}
*
to
=
0
;
return
(
cnt
);
}
static
int
...
...
@@ -95,10 +103,10 @@ pg_euc_mblen(const unsigned char *s)
/*
* EUC_JP
*/
static
void
pg_eucjp2wchar_with_len
static
int
pg_eucjp2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
pg_euc2wchar_with_len
(
from
,
to
,
len
);
return
(
pg_euc2wchar_with_len
(
from
,
to
,
len
)
);
}
static
int
...
...
@@ -110,10 +118,10 @@ pg_eucjp_mblen(const unsigned char *s)
/*
* EUC_KR
*/
static
void
pg_euckr2wchar_with_len
static
int
pg_euckr2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
pg_euc2wchar_with_len
(
from
,
to
,
len
);
return
(
pg_euc2wchar_with_len
(
from
,
to
,
len
)
);
}
static
int
...
...
@@ -125,9 +133,11 @@ pg_euckr_mblen(const unsigned char *s)
/*
* EUC_CN
*/
static
void
pg_euccn2wchar_with_len
static
int
pg_euccn2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
int
cnt
=
0
;
while
(
*
from
&&
len
>
0
)
{
if
(
*
from
==
SS2
)
...
...
@@ -157,8 +167,10 @@ static void pg_euccn2wchar_with_len
len
--
;
}
to
++
;
cnt
++
;
}
*
to
=
0
;
return
(
cnt
);
}
static
int
...
...
@@ -176,9 +188,11 @@ pg_euccn_mblen(const unsigned char *s)
/*
* EUC_TW
*/
static
void
pg_euctw2wchar_with_len
static
int
pg_euctw2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
int
cnt
=
0
;
while
(
*
from
&&
len
>
0
)
{
if
(
*
from
==
SS2
)
...
...
@@ -209,8 +223,10 @@ static void pg_euctw2wchar_with_len
len
--
;
}
to
++
;
cnt
++
;
}
*
to
=
0
;
return
(
cnt
);
}
static
int
...
...
@@ -235,12 +251,13 @@ pg_euctw_mblen(const unsigned char *s)
* len: length of from.
* "from" not necessarily null terminated.
*/
static
void
static
int
pg_utf2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
unsigned
char
c1
,
c2
,
c3
;
int
cnt
=
0
;
while
(
*
from
&&
len
>
0
)
{
...
...
@@ -273,8 +290,10 @@ pg_utf2wchar_with_len(const unsigned char *from, pg_wchar * to, int len)
len
--
;
}
to
++
;
cnt
++
;
}
*
to
=
0
;
return
(
cnt
);
}
static
int
...
...
@@ -297,9 +316,11 @@ pg_utf_mblen(const unsigned char *s)
* len: length of from.
* "from" not necessarily null terminated.
*/
static
void
static
int
pg_mule2wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
int
cnt
=
0
;
while
(
*
from
&&
len
>
0
)
{
if
(
IS_LC1
(
*
from
))
...
...
@@ -336,8 +357,10 @@ pg_mule2wchar_with_len(const unsigned char *from, pg_wchar * to, int len)
len
--
;
}
to
++
;
cnt
++
;
}
*
to
=
0
;
return
(
cnt
);
}
int
...
...
@@ -363,12 +386,18 @@ pg_mule_mblen(const unsigned char *s)
/*
* ISO8859-1
*/
static
void
static
int
pg_latin12wchar_with_len
(
const
unsigned
char
*
from
,
pg_wchar
*
to
,
int
len
)
{
int
cnt
=
0
;
while
(
*
from
&&
len
--
>
0
)
{
*
to
++
=
*
from
++
;
cnt
++
;
}
*
to
=
0
;
return
(
cnt
);
}
static
int
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录