From 8ff2bccee31a7be12f653bc533b3e76c052534f8 Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Fri, 26 Jan 2007 17:45:42 +0000 Subject: Squelch some VC++ compiler warnings. Mark float literals with the "f" suffix, to distinguish them from doubles. Make some function declarations and definitions use the "const" qualifier for arguments consistently. Ignore warning 4102 ("unreferenced label"), because such warnings are always emitted by bison-generated code. Patch from Magnus Hagander. --- contrib/intarray/_int.h | 2 +- contrib/pg_trgm/trgm_op.c | 2 +- contrib/tsearch2/rank.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'contrib') diff --git a/contrib/intarray/_int.h b/contrib/intarray/_int.h index bf10f109220..cee970d1b1f 100644 --- a/contrib/intarray/_int.h +++ b/contrib/intarray/_int.h @@ -108,7 +108,7 @@ typedef void (*formfloat) (ArrayType *, float *); /* ** useful function */ -bool isort(int4 *a, const int len); +bool isort(int4 *a, int len); ArrayType *new_intArrayType(int num); ArrayType *copy_intArrayType(ArrayType *a); ArrayType *resize_intArrayType(ArrayType *a, int num); diff --git a/contrib/pg_trgm/trgm_op.c b/contrib/pg_trgm/trgm_op.c index 28690339327..f31b9bf572a 100644 --- a/contrib/pg_trgm/trgm_op.c +++ b/contrib/pg_trgm/trgm_op.c @@ -5,7 +5,7 @@ PG_MODULE_MAGIC; -float4 trgm_limit = 0.3; +float4 trgm_limit = 0.3f; PG_FUNCTION_INFO_V1(set_limit); Datum set_limit(PG_FUNCTION_ARGS); diff --git a/contrib/tsearch2/rank.c b/contrib/tsearch2/rank.c index f5de5c7746f..36fc2594009 100644 --- a/contrib/tsearch2/rank.c +++ b/contrib/tsearch2/rank.c @@ -37,7 +37,7 @@ Datum rank_cd_def(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(get_covers); Datum get_covers(PG_FUNCTION_ARGS); -static float weights[] = {0.1, 0.2, 0.4, 1.0}; +static float weights[] = {0.1f, 0.2f, 0.4f, 1.0f}; #define wpos(wep) ( w[ WEP_GETWEIGHT(wep) ] ) @@ -59,7 +59,7 @@ static float4 word_distance(int4 w) { if (w > 100) - return 1e-30; + return (float4)1e-30; return 1.0 / (1.005 + 0.05 * exp(((float4) w) / 1.5 - 2)); } @@ -331,7 +331,7 @@ calc_rank(float *w, tsvector * t, QUERYTYPE * q, int4 method) calc_rank_and(w, t, q) : calc_rank_or(w, t, q); if (res < 0) - res = 1e-20; + res = (float)1e-20; if ((method & RANK_NORM_LOGLENGTH) && t->size > 0) res /= log((double) (cnt_length(t) + 1)) / log(2.0); -- cgit v1.2.3