Changeset 43033
- Timestamp:
- May 20, 2026, 11:30:22 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/ippTools/src/bgtool.c
r35672 r43033 67 67 68 68 // Tables to import/export 69 /* ChatGPT suggested fix */ 70 typedef struct { 71 const char *name; 72 void *(*parse)(psMetadata *); 73 bool (*insert)(psDB *, void *); 74 } tableData; 75 static const tableData chipTables[] = { 76 { "chipBackgroundRun", 77 (void *(*)(psMetadata *)) chipBackgroundRunObjectFromMetadata, 78 (bool (*)(psDB *, void *)) chipBackgroundRunInsertObject }, 79 { "chipBackgroundImfile", 80 (void *(*)(psMetadata *)) chipBackgroundImfileObjectFromMetadata, 81 (bool (*)(psDB *, void *)) chipBackgroundImfileInsertObject }, 82 { NULL, NULL, NULL } 83 }; 84 static const tableData warpTables[] = { 85 { "warpBackgroundRun", 86 (void *(*)(psMetadata *)) warpBackgroundRunObjectFromMetadata, 87 (bool (*)(psDB *, void *)) warpBackgroundRunInsertObject }, 88 { "warpBackgroundSkyfile", 89 (void *(*)(psMetadata *)) warpBackgroundSkyfileObjectFromMetadata, 90 (bool (*)(psDB *, void *)) warpBackgroundSkyfileInsertObject }, 91 { NULL, NULL, NULL } 92 }; 93 94 95 /* old version 69 96 typedef struct { 70 97 const char *name; // Table name … … 82 109 { NULL, NULL, NULL } 83 110 }; 84 111 */ 85 112 86 113 # define MODECASE(caseName, func) \ … … 255 282 psAssert(item, "%s not in input", name); 256 283 psAssert(item->type == PS_DATA_METADATA_MULTI, "%s not MULTI type", name); 284 257 285 psAssert(psListLength(item->data.list) == 1, "%s has multiple entries", name); 286 258 287 psMetadataItem *entry = psListGet(item->data.list, PS_LIST_HEAD); // Entry of interest 259 void *data = tables[i].parse(entry); // Parsed entry 288 assert (entry); 289 assert (entry->type == PS_DATA_METADATA); 290 291 void *data = tables[i].parse(entry->data.md); // Parsed entry 260 292 if (!data) { 261 293 psError(PXTOOLS_ERR_CONFIG, false, "Unable to parse entry %s", name); … … 263 295 return false; 264 296 } 265 if (!tables[ 0].insert(config->dbh, data)) {297 if (!tables[i].insert(config->dbh, data)) { 266 298 psError(psErrorCodeLast(), false, "Unable to insert entry %s", name); 267 299 psFree(input);
Note:
See TracChangeset
for help on using the changeset viewer.
