diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2003-06-17 16:40:53 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2003-06-17 16:40:53 +0000 |
commit | cd3c2f11b02ecad3f67668c6a9ff3a6f771c912c (patch) | |
tree | eea07119c2eda05f2c86627b001306873d988630 /apps/gperf | |
parent | 448c5843ffb625ebd68f63d64cc3c41c8bc74ab8 (diff) | |
download | ATCD-cd3c2f11b02ecad3f67668c6a9ff3a6f771c912c.tar.gz |
ChangeLogTag:Tue Jun 17 15:49:32 UTC 2003 Don Hinton <dhinton@dresystems.com>
Diffstat (limited to 'apps/gperf')
-rw-r--r-- | apps/gperf/ChangeLog | 8 | ||||
-rw-r--r-- | apps/gperf/src/Gen_Perf.cpp | 12 | ||||
-rw-r--r-- | apps/gperf/src/Key_List.cpp | 6 | ||||
-rw-r--r-- | apps/gperf/src/List_Node.cpp | 8 |
4 files changed, 23 insertions, 11 deletions
diff --git a/apps/gperf/ChangeLog b/apps/gperf/ChangeLog index 3192e9e3cb0..1aec5ddb8e6 100644 --- a/apps/gperf/ChangeLog +++ b/apps/gperf/ChangeLog @@ -1,3 +1,11 @@ +Tue Jun 17 11:38:36 2003 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * src/Gen_Perf.cpp (run): + * src/Key_List.cpp (already_determined): + * src/List_Node.cpp (List_Node): Added casts to prevent GCC 3.3 + from complaining about stupid stuff... Thanks to Bala for + reporting this. + Sun Jul 28 17:04:54 2002 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> * src/gperf.cpp (main): Only generate the timestamps if the diff --git a/apps/gperf/src/Gen_Perf.cpp b/apps/gperf/src/Gen_Perf.cpp index a946421a80d..d3622b8e2b3 100644 --- a/apps/gperf/src/Gen_Perf.cpp +++ b/apps/gperf/src/Gen_Perf.cpp @@ -91,7 +91,7 @@ Gen_Perf::sort_set (char *union_set, int len) { for (int i = 0, j = len - 1; i < j; i++) { - char curr, tmp; + short curr, tmp; for (curr = i + 1, tmp = union_set[curr]; curr > 0 @@ -111,7 +111,7 @@ Gen_Perf::hash (List_Node *key_node) int sum = option[NOLENGTH] ? 0 : key_node->length; for (char *ptr = key_node->keysig; *ptr; ptr++) - sum += Vectors::asso_values[*ptr]; + sum += Vectors::asso_values[(int) *ptr]; key_node->hash_value = sum; return sum; @@ -127,7 +127,7 @@ Gen_Perf::hash (List_Node *key_node) inline int Gen_Perf::affects_prev (char c, List_Node *curr) { - int original_char = Vectors::asso_values[c]; + int original_char = Vectors::asso_values[(int) c]; int total_iterations; if (!option[FAST]) @@ -146,7 +146,7 @@ Gen_Perf::affects_prev (char c, List_Node *curr) { int collisions = 0; - Vectors::asso_values[c] = Vectors::asso_values[c] + + Vectors::asso_values[c] = Vectors::asso_values[(int) c] + (option.jump () ? option.jump () : ACE_OS::rand ()) & option.asso_max () - 1; // Iteration Number array is a win, O(1) intialization time! @@ -171,7 +171,7 @@ Gen_Perf::affects_prev (char c, List_Node *curr) } // Restore original values, no more tries. - Vectors::asso_values[c] = original_char; + Vectors::asso_values[(int) c] = original_char; // If we're this far it's time to try the next character.... return 1; } @@ -205,7 +205,7 @@ Gen_Perf::change (List_Node *prior, List_Node *curr) " by changing asso_value['%c'] (char #%d) to %d\n", *temp, temp - union_set + 1, - Vectors::asso_values[*temp])); + Vectors::asso_values[(int) *temp])); // Good, doesn't affect previous hash values, we'll take it. return 0; } diff --git a/apps/gperf/src/Key_List.cpp b/apps/gperf/src/Key_List.cpp index 196e7be09ff..36283232498 100644 --- a/apps/gperf/src/Key_List.cpp +++ b/apps/gperf/src/Key_List.cpp @@ -409,7 +409,7 @@ Key_List::occurrence (List_Node *ptr) int value = 0; for (char *temp = ptr->keysig; *temp; temp++) - value += Vectors::occurrences[*temp]; + value += Vectors::occurrences[(int) *temp]; return value; } @@ -421,7 +421,7 @@ inline void Key_List::determined (List_Node *ptr) { for (char *temp = ptr->keysig; *temp; temp++) - Key_List::determined_[*temp] = 1; + Key_List::determined_[(int) *temp] = 1; } // Returns TRUE if PTR's key set is already completely determined. @@ -432,7 +432,7 @@ Key_List::already_determined (List_Node *ptr) int is_determined = 1; for (char *temp = ptr->keysig; is_determined && *temp; temp++) - is_determined = determined_[*temp]; + is_determined = determined_[(int) *temp]; return is_determined; } diff --git a/apps/gperf/src/List_Node.cpp b/apps/gperf/src/List_Node.cpp index 0f5fb5052ff..9564c1829f7 100644 --- a/apps/gperf/src/List_Node.cpp +++ b/apps/gperf/src/List_Node.cpp @@ -84,7 +84,11 @@ List_Node::List_Node (char *k, int len) if (option[ALLCHARS]) // Use all the character position in the KEY. for (; *k; k++, ptr++) - ++Vectors::occurrences[*ptr = *k]; + { + *ptr = *k; + int i = (int) *ptr; + ++Vectors::occurrences[i]; + } else { // Only use those character positions specified by the user. @@ -102,7 +106,7 @@ List_Node::List_Node (char *k, int len) *ptr = key[i - 1]; else // Out of range of KEY length, so we'll just skip it. continue; - ++Vectors::occurrences[*ptr++]; + ++Vectors::occurrences[(int) *ptr++]; } // Didn't get any hits and user doesn't want to consider the |