Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Provide feedback

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

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit60e9c22

Browse files
committed
Fix ASCII case in pg_wchar2mule_with_len.
Also some cosmetic improvements for wchar-to-mblen patch.
1 parent379607c commit60e9c22

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

‎src/backend/utils/mb/wchar.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ pg_euc2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
9999
*to |=*from++;
100100
len-=2;
101101
}
102-
else
103-
/* must be ASCII */
102+
else/* must be ASCII */
104103
{
105104
*to=*from++;
106105
len--;
@@ -340,7 +339,7 @@ pg_euctw_dsplen(const unsigned char *s)
340339
}
341340

342341
/*
343-
* Convert pg_wchar to EUC_* encoding.
342+
* Convert pg_wchar to EUC_* encoding.
344343
* caller must allocate enough space for "to", including a trailing zero!
345344
* len: length of from.
346345
* "from" not necessarily null terminated.
@@ -353,23 +352,23 @@ pg_wchar2euc_with_len(const pg_wchar *from, unsigned char *to, int len)
353352
while (len>0&&*from)
354353
{
355354
unsignedcharc;
356-
357-
if ((c=*from >>24))
355+
356+
if ((c=(*from >>24)))
358357
{
359358
*to++=c;
360359
*to++= (*from >>16)&0xff;
361360
*to++= (*from >>8)&0xff;
362361
*to++=*from&0xff;
363362
cnt+=4;
364363
}
365-
elseif ((c=*from >>16))
364+
elseif ((c=(*from >>16)))
366365
{
367366
*to++=c;
368367
*to++= (*from >>8)&0xff;
369368
*to++=*from&0xff;
370369
cnt+=3;
371370
}
372-
elseif ((c=*from >>8))
371+
elseif ((c=(*from >>8)))
373372
{
374373
*to++=c;
375374
*to++=*from&0xff;
@@ -379,7 +378,7 @@ pg_wchar2euc_with_len(const pg_wchar *from, unsigned char *to, int len)
379378
{
380379
*to++=*from;
381380
cnt++;
382-
}
381+
}
383382
from++;
384383
len--;
385384
}
@@ -516,7 +515,7 @@ pg_wchar2utf_with_len(const pg_wchar *from, unsigned char *to, int len)
516515
while (len>0&&*from)
517516
{
518517
intchar_len;
519-
518+
520519
unicode_to_utf8(*from,to);
521520
char_len=pg_utf_mblen(to);
522521
cnt+=char_len;
@@ -803,10 +802,11 @@ static int
803802
pg_wchar2mule_with_len(constpg_wchar*from,unsignedchar*to,intlen)
804803
{
805804
intcnt=0;
806-
unsignedcharlb;
807805

808806
while (len>0&&*from)
809807
{
808+
unsignedcharlb;
809+
810810
lb= (*from >>16)&0xff;
811811
if (IS_LC1(lb))
812812
{
@@ -853,7 +853,7 @@ pg_wchar2mule_with_len(const pg_wchar *from, unsigned char *to, int len)
853853
}
854854
else
855855
{
856-
*to++=lb;
856+
*to++=*from&0xff;
857857
cnt+=1;
858858
}
859859
from++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp