>1) long is 64 bits on Unix-like platforms
>2) checking a long against LONG_MIN/LONG_MAX is _definitely_ pointless
>3) it's being cast to an int for the from_char_set_int() call below
>Please take your time to read the whole context of the code you're
>changing, and consider other platforms than just Windows.
Thank you for point me, about this.

regards,
Ranier Vilela

Em qui., 19 de dez. de 2019 às 20:58, Dagfinn Ilmari Mannsåker <
ilm...@ilmari.org> escreveu:

> Ranier Vilela <ranier...@gmail.com> writes:
>
> > More about expressions always false.
> > 2. src/backend/utils/adt/formatting.c
> > result is declared long. Comparison with int limits is always false.
> > 3. src/backend/utils/adt/jsonfuncs.c
> > lindex is declared long. . Comparison with int limits is always false.
>
> 1) long is 64 bits on Unix-like platforms
> 2) checking a long against LONG_MIN/LONG_MAX is _definitely_ pointless
> 3) it's being cast to an int for the from_char_set_int() call below
>
> Please take your time to read the whole context of the code you're
> changing, and consider other platforms than just Windows.
>
> - ilmari
> --
> "A disappointingly low fraction of the human race is,
>  at any given time, on fire." - Stig Sandbeck Mathisen
>
diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c
index dbed597816..f0ad9f23e5 100644
--- a/src/backend/executor/execExprInterp.c
+++ b/src/backend/executor/execExprInterp.c
@@ -2736,7 +2736,7 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
 				/* Get sub-array details from first member */
 				elem_ndims = this_ndims;
 				ndims = elem_ndims + 1;
-				if (ndims <= 0 || ndims > MAXDIM)
+				if (ndims > MAXDIM)
 					ereport(ERROR,
 							(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
 							 errmsg("number of array dimensions (%d) exceeds " \
diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c
index a6dd8b75aa..bb1e8522dd 100644
--- a/src/backend/utils/adt/network.c
+++ b/src/backend/utils/adt/network.c
@@ -280,8 +280,6 @@ network_send(inet *addr, bool is_cidr)
 	pq_sendbyte(&buf, ip_bits(addr));
 	pq_sendbyte(&buf, is_cidr);
 	nb = ip_addrsize(addr);
-	if (nb < 0)
-		nb = 0;
 	pq_sendbyte(&buf, nb);
 	addrptr = (char *) ip_addr(addr);
 	for (i = 0; i < nb; i++)

Reply via email to