diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-23 02:09:34 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-23 02:09:34 +0000 |
commit | 4e85db11ec9e1c573e8c25de1c14c79d2b3a5889 (patch) | |
tree | a3b0f87fbdea49bd70e00697974ec180205bb0ed /apps | |
parent | 11e178dde19727f7daa027a80494c07cf44f54ea (diff) | |
download | ATCD-4e85db11ec9e1c573e8c25de1c14c79d2b3a5889.tar.gz |
ChangeLogTag: Mon May 22 21:07:57 2000 David L. Levine <levine@cs.wustl.edu>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/drwho/BS_Server.cpp | 36 | ||||
-rw-r--r-- | apps/drwho/ChangeLog | 10 |
2 files changed, 26 insertions, 20 deletions
diff --git a/apps/drwho/BS_Server.cpp b/apps/drwho/BS_Server.cpp index 7c0dfdb7d51..90f37cbc67b 100644 --- a/apps/drwho/BS_Server.cpp +++ b/apps/drwho/BS_Server.cpp @@ -19,7 +19,7 @@ BS_Server::BS_Server (const char *packet) Protocol_Record[this->count_]); ACE_NEW (this->sorted_record_, Protocol_Record *[this->count_]); - + for (int i = 0; i < this->count_; i++) { Protocol_Record *rec_ptr = &this->protocol_record_[i]; @@ -30,7 +30,7 @@ BS_Server::BS_Server (const char *packet) // Skip forward to the start of the next login name. while (*buf_ptr++ != '\0') - continue; + continue; } } @@ -39,7 +39,7 @@ BS_Server::BS_Server (const char *packet) // KEY_NAME happens to be one of our friends. Binary search is used // because the Protocol_Manager keeps a sorted representation of the // friend names. -// +// // Note that this binary search is tuned for unsuccessful searches, // since most of the time we the KEY_NAME is *not* a friend (unless // you've got *lots* of friends)! @@ -60,7 +60,7 @@ BS_Server::insert (const char *key_name, int max_len) if (ACE_OS::strncmp (last_lookup, key_name, max_len) == 0) { if (result == 0) - return 0; + return 0; } else { @@ -69,32 +69,32 @@ BS_Server::insert (const char *key_name, int max_len) int hi = this->count_ - 1; int lo = 0; - int cmp; + int cmp = 0; while (lo < hi) - { - mid = (hi + lo + 1) / 2; + { + mid = (hi + lo + 1) / 2; cmp = ACE_OS::strncmp (key_name, buffer[mid]->get_login (), max_len); - if (cmp < 0) - hi = mid - 1; - else - lo = mid; - } + if (cmp < 0) + hi = mid - 1; + else + lo = mid; + } // This line is very subtle... ;-) - if (!(cmp == 0 + if (!(cmp == 0 || ACE_OS::strncmp (key_name, buffer[--mid]->get_login (), max_len) == 0)) - { - result = 0; - return 0; - } + { + result = 0; + return 0; + } } // If we get here we've located a friend. - + result = 1; return buffer[mid]; } diff --git a/apps/drwho/ChangeLog b/apps/drwho/ChangeLog index 33d45ac63c0..6ea397e2843 100644 --- a/apps/drwho/ChangeLog +++ b/apps/drwho/ChangeLog @@ -1,7 +1,13 @@ +Mon May 22 21:07:57 2000 David L. Levine <levine@cs.wustl.edu> + + * BS_Server.cpp (insert): initialize local cmp to 0, to + prevent warning from g++ 2.91.66 (on Linux) about possible + use without initialization. + Fri May 5 10:40:46 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> - * Fixed a coule of errors due to mismatches between int and size_t. - Thanks to David Levine and Darrell Brunsch for reporting these. + * Fixed a coule of errors due to mismatches between int and size_t. + Thanks to David Levine and Darrell Brunsch for reporting these. Thu Apr 20 09:20:28 2000 Carlos O'Ryan <coryan@uci.edu> |