- Timestamp:
- May 26, 2009, 1:59:32 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/pxtools.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/ippTools/src
- Property svn:ignore
-
old new 33 33 pstamptool 34 34 disttool 35 receivetool
-
- Property svn:ignore
-
branches/cnb_branches/cnb_branch_20090301/ippTools/src/pxtools.c
r23352 r24244 29 29 { 30 30 PS_ASSERT_PTR_NON_NULL(state, false); 31 31 32 32 if (!strcmp(state, "new")) return true; 33 33 if (!strcmp(state, "reg")) return true; … … 50 50 // 'scrubbed' is a virtual state equivalent to cleaned, but allows files to be removed 51 51 // even if the config files is missing 52 53 54 // change the value for tableName.columName from 'full' to 'cleaned' if necessary 55 bool pxSetStateCleaned(const psString tableName, const psString columnName, psArray *rows) 56 { 57 for (long i = 0; i < psArrayLength(rows); i++) { 58 psMetadata *row = rows->data[i]; 59 psString state = psMetadataLookupStr(NULL, row, columnName); 60 if (!state) { 61 psError(PS_ERR_PROGRAMMING, false, "%s not found in row %ld of table %s", 62 columnName, i, tableName); 63 return false; 64 } 65 if (!strcmp("full", state)) { 66 // change full to cleaned 67 psMetadataAddStr(row, PS_LIST_TAIL, columnName, PS_META_REPLACE, "", "cleaned"); 68 } else if (strcmp("cleaned", state)) { 69 // if state isn't cleaned or full we can't set it to cleaned 70 psError(PS_ERR_PROGRAMMING, true, "%s with state %s may not be exported cleaned", 71 tableName, state); 72 return false; 73 } 74 } 75 return true; 76 } 77 78 // XXX verify data type? 79 bool pxAddLabelSearchArgs (pxConfig *config, psMetadata *where, char *name, char *field, char *op) { 80 81 psMetadataItem *item = psMetadataLookup(config->args, name); 82 if (!item) { 83 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for %s", name); 84 return false; 85 } 86 psAssert (item->type == PS_DATA_METADATA_MULTI, "%s should be a multi container", name); 87 psAssert (item->data.list->n, "%s should at least have a place-holder", name); 88 psMetadataItem *entry = (psMetadataItem *)item->data.list->head->data; 89 psAssert (entry, "%s should at least have a place-holder", name); 90 if (entry->data.str) { 91 psListIterator *iter = psListIteratorAlloc (item->data.list, PS_LIST_HEAD, true); 92 psMetadataItem *item = NULL; 93 while ((item = psListGetAndIncrement(iter))) { 94 // need to change the name and comment 95 psFree (item->name); 96 item->name = psStringCopy (field); 97 psFree (item->comment); 98 item->comment = psStringCopy (op); 99 if (!psMetadataAddItem(where, item, PS_LIST_TAIL, PS_META_DUPLICATE_OK)) { 100 psError(PS_ERR_UNKNOWN, false, "failed to add item %s", field); 101 psFree(where); 102 return false; 103 } 104 } 105 psFree (iter); 106 } 107 return true; 108 }
Note:
See TracChangeset
for help on using the changeset viewer.
