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

Commit9e20406

Browse files
committed
Fix unportable use of isprint().
We must cast the arguments of <ctype.h> functions to unsignedchar to avoid problems where char is signed.Speaking of which, considering that this *is* a <ctype.h> function,it's rather remarkable that we aren't seeing more complaints aboutnot having included that header.Per buildfarm.
1 parentf1be740 commit9e20406

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/interfaces/libpq/fe-trace.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include"postgres_fe.h"
1616

17+
#include<ctype.h>
1718
#include<limits.h>
1819
#include<time.h>
1920

@@ -28,6 +29,7 @@
2829
#include"libpq-int.h"
2930
#include"port/pg_bswap.h"
3031

32+
3133
/* Enable tracing */
3234
void
3335
PQtrace(PGconn*conn,FILE*debug_port)
@@ -102,7 +104,7 @@ pqTraceOutputByte1(FILE *pfdebug, const char *data, int *cursor)
102104
* Show non-printable data in hex format, including the terminating \0
103105
* that completes ErrorResponse and NoticeResponse messages.
104106
*/
105-
if (!isprint(*v))
107+
if (!isprint((unsignedchar)*v))
106108
fprintf(pfdebug," \\x%02x",*v);
107109
else
108110
fprintf(pfdebug," %c",*v);
@@ -186,7 +188,7 @@ pqTraceOutputNchar(FILE *pfdebug, int len, const char *data, int *cursor)
186188

187189
for (next=i=0;i<len;++i)
188190
{
189-
if (isprint(v[i]))
191+
if (isprint((unsignedchar)v[i]))
190192
continue;
191193
else
192194
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp