Changeset 5114 for trunk/psLib/src/types
- Timestamp:
- Sep 23, 2005, 2:17:44 PM (21 years ago)
- Location:
- trunk/psLib/src/types
- Files:
-
- 4 edited
-
psArray.c (modified) (3 diffs)
-
psArray.h (modified) (1 diff)
-
psPixels.c (modified) (5 diffs)
-
psPixels.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/psArray.c
r4898 r5114 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.3 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-0 8-30 01:14:13$11 * @version $Revision: 1.38 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-24 00:17:44 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 178 178 } 179 179 180 if (position >= array->nalloc) 181 { 182 psError(PS_ERR_BAD_PARAMETER_NULL, true, 183 PS_ERRORTEXT_psArray_POSITION_BEYOND_NALLOC, 184 position, array->nalloc); 185 return false; 186 } 187 180 if (position > array->n) 181 { 182 psError(PS_ERR_BAD_PARAMETER_NULL, true, 183 "Specified position, %ld, is greater than n+1 of the array, %ld.", 184 position, array->n); 185 return false; 186 } 187 188 if (position < 0) 189 position += array->n; 190 if (position < 0) 191 { 192 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Negative number too large\n"); 193 return false; 194 } 195 196 if (position == array->n) 197 { 198 if (position >= array->nalloc) { 199 psError(PS_ERR_BAD_PARAMETER_NULL, true, 200 PS_ERRORTEXT_psArray_POSITION_BEYOND_NALLOC, 201 position, array->nalloc); 202 return false; 203 } 204 array->n++; 205 } 188 206 psFree(array->data[position]); 189 207 array->data[position] = data; … … 202 220 } 203 221 204 if (position >= array->nalloc) { 205 psError(PS_ERR_BAD_PARAMETER_NULL, true, 206 PS_ERRORTEXT_psArray_POSITION_BEYOND_NALLOC, 207 position, array->nalloc); 208 return NULL; 209 } 210 222 if (position >= array->n) { 223 psError(PS_ERR_BAD_PARAMETER_NULL, true, 224 "Specified position, %ld, is greater than n+1 of the array, %ld.", 225 position, array->n); 226 return NULL; 227 } 228 if (position < 0) 229 position += array->n; 230 if (position < 0) { 231 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Negative number too large\n"); 232 return NULL; 233 } 211 234 return array->data[position]; 212 235 } -
trunk/psLib/src/types/psArray.h
r4898 r5114 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.3 1$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-0 8-30 01:14:13$14 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-09-24 00:17:44 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/src/types/psPixels.c
r5101 r5114 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-09-2 3 00:04:36$9 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-09-24 00:17:44 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 337 337 psPixelCoord value) 338 338 { 339 if (pixels == NULL) 339 if (pixels == NULL) { 340 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psPixels_NULL); 340 341 return false; 341 if (position > pixels->n) 342 } 343 if (position > pixels->n) { 344 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Number too large\n"); 342 345 return false; 346 } 343 347 if(position < 0) 344 348 position += pixels->n; 349 if(position < 0) { 350 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Negative number too large\n"); 351 return false; 352 } 345 353 if (position == pixels->n) { 346 if (position >= pixels->nalloc) 354 if (position >= pixels->nalloc) { 355 psError(PS_ERR_BAD_PARAMETER_NULL, true, 356 "Specified position, %ld, is greater than n+1 of the pixels, %ld.", 357 position, pixels->nalloc); 347 358 return false; 359 } 348 360 pixels->n++; 349 361 } … … 359 371 psPixelCoord out; 360 372 if (pixels == NULL) { 373 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psPixels_NULL); 361 374 out.x = 0; //XXX: should be NAN when changed to float 362 375 out.y = 0; //XXX: should be NAN when changed to float … … 364 377 } 365 378 if (position >= pixels->n) { 379 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Number too large\n"); 366 380 out.x = 0; //XXX: should be NAN when changed to float 367 381 out.y = 0; //XXX: should be NAN when changed to float … … 370 384 if (position < 0) 371 385 position += pixels->n; 386 if (position < 0) { 387 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Negative number too large\n"); 388 out.x = 0; //XXX: should be NAN when changed to float 389 out.y = 0; //XXX: should be NAN when changed to float 390 return out; 391 } 372 392 out.x = pixels->data[position].x; 373 393 out.y = pixels->data[position].y; -
trunk/psLib/src/types/psPixels.h
r5101 r5114 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-09-2 3 00:04:36$9 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-09-24 00:17:44 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
Note:
See TracChangeset
for help on using the changeset viewer.
