Changeset 5114 for trunk/psLib/src/mathtypes
- Timestamp:
- Sep 23, 2005, 2:17:44 PM (21 years ago)
- Location:
- trunk/psLib/src/mathtypes
- Files:
-
- 3 edited
-
psImage.c (modified) (4 diffs)
-
psVector.c (modified) (4 diffs)
-
psVector.h (modified) (2 diffs)
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.
Note:
See TracChangeset
for help on using the changeset viewer.
