Commit be2de3b9 authored by Bruce Momjian's avatar Bruce Momjian

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
parent 0d916a4b
...@@ -105,6 +105,6 @@ crc32_sz(char *buf, int size) ...@@ -105,6 +105,6 @@ crc32_sz(char *buf, int size)
len = 0; len = 0;
nr = size; nr = size;
for (len += nr, p = buf; nr--; ++p) for (len += nr, p = buf; nr--; ++p)
_CRC32_(crc, TOLOWER(*p)); _CRC32_(crc, TOLOWER((unsigned int)*p));
return ~crc; return ~crc;
} }
...@@ -83,7 +83,7 @@ typedef struct { ...@@ -83,7 +83,7 @@ typedef struct {
#ifndef abs #ifndef abs
#define abs(a) ((a) < (0) ? -(a) : (a)) #define abs(a) ((a) < (0) ? -(a) : (a))
#endif #endif
#define ISALNUM(x) ( isalnum(x) || (x) == '_' ) #define ISALNUM(x) ( isalnum((unsigned int)(x)) || (x) == '_' )
/* full text query */ /* full text query */
......
...@@ -18,7 +18,7 @@ PG_FUNCTION_INFO_V1(lquery_out); ...@@ -18,7 +18,7 @@ PG_FUNCTION_INFO_V1(lquery_out);
Datum lquery_out(PG_FUNCTION_ARGS); Datum lquery_out(PG_FUNCTION_ARGS);
#define UNCHAR elog(ERROR,"Syntax error in position %d near '%c'", ptr-buf, *ptr) #define UNCHAR elog(ERROR,"Syntax error in position %d near '%c'", (int)(ptr-buf), *ptr)
typedef struct { typedef struct {
char* start; char* start;
...@@ -60,7 +60,7 @@ ltree_in(PG_FUNCTION_ARGS) { ...@@ -60,7 +60,7 @@ ltree_in(PG_FUNCTION_ARGS) {
lptr->len = ptr - lptr->start; lptr->len = ptr - lptr->start;
if ( lptr->len > 255 ) if ( lptr->len > 255 )
elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d", elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d",
lptr->len, lptr->start - buf); lptr->len, (int)(lptr->start - buf));
totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE); totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
lptr++; lptr++;
state = LTPRS_WAITNAME; state = LTPRS_WAITNAME;
...@@ -75,7 +75,7 @@ ltree_in(PG_FUNCTION_ARGS) { ...@@ -75,7 +75,7 @@ ltree_in(PG_FUNCTION_ARGS) {
lptr->len = ptr - lptr->start; lptr->len = ptr - lptr->start;
if ( lptr->len > 255 ) if ( lptr->len > 255 )
elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d", elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d",
lptr->len, lptr->start - buf); lptr->len, (int)(lptr->start - buf));
totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE); totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
lptr++; lptr++;
} else if ( ! (state == LTPRS_WAITNAME && lptr == list) ) } else if ( ! (state == LTPRS_WAITNAME && lptr == list) )
...@@ -214,7 +214,7 @@ lquery_in(PG_FUNCTION_ARGS) { ...@@ -214,7 +214,7 @@ lquery_in(PG_FUNCTION_ARGS) {
( ( lptr->flag & LVAR_ANYEND ) ? 1 : 0 ); ( ( lptr->flag & LVAR_ANYEND ) ? 1 : 0 );
if ( lptr->len > 255 ) if ( lptr->len > 255 )
elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d", elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d",
lptr->len, lptr->start - buf); lptr->len, (int)(lptr->start - buf));
state = LQPRS_WAITVAR; state = LQPRS_WAITVAR;
} else if ( *ptr == '.' ) { } else if ( *ptr == '.' ) {
lptr->len = ptr - lptr->start - lptr->len = ptr - lptr->start -
...@@ -223,7 +223,7 @@ lquery_in(PG_FUNCTION_ARGS) { ...@@ -223,7 +223,7 @@ lquery_in(PG_FUNCTION_ARGS) {
( ( lptr->flag & LVAR_ANYEND ) ? 1 : 0 ); ( ( lptr->flag & LVAR_ANYEND ) ? 1 : 0 );
if ( lptr->len > 255 ) if ( lptr->len > 255 )
elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d", elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d",
lptr->len, lptr->start - buf); lptr->len, (int)(lptr->start - buf));
state = LQPRS_WAITLEVEL; state = LQPRS_WAITLEVEL;
curqlevel = NEXTLEV(curqlevel); curqlevel = NEXTLEV(curqlevel);
} else if ( ISALNUM(*ptr) ) { } else if ( ISALNUM(*ptr) ) {
...@@ -244,13 +244,13 @@ lquery_in(PG_FUNCTION_ARGS) { ...@@ -244,13 +244,13 @@ lquery_in(PG_FUNCTION_ARGS) {
} else if ( state == LQPRS_WAITFNUM ) { } else if ( state == LQPRS_WAITFNUM ) {
if ( *ptr == ',' ) { if ( *ptr == ',' ) {
state = LQPRS_WAITSNUM; state = LQPRS_WAITSNUM;
} else if ( isdigit(*ptr) ) { } else if ( isdigit((unsigned int)*ptr) ) {
curqlevel->low = atoi( ptr ); curqlevel->low = atoi( ptr );
state = LQPRS_WAITND; state = LQPRS_WAITND;
} else } else
UNCHAR; UNCHAR;
} else if ( state == LQPRS_WAITSNUM ) { } else if ( state == LQPRS_WAITSNUM ) {
if ( isdigit(*ptr) ) { if ( isdigit((unsigned int)*ptr) ) {
curqlevel->high = atoi( ptr ); curqlevel->high = atoi( ptr );
state = LQPRS_WAITCLOSE; state = LQPRS_WAITCLOSE;
} else if ( *ptr == '}' ) { } else if ( *ptr == '}' ) {
...@@ -261,7 +261,7 @@ lquery_in(PG_FUNCTION_ARGS) { ...@@ -261,7 +261,7 @@ lquery_in(PG_FUNCTION_ARGS) {
} else if ( state == LQPRS_WAITCLOSE ) { } else if ( state == LQPRS_WAITCLOSE ) {
if ( *ptr == '}' ) if ( *ptr == '}' )
state = LQPRS_WAITEND; state = LQPRS_WAITEND;
else if ( !isdigit(*ptr) ) else if ( !isdigit((unsigned int)*ptr) )
UNCHAR; UNCHAR;
} else if ( state == LQPRS_WAITND ) { } else if ( state == LQPRS_WAITND ) {
if ( *ptr == '}' ) { if ( *ptr == '}' ) {
...@@ -269,7 +269,7 @@ lquery_in(PG_FUNCTION_ARGS) { ...@@ -269,7 +269,7 @@ lquery_in(PG_FUNCTION_ARGS) {
state = LQPRS_WAITEND; state = LQPRS_WAITEND;
} else if ( *ptr == ',' ) } else if ( *ptr == ',' )
state = LQPRS_WAITSNUM; state = LQPRS_WAITSNUM;
else if ( !isdigit(*ptr) ) else if ( !isdigit((unsigned int)*ptr) )
UNCHAR; UNCHAR;
} else if ( state == LQPRS_WAITEND ) { } else if ( state == LQPRS_WAITEND ) {
if ( *ptr == '.' ) { if ( *ptr == '.' ) {
...@@ -293,7 +293,7 @@ lquery_in(PG_FUNCTION_ARGS) { ...@@ -293,7 +293,7 @@ lquery_in(PG_FUNCTION_ARGS) {
elog(ERROR,"Unexpected end of line"); elog(ERROR,"Unexpected end of line");
if ( lptr->len > 255 ) if ( lptr->len > 255 )
elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d", elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d",
lptr->len, lptr->start - buf); lptr->len, (int)(lptr->start - buf));
} else if ( state == LQPRS_WAITOPEN ) { } else if ( state == LQPRS_WAITOPEN ) {
curqlevel->high = 0xffff; curqlevel->high = 0xffff;
} else if ( state != LQPRS_WAITEND ) } else if ( state != LQPRS_WAITEND )
......
...@@ -76,7 +76,7 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1 ...@@ -76,7 +76,7 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1
*strval = state->buf; *strval = state->buf;
*lenval = 1; *lenval = 1;
*flag = 0; *flag = 0;
} else if ( !isspace(*(state->buf)) ) } else if ( !isspace((unsigned int)*(state->buf)) )
elog(ERROR,"Operand syntax error"); elog(ERROR,"Operand syntax error");
break; break;
case INOPERAND: case INOPERAND:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment