Changeset 5114
- Timestamp:
- Sep 23, 2005, 2:17:44 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 13 edited
-
src/mathtypes/psImage.c (modified) (4 diffs)
-
src/mathtypes/psVector.c (modified) (4 diffs)
-
src/mathtypes/psVector.h (modified) (2 diffs)
-
src/types/psArray.c (modified) (3 diffs)
-
src/types/psArray.h (modified) (1 diff)
-
src/types/psPixels.c (modified) (5 diffs)
-
src/types/psPixels.h (modified) (1 diff)
-
test/mathtypes/tst_psVector.c (modified) (3 diffs)
-
test/mathtypes/verified/tst_psImage.stderr (modified) (1 diff)
-
test/mathtypes/verified/tst_psVector.stderr (modified) (1 diff)
-
test/types/tst_psArray.c (modified) (4 diffs)
-
test/types/verified/tst_psArray.stderr (modified) (1 diff)
-
test/types/verified/tst_psPixels.stderr (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 -
trunk/psLib/test/mathtypes/tst_psVector.c
r5089 r5114 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $17 * @date $Date: 2005-09-2 2 02:32:00$16 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2005-09-24 00:17:44 $ 18 18 * 19 19 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 391 391 psVector *vec = NULL; 392 392 vec = psVectorAlloc(5, PS_TYPE_S32); 393 vec->n = 0; 393 394 394 395 if ( !psVectorSet(vec, 0, 10) ) … … 396 397 if ( psVectorSet(vec, 10, 10) ) 397 398 fprintf(stderr, "VectorSet Improperly set S32 at out of range position\n"); 398 if ( !psVectorSet(vec, -1, 4) )399 fprintf(stderr, "VectorSet Failed to set S32 at position 4\n");399 if ( !psVectorSet(vec, 1, 4) ) 400 fprintf(stderr, "VectorSet Failed to set S32 at position 1\n"); 400 401 if ( (psS32)psVectorGet(vec, 0) != 10 ) 401 402 fprintf(stderr, "VectorGet Failed to return the correct S32 from position 0\n"); -
trunk/psLib/test/mathtypes/verified/tst_psImage.stderr
r5101 r5114 138 138 \**********************************************************************************/ 139 139 140 <DATE><TIME>|<HOST>|E|psImageSet (FILE:LINENO) 141 Invalid position. Position too large 140 142 141 143 ---> TESTPOINT PASSED (psImage{psImageInit} | tst_psImage.c) -
trunk/psLib/test/mathtypes/verified/tst_psVector.stderr
r5089 r5114 64 64 \**********************************************************************************/ 65 65 66 <DATE><TIME>|<HOST>|E|psVectorSet (FILE:LINENO) 67 Invalid position. Number too large 66 68 67 69 ---> TESTPOINT PASSED (psVector{psVectorGet/Set} | tst_psVector.c) -
trunk/psLib/test/types/tst_psArray.c
r4898 r5114 17 17 * @author Ross Harman, MHPCC 18 18 * 19 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $20 * @date $Date: 2005-0 8-30 01:14:13$19 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2005-09-24 00:17:44 $ 21 21 * 22 22 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 52 52 static psS32 testArray01( void ); 53 53 static psS32 testArrayAdd( void ); 54 static psS32 testArrayGetSet( void ); 54 55 55 56 … … 58 59 {testArray01, -2, "psArray", 0, false}, 59 60 {testArrayAdd, 788, "psArrayAdd", 0, false}, 61 {testArrayGetSet, -3, "psArrayGetSet", 0, false}, 60 62 {NULL} 61 63 }; … … 440 442 return 0; // the value that indicates success is part of the testDescription 441 443 } 444 445 psS32 testArrayGetSet( void ) 446 { 447 psArray *test; 448 int *p1 = psAlloc(sizeof(int)); 449 int *p2 = psAlloc(sizeof(int)); 450 int *p3 = psAlloc(sizeof(int)); 451 test = psArrayAlloc(5); 452 test->n = 0; 453 *p1 = 10; 454 *p2 = 4; 455 *p3 = 666; 456 457 if ( !psArraySet(test, 0, p1) ) 458 fprintf(stderr, "ArraySet failed to set S32 at position 0\n"); 459 if ( psArraySet(test, 10, p1) ) 460 fprintf(stderr, "ArraySet Improperly set S32 at out of range position\n"); 461 if ( !psArraySet(test, 1, p2) ) 462 fprintf(stderr, "ArraySet Failed to set S32 at position 1\n"); 463 if ( psArrayGet(test, 0) != p1 ) 464 fprintf(stderr, "ArrayGet Failed to return the correct S32 from position 0\n"); 465 if ( psArrayGet(test, -1) != p2) 466 fprintf(stderr, "ArrayGet Failed to return the correct S32 from tail using -1\n"); 467 468 if ( psArraySet(test, -6, p3) ) 469 fprintf(stderr, "ArraySet failed to fail using an out of range negative number\n"); 470 471 psFree(test); 472 psFree(p3); 473 474 return 0; 475 } -
trunk/psLib/test/types/verified/tst_psArray.stderr
r4547 r5114 219 219 ---> TESTPOINT PASSED (psArray{psArrayAdd} | tst_psArray.c) 220 220 221 /***************************** TESTPOINT ******************************************\ 222 * TestFile: tst_psArray.c * 223 * TestPoint: psArray{psArrayGetSet} * 224 * TestType: Positive * 225 \**********************************************************************************/ 226 227 <DATE><TIME>|<HOST>|E|psArraySet (FILE:LINENO) 228 Specified position, 10, is greater than n+1 of the array, 1. 229 <DATE><TIME>|<HOST>|E|psArraySet (FILE:LINENO) 230 Invalid position. Negative number too large 231 232 ---> TESTPOINT PASSED (psArray{psArrayGetSet} | tst_psArray.c) 233 -
trunk/psLib/test/types/verified/tst_psPixels.stderr
r5101 r5114 79 79 \**********************************************************************************/ 80 80 81 <DATE><TIME>|<HOST>|E|psPixelsSet (FILE:LINENO) 82 Invalid position. Number too large 81 83 82 84 ---> TESTPOINT PASSED (psPixels{psPixelsGet/Set} | tst_psPixels.c)
Note:
See TracChangeset
for help on using the changeset viewer.
