Changeset 36718 for trunk/psphot/src/psphotFullForceSummary.c
- Timestamp:
- May 1, 2014, 4:36:26 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotFullForceSummary.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotFullForceSummary.c
r36666 r36718 187 187 188 188 // Convert to an array indexed by ID 189 psArray *sortedTable = psArrayAlloc(4*inTable->n); 189 #define MAX_MODEL_TYPE 10 190 psArray *sortedTables = psArrayAlloc(MAX_MODEL_TYPE+1); 190 191 for (int i=0; i<inTable->n; i++) { 191 192 psMetadata *row = inTable->data[i]; 192 193 psS32 ID = psMetadataLookupS32(&status, row, "ID"); 194 psS32 modelType = psMetadataLookupS32(&status, row, "MODEL_TYPE"); 195 // XXX: need to use the lookup table functions to be ready for changes in the model type numbers 196 if (modelType+1 >= MAX_MODEL_TYPE) { 197 psError(PSPHOT_ERR_CONFIG, false, "found modelType %d max allowed is %d", modelType, MAX_MODEL_TYPE); 198 return false; 199 } 200 psArray *sortedTable = sortedTables->data[modelType+1]; 201 if (!sortedTable) { 202 sortedTable = psArrayAlloc(4*inTable->n); 203 sortedTables->data[modelType+1] = sortedTable; 204 // dont' free sortedTable the array of tables gets our reference 205 } 193 206 if (ID >= sortedTable->n) { 194 207 sortedTable = psArrayRealloc(sortedTable, 2*ID); 195 208 // Why doesn't psArrayRealloc do this????? 196 sortedTable->n = sortedTable->nalloc;209 sortedTable->n = sortedTable->nalloc; 197 210 } 198 211 if (sortedTable->data[ID]) { … … 202 215 sortedTable->data[ID] = psMemIncrRefCounter(row); 203 216 } 204 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "CFF_TABLE ", PS_META_REPLACE, "cff table", sortedTable);217 psMetadataAddArray(config->arguments, PS_LIST_TAIL, "CFF_TABLES", PS_META_REPLACE, "cff tables", sortedTables); 205 218 psFree(inTable); 206 psFree(sortedTable );219 psFree(sortedTables); 207 220 208 221 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
