Changeset 7619
- Timestamp:
- Jun 21, 2006, 12:46:02 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/mathtypes/psImage.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psImage.c
r7579 r7619 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.10 7$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-06- 15 02:29:12 $11 * @version $Revision: 1.108 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-06-21 22:46:02 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include "psMemory.h" 24 24 #include "psError.h" 25 #include "psAbort.h" 25 26 #include "psImage.h" 26 27 #include "psString.h" … … 58 59 psElemType type) 59 60 { 60 psS32 area = 0; 61 psS32 elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes 62 psS32 rowSize = numCols * elementSize; // row size in bytes. 63 64 area = numCols * numRows; 65 66 if (area < 1) { 61 int elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes 62 int rowSize = numCols * elementSize; // row size in bytes. 63 64 if (numRows < 1) { 67 65 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 68 66 PS_ERRORTEXT_psImage_AREA_NEGATIVE, … … 70 68 return NULL; 71 69 } 70 if (numCols < 1) { 71 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 72 PS_ERRORTEXT_psImage_AREA_NEGATIVE, 73 numRows, numCols); 74 return NULL; 75 } 76 77 long numBytes = numRows * numCols * elementSize; 72 78 73 79 psImage* image = (psImage* ) psAlloc(sizeof(psImage)); … … 77 83 image->data.V = psAlloc(sizeof(psPtr ) * numRows); 78 84 79 image->p_rawDataBuffer = psAlloc( area * elementSize);85 image->p_rawDataBuffer = psAlloc(numBytes); 80 86 81 87 // set the row pointers. … … 249 255 NATIVETYPE temp = va_arg (argp, NATIVETYPE); \ 250 256 if ( temp < PS_MIN_##TTT || temp > PS_MAX_##TTT ) { \ 251 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: Value out of Range.\n"); \ 257 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: Value %d out of Range.\n", temp); \ 258 psAbort("pslib", "trapping bad value"); \ 252 259 return false; \ 253 260 } \
Note:
See TracChangeset
for help on using the changeset viewer.
