Changeset 19812 for trunk/ippTools/src/dettool.c
- Timestamp:
- Oct 2, 2008, 7:46:21 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r19771 r19812 245 245 PXOPT_LOOKUP_S64(ref_det_id, config->args, "-ref_det_id", true, false); 246 246 PXOPT_LOOKUP_S32(ref_iter, config->args, "-ref_iter", true, false); 247 if (!str ncmp(mode, "verify", 7) && ((ref_det_id == 0) || (ref_iter == -1))) {247 if (!strcmp(mode, "verify") && ((ref_det_id == 0) || (ref_iter == -1))) { 248 248 psError(PS_ERR_UNKNOWN, false, "verify mode requires both -ref_det_id and -ref_iter"); 249 249 return false; 250 250 } 251 if (str ncmp(mode, "verify", 7) && ((ref_det_id != 0) || (ref_iter != -1))) {251 if (strcmp(mode, "verify") && ((ref_det_id != 0) || (ref_iter != -1))) { 252 252 psError(PS_ERR_UNKNOWN, false, "master mode cannot have -ref_det_id or -ref_iter set"); 253 253 return false; … … 494 494 PXOPT_LOOKUP_S64(ref_det_id, config->args, "-ref_det_id", false, false); 495 495 PXOPT_LOOKUP_S32(ref_iter, config->args, "-ref_iter", false, false); 496 if (!str ncmp(mode, "verify", 7) && ((ref_det_id == 0) || (ref_iter == -1))) {496 if (!strcmp(mode, "verify") && ((ref_det_id == 0) || (ref_iter == -1))) { 497 497 psError(PS_ERR_UNKNOWN, false, "verify mode requires both -ref_det_id and -ref_iter"); 498 498 return false; 499 499 } 500 if (str ncmp(mode, "verify", 7) && ((ref_det_id != 0) || (ref_iter != -1))) {500 if (strcmp(mode, "verify") && ((ref_det_id != 0) || (ref_iter != -1))) { 501 501 psError(PS_ERR_UNKNOWN, false, "master mode cannot have -ref_det_id or -ref_iter set"); 502 502 return false; … … 734 734 PXOPT_LOOKUP_S64(ref_det_id, config->args, "-ref_det_id", false, false); 735 735 PXOPT_LOOKUP_S32(ref_iter, config->args, "-ref_iter", false, false); 736 if (!str ncmp(mode, "verify", 7) && ((ref_det_id == 0) || (ref_iter == -1))) {736 if (!strcmp(mode, "verify") && ((ref_det_id == 0) || (ref_iter == -1))) { 737 737 psError(PS_ERR_UNKNOWN, false, "verify mode requires both -ref_det_id and -ref_iter"); 738 738 return false; 739 739 } 740 if (str ncmp(mode, "verify", 7) && ((ref_det_id != 0) || (ref_iter != -1))) {740 if (strcmp(mode, "verify") && ((ref_det_id != 0) || (ref_iter != -1))) { 741 741 psError(PS_ERR_UNKNOWN, false, "master mode cannot have -ref_det_id or -ref_iter set"); 742 742 return false; … … 920 920 921 921 // additional restriction on the detInputExp's to be selected 922 PXOPT_COPY_TIME(config->args, input_filter, "-set_input_begin", "dateobs", ">="); 923 PXOPT_COPY_TIME(config->args, input_filter, "-set_input_end", "dateobs", "<"); 924 922 PXOPT_LOOKUP_TIME(input_begin, config->args, "-set_input_begin", false, false); 923 if (input_begin) { 924 PXOPT_COPY_TIME(config->args, input_filter, "-set_input_begin", "dateobs", ">="); 925 } 926 PXOPT_LOOKUP_TIME(input_end, config->args, "-set_input_end", false, false); 927 if (input_end) { 928 PXOPT_COPY_TIME(config->args, input_filter, "-set_input_end", "dateobs", "<"); 929 } 925 930 PXOPT_LOOKUP_BOOL(only_accepted, config->args, "-only_accepted", false); // optional 926 931 … … 962 967 963 968 if (only_accepted) { 964 psString whereClause = NULL; 965 psStringAppend(&whereClause, " AND accept = 1"); 966 psStringAppend(&query, " AND %s", whereClause); 967 psFree(whereClause); 969 psStringAppend(&query, " AND accept = 1"); 968 970 } 969 971 … … 1770 1772 PS_ASSERT_PTR_NON_NULL(state, false); 1771 1773 1772 // check that state is a valid string value 1773 if (!( 1774 (strncmp(state, "run", 4) == 0) 1775 || (strncmp(state, "stop", 5) == 0) 1776 || (strncmp(state, "drop", 5) == 0) 1777 || (strncmp(state, "register", 4) == 0) 1778 ) 1779 ) { 1780 psError(PS_ERR_UNKNOWN, false, 1781 "invalid detRun state: %s", state); 1782 return false; 1783 } 1774 if (!isValidDetRunState (state)) return false; 1784 1775 1785 1776 char *query = "UPDATE detRun SET state = '%s' WHERE det_id = %" PRId64; 1786 1777 if (!p_psDBRunQuery(config->dbh, query, state, det_id)) { 1787 psError(PS_ERR_UNKNOWN, false, 1788 "failed to change state for det_id %" PRId64, det_id); 1789 return false; 1790 } 1791 1792 return true; 1778 psError(PS_ERR_UNKNOWN, false, "failed to change state for det_id %" PRId64, det_id); 1779 return false; 1780 } 1781 1782 return true; 1783 } 1784 1785 // the detRun states are a superset of the data states below 1786 bool isValidDetRunState (const char *state) { 1787 1788 // check that state is a valid string value 1789 if (!strcmp(state, "run")) return true; 1790 if (!strcmp(state, "stop")) return true; 1791 if (!strcmp(state, "drop")) return true; 1792 if (!strcmp(state, "wait")) return true; 1793 if (!strcmp(state, "test")) return true; 1794 if (!strcmp(state, "ignore")) return true; 1795 if (!strcmp(state, "register")) return true; 1796 1797 psError(PS_ERR_UNKNOWN, true, "invalid detRun state: %s", state); 1798 return false; 1793 1799 } 1794 1800 … … 1796 1802 1797 1803 // check that state is a valid string value 1798 if (!str ncmp(data_state, "run", 4)) return true;1799 if (!str ncmp(data_state, "stop", 5)) return true;1800 if (!str ncmp(data_state, "drop", 5)) return true;1801 if (!str ncmp(data_state, "register", 4)) return true;1804 if (!strcmp(data_state, "run")) return true; 1805 if (!strcmp(data_state, "stop")) return true; 1806 if (!strcmp(data_state, "drop")) return true; 1807 if (!strcmp(data_state, "register")) return true; 1802 1808 1803 1809 psError(PS_ERR_UNKNOWN, true, "invalid data state: %s", data_state); … … 1811 1817 1812 1818 // check that state is a valid string value 1813 if (!str ncmp(mode, "master", 7)) return true;1814 if (!str ncmp(mode, "verify", 7)) return true;1819 if (!strcmp(mode, "master")) return true; 1820 if (!strcmp(mode, "verify")) return true; 1815 1821 1816 1822 psError(PS_ERR_UNKNOWN, false, "invalid detRun mode: %s", mode);
Note:
See TracChangeset
for help on using the changeset viewer.
