|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.9 1997/10/25 05:19:22 thomas Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.10 1997/11/17 16:24:17 thomas Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
|
30 | 30 | */
|
31 | 31 | #include<stdio.h>
|
32 | 32 | #include<string.h>
|
| 33 | +#ifdefHAVE_LIMITS |
| 34 | +#include<limits.h> |
| 35 | +#endif |
33 | 36 |
|
34 | 37 | #include"postgres.h"
|
35 | 38 | #include"fmgr.h"
|
36 | 39 | #include"utils/builtins.h"/* where the declarations go */
|
37 | 40 |
|
| 41 | +#ifndefSHRT_MAX |
| 42 | +#defineSHRT_MAX (0x7FFF) |
| 43 | +#endif |
| 44 | +#ifndefSHRT_MIN |
| 45 | +#defineSHRT_MIN (-0x8000) |
| 46 | +#endif |
| 47 | + |
38 | 48 | /*****************************************************************************
|
39 | 49 | * USER I/O ROUTINES *
|
40 | 50 | *****************************************************************************/
|
@@ -221,10 +231,10 @@ i2toi4(int16 arg1)
|
221 | 231 | int16
|
222 | 232 | i4toi2(int32arg1)
|
223 | 233 | {
|
224 |
| -if (arg1<-0x8000) |
225 |
| -elog(NOTICE,"i4toi2:\"%d\" causes int2 underflow",arg1); |
226 |
| -if (arg1>0x7FFF) |
227 |
| -elog(NOTICE,"i4toi2:\"%d\" causes int2 overflow",arg1); |
| 234 | +if (arg1<SHRT_MIN) |
| 235 | +elog(WARN,"i4toi2:'%d' causes int2 underflow",arg1); |
| 236 | +if (arg1>SHRT_MAX) |
| 237 | +elog(WARN,"i4toi2:'%d' causes int2 overflow",arg1); |
228 | 238 |
|
229 | 239 | return ((int16)arg1);
|
230 | 240 | }
|
|