ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/bioseg/trunk/bioseg.c
(Generate patch)
# Line 161 | Line 161
161   }
162  
163   #ifdef INTERBASE_COORDS
164 < #define MIN_LOWER 0l
164 > #define MIN_LOWER INT_MIN
165   #else
166   #define MIN_LOWER 1l
167   #endif
# Line 207 | Line 207
207    }
208  
209    if (long_result < MIN_LOWER) {
210 +    // when INTERBASE_COORDS is set, on machines where
211 +    // sizeof(long int) == sizeof(int32) this block won't be executed because
212 +    // strtol() will return ERANGE
213      ereport(ERROR,
214              (errcode(ERRCODE_SYNTAX_ERROR),
215               errmsg("bad bioseg representation"),
216 <             errdetail("integer %ld at: %s is out of range - must be >= %ld", long_result, *strp, MIN_LOWER)));
216 >             errdetail("integer %ld at: %s is out of range - must be >= %d",
217 >                       long_result, *strp, MIN_LOWER)));
218      return 0;
219    }
220  
221    if (long_result > INT_MAX) {
222 +    // on machines where sizeof(long int) == sizeof(int32) this won't happen
223 +    // because strtol() will return ERANGE
224      ereport(ERROR,
225              (errcode(ERRCODE_SYNTAX_ERROR),
226               errmsg("bad bioseg representation"),
227 <             errdetail("integer %ld at: %s is out of range - must be <= %d", long_result, *strp, UINT_MAX)));
227 >             errdetail("integer %ld at: %s is out of range - must be <= %d",
228 >                       long_result, *strp, INT_MAX)));
229      return 0;
230    }
231  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines