Skip to content

Commit be2de3b

Browse files
committed
The patch solves this problem, I hope...
Christopher Kings-Lynne wrote: > I'm still getting ltree failures on 64bit freebsd: > > sed 's,MODULE_PATHNAME,$libdir/ltree,g' ltree.sql.in >ltree.sql > gcc -pipe -O -g -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -DPI > C -DLOWER_NODE -I. -I../../src/include -c -o ltree_io.o ltree_io.c -MMD > ltree_io.c: In function `ltree_in': > ltree_io.c:57: warning: int format, different type arg (arg 3) > ltree_io.c:63: warning: int format, different type arg (arg 4) > ltree_io.c:68: warning: int format, different type arg (arg 3) Teodor Sigaev
1 parent 0d916a4 commit be2de3b

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

contrib/ltree/crc32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,6 @@ crc32_sz(char *buf, int size)
105105
len = 0;
106106
nr = size;
107107
for (len += nr, p = buf; nr--; ++p)
108-
_CRC32_(crc, TOLOWER(*p));
108+
_CRC32_(crc, TOLOWER((unsigned int)*p));
109109
return ~crc;
110110
}

contrib/ltree/ltree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ typedef struct {
8383
#ifndef abs
8484
#define abs(a) ((a) < (0) ? -(a) : (a))
8585
#endif
86-
#define ISALNUM(x) ( isalnum(x) || (x) == '_' )
86+
#define ISALNUM(x) ( isalnum((unsigned int)(x)) || (x) == '_' )
8787

8888
/* full text query */
8989

contrib/ltree/ltree_io.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ PG_FUNCTION_INFO_V1(lquery_out);
1818
Datum lquery_out(PG_FUNCTION_ARGS);
1919

2020

21-
#define UNCHAR elog(ERROR,"Syntax error in position %d near '%c'", ptr-buf, *ptr)
21+
#define UNCHAR elog(ERROR,"Syntax error in position %d near '%c'", (int)(ptr-buf), *ptr)
2222

2323
typedef struct {
2424
char* start;
@@ -60,7 +60,7 @@ ltree_in(PG_FUNCTION_ARGS) {
6060
lptr->len = ptr - lptr->start;
6161
if ( lptr->len > 255 )
6262
elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d",
63-
lptr->len, lptr->start - buf);
63+
lptr->len, (int)(lptr->start - buf));
6464
totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
6565
lptr++;
6666
state = LTPRS_WAITNAME;
@@ -75,7 +75,7 @@ ltree_in(PG_FUNCTION_ARGS) {
7575
lptr->len = ptr - lptr->start;
7676
if ( lptr->len > 255 )
7777
elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d",
78-
lptr->len, lptr->start - buf);
78+
lptr->len, (int)(lptr->start - buf));
7979
totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
8080
lptr++;
8181
} else if ( ! (state == LTPRS_WAITNAME && lptr == list) )
@@ -214,7 +214,7 @@ lquery_in(PG_FUNCTION_ARGS) {
214214
( ( lptr->flag & LVAR_ANYEND ) ? 1 : 0 );
215215
if ( lptr->len > 255 )
216216
elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d",
217-
lptr->len, lptr->start - buf);
217+
lptr->len, (int)(lptr->start - buf));
218218
state = LQPRS_WAITVAR;
219219
} else if ( *ptr == '.' ) {
220220
lptr->len = ptr - lptr->start -
@@ -223,7 +223,7 @@ lquery_in(PG_FUNCTION_ARGS) {
223223
( ( lptr->flag & LVAR_ANYEND ) ? 1 : 0 );
224224
if ( lptr->len > 255 )
225225
elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d",
226-
lptr->len, lptr->start - buf);
226+
lptr->len, (int)(lptr->start - buf));
227227
state = LQPRS_WAITLEVEL;
228228
curqlevel = NEXTLEV(curqlevel);
229229
} else if ( ISALNUM(*ptr) ) {
@@ -244,13 +244,13 @@ lquery_in(PG_FUNCTION_ARGS) {
244244
} else if ( state == LQPRS_WAITFNUM ) {
245245
if ( *ptr == ',' ) {
246246
state = LQPRS_WAITSNUM;
247-
} else if ( isdigit(*ptr) ) {
247+
} else if ( isdigit((unsigned int)*ptr) ) {
248248
curqlevel->low = atoi( ptr );
249249
state = LQPRS_WAITND;
250250
} else
251251
UNCHAR;
252252
} else if ( state == LQPRS_WAITSNUM ) {
253-
if ( isdigit(*ptr) ) {
253+
if ( isdigit((unsigned int)*ptr) ) {
254254
curqlevel->high = atoi( ptr );
255255
state = LQPRS_WAITCLOSE;
256256
} else if ( *ptr == '}' ) {
@@ -261,15 +261,15 @@ lquery_in(PG_FUNCTION_ARGS) {
261261
} else if ( state == LQPRS_WAITCLOSE ) {
262262
if ( *ptr == '}' )
263263
state = LQPRS_WAITEND;
264-
else if ( !isdigit(*ptr) )
264+
else if ( !isdigit((unsigned int)*ptr) )
265265
UNCHAR;
266266
} else if ( state == LQPRS_WAITND ) {
267267
if ( *ptr == '}' ) {
268268
curqlevel->high = curqlevel->low;
269269
state = LQPRS_WAITEND;
270270
} else if ( *ptr == ',' )
271271
state = LQPRS_WAITSNUM;
272-
else if ( !isdigit(*ptr) )
272+
else if ( !isdigit((unsigned int)*ptr) )
273273
UNCHAR;
274274
} else if ( state == LQPRS_WAITEND ) {
275275
if ( *ptr == '.' ) {
@@ -293,7 +293,7 @@ lquery_in(PG_FUNCTION_ARGS) {
293293
elog(ERROR,"Unexpected end of line");
294294
if ( lptr->len > 255 )
295295
elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d",
296-
lptr->len, lptr->start - buf);
296+
lptr->len, (int)(lptr->start - buf));
297297
} else if ( state == LQPRS_WAITOPEN ) {
298298
curqlevel->high = 0xffff;
299299
} else if ( state != LQPRS_WAITEND )

contrib/ltree/ltxtquery_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1
7676
*strval = state->buf;
7777
*lenval = 1;
7878
*flag = 0;
79-
} else if ( !isspace(*(state->buf)) )
79+
} else if ( !isspace((unsigned int)*(state->buf)) )
8080
elog(ERROR,"Operand syntax error");
8181
break;
8282
case INOPERAND:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy