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

Commitb802412

Browse files
committed
Fix output of Unicode normalization test
Several off-by-more-than-one errors caused the output in case of atest failure to be truncated and unintelligible.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://www.postgresql.org/message-id/flat/6a7a8516-7d11-8fbd-0e8b-eadb4f0679eb%402ndquadrant.com
1 parentc341c7d commitb802412

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

‎src/common/unicode/norm_test.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,20 @@ static char *
2323
print_wchar_str(constpg_wchar*s)
2424
{
2525
#defineBUF_DIGITS 50
26-
staticcharbuf[BUF_DIGITS*2+1];
26+
staticcharbuf[BUF_DIGITS*11+1];
2727
inti;
28+
char*p;
2829

2930
i=0;
31+
p=buf;
3032
while (*s&&i<BUF_DIGITS)
3133
{
32-
snprintf(&buf[i*2],3,"%04X",*s);
34+
p+=sprintf(p,"U+%04X",*s);
3335
i++;
3436
s++;
3537
}
36-
buf[i*2]='\0';
38+
*p='\0';
39+
3740
returnbuf;
3841
}
3942

@@ -67,9 +70,9 @@ main(int argc, char **argv)
6770
if (pg_wcscmp(test->output,result)!=0)
6871
{
6972
printf("FAILURE (NormalizationTest.txt line %d):\n",test->linenum);
70-
printf("input:\t%s\n",print_wchar_str(test->input));
71-
printf("expected:\t%s\n",print_wchar_str(test->output));
72-
printf("got\t%s\n",print_wchar_str(result));
73+
printf("input:%s\n",print_wchar_str(test->input));
74+
printf("expected:%s\n",print_wchar_str(test->output));
75+
printf("got:%s\n",print_wchar_str(result));
7376
printf("\n");
7477
exit(1);
7578
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp