Changeset 5114 for trunk/psLib/src
- Timestamp:
- Sep 23, 2005, 2:17:44 PM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 7 edited
-
mathtypes/psImage.c (modified) (4 diffs)
-
mathtypes/psVector.c (modified) (4 diffs)
-
mathtypes/psVector.h (modified) (2 diffs)
-
types/psArray.c (modified) (3 diffs)
-
types/psArray.h (modified) (1 diff)
-
types/psPixels.c (modified) (5 diffs)
-
types/psPixels.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psImage.c
r5101 r5114 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.8 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-09-2 3 00:04:36$11 * @version $Revision: 1.85 $ $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 … … 272 272 complex value) 273 273 { 274 if (image == NULL) 274 if (image == NULL) { 275 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psImage_IMAGE_NULL); 275 276 return false; 276 if (x >= image->numRows || y >= image->numCols) 277 } 278 if (x >= image->numRows || y >= image->numCols) { 279 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Position too large\n"); 277 280 return false; 281 } 282 278 283 if(x < 0) 279 284 x += image->numRows; 285 if(x < 0) { 286 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid x. Negative number too large\n"); 287 return false; 288 } 289 280 290 if(y < 0) 281 291 y += image->numCols; 292 if(y < 0) { 293 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid y. Negative number too large\n"); 294 return false; 295 } 282 296 283 297 switch (image->type.type) { … … 330 344 int y) 331 345 { 332 if (image == NULL) 346 if (image == NULL) { 347 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psImage_IMAGE_NULL); 333 348 return NAN; 334 if (x >= image->numRows || y >= image->numCols) 349 } 350 if (x >= image->numRows || y >= image->numCols) { 351 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Position too large\n"); 335 352 return NAN; 353 } 354 336 355 if(x < 0) 337 356 x += image->numRows; 357 if(x < 0) { 358 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid x. Negative number too large\n"); 359 return NAN; 360 } 361 338 362 if(y < 0) 339 363 y += image->numCols; 364 if(y < 0) { 365 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid y. Negative number too large\n"); 366 return NAN; 367 } 340 368 341 369 switch (image->type.type) { … … 377 405 break; 378 406 default: 407 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Invalid psImage Data Type\n"); 379 408 return NAN; 380 409 } -
trunk/psLib/src/mathtypes/psVector.c
r5101 r5114 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.5 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-09-2 3 00:04:36$11 * @version $Revision: 1.56 $ $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 … … 817 817 complex value) 818 818 { 819 if (input == NULL) 819 if (input == NULL) { 820 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psVector_NULL); 820 821 return false; 821 if (position >= input->n) 822 } 823 if (position > input->n) { 824 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Number too large\n"); 822 825 return false; 823 if(position < 0) 826 } 827 if (position < 0) 824 828 position += input->n; 829 if (position < 0) { 830 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Negative number too large\n"); 831 return false; 832 } 833 834 if (position == input->n) { 835 if (position >= input->nalloc) { 836 psError(PS_ERR_BAD_PARAMETER_NULL, true, 837 "Specified position, %ld, is greater than n+1 of the vector, %ld.", 838 position, input->nalloc); 839 return false; 840 } 841 (*(psVector**)&input)->n++; 842 } 825 843 826 844 switch (input->type.type) { … … 872 890 long position) 873 891 { 874 if (input == NULL) 892 if (input == NULL) { 893 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psVector_NULL); 875 894 return NAN; 895 } 876 896 if (position >= input->n) { 897 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Number too large\n"); 877 898 return NAN; 878 899 } 879 900 if(position < 0) 880 901 position += input->n; 881 902 if (position < 0) { 903 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Negative number too large\n"); 904 return NAN; 905 } 882 906 switch (input->type.type) { 883 907 case PS_TYPE_U8: … … 918 942 break; 919 943 default: 944 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Invalid psVector Data Type\n"); 920 945 return NAN; 921 946 } -
trunk/psLib/src/mathtypes/psVector.h
r5089 r5114 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.4 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-09-2 2 02:32:00$13 * @version $Revision: 1.48 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-09-24 00:17:44 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 34 34 typedef struct 35 35 { 36 psMathType type; ///< Type of data.36 psMathType type; ///< Type of data. 37 37 long n; ///< Number of elements in use. 38 38 const long nalloc; ///< Total number of elements available. -
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.
