diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-08-05 18:52:53 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-08-05 18:52:53 +0000 |
commit | 19bf3f820e78f0b5faf978bdc4c09b46ce2e6f8b (patch) | |
tree | 10f16522edb5de271a413ed9d2c673d20c91c99b | |
parent | dd04d852afa0f63b82968fa555b92f6abf1a2e16 (diff) | |
download | ATCD-19bf3f820e78f0b5faf978bdc4c09b46ce2e6f8b.tar.gz |
ChangeLogTag: Tue Aug 5 18:51:02 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | ACE/ACEXML/common/HttpCharStream.cpp | 5 | ||||
-rw-r--r-- | ACE/ACEXML/common/ZipCharStream.cpp | 4 | ||||
-rw-r--r-- | ACE/ACEXML/parser/parser/Parser.inl | 16 | ||||
-rw-r--r-- | ACE/ASNMP/asnmp/address.cpp | 43 | ||||
-rw-r--r-- | ACE/ASNMP/asnmp/asn1.cpp | 15 | ||||
-rw-r--r-- | ACE/ChangeLog | 20 | ||||
-rw-r--r-- | ACE/Kokyu/Dispatcher_Task.cpp | 17 | ||||
-rw-r--r-- | ACE/ace/MMAP_Memory_Pool.cpp | 14 | ||||
-rw-r--r-- | ACE/ace/Service_Manager.cpp | 123 | ||||
-rw-r--r-- | ACE/ace/Stream.cpp | 4 | ||||
-rw-r--r-- | ACE/apps/gperf/src/Gen_Perf.cpp | 83 | ||||
-rw-r--r-- | ACE/apps/gperf/src/Hash_Table.cpp | 12 | ||||
-rw-r--r-- | ACE/apps/gperf/src/Iterator.cpp | 17 | ||||
-rw-r--r-- | ACE/apps/gperf/src/Key_List.cpp | 67 | ||||
-rw-r--r-- | ACE/apps/gperf/src/List_Node.cpp | 16 |
15 files changed, 306 insertions, 150 deletions
diff --git a/ACE/ACEXML/common/HttpCharStream.cpp b/ACE/ACEXML/common/HttpCharStream.cpp index ab0d9a0eed8..f94a2bed1a1 100644 --- a/ACE/ACEXML/common/HttpCharStream.cpp +++ b/ACE/ACEXML/common/HttpCharStream.cpp @@ -114,13 +114,16 @@ int ACEXML_HttpCharStream::get_url (size_t& len) { if (this->stream_ == 0) - return -1; + { + return -1; + } int header_state = HDST_LINE1_PROTOCOL; int status = 0; size_t b = 0; char const * buf = 0; size_t buflen = BUFSIZ; + for (;;) { buf = this->stream_->recv (buflen); diff --git a/ACE/ACEXML/common/ZipCharStream.cpp b/ACE/ACEXML/common/ZipCharStream.cpp index 4de9dc33abd..7775dc6a39e 100644 --- a/ACE/ACEXML/common/ZipCharStream.cpp +++ b/ACE/ACEXML/common/ZipCharStream.cpp @@ -57,7 +57,8 @@ ACEXML_ZipCharStream::determine_encoding (void) // this->encoding_)); } // Move over the byte-order-mark if present. - char ch; + int ch; + for (int j = 0; j < 3; ++j) { if ((ch = this->peekchar_i()) < 0) @@ -68,6 +69,7 @@ ACEXML_ZipCharStream::determine_encoding (void) else break; } + return 0; } diff --git a/ACE/ACEXML/parser/parser/Parser.inl b/ACE/ACEXML/parser/parser/Parser.inl index 1706d0a88e1..9af33326cf0 100644 --- a/ACE/ACEXML/parser/parser/Parser.inl +++ b/ACE/ACEXML/parser/parser/Parser.inl @@ -59,17 +59,19 @@ ACEXML_Parser::setErrorHandler (ACEXML_ErrorHandler *handler) ACEXML_INLINE int ACEXML_Parser::isChar (ACEXML_UCS4 c) const { - return (c == 0x9 || c == 0xA || c == 0xD || - c >= 0x20 && c <= 0xD7FF || - c >= 0xE000 && c <= 0xFFFD || - c >= 0x10000 && c <= 0x10FFFF); + return (c == 0x9 + || c == 0xA + || c == 0xD + || (c >= 0x20 && c <= 0xD7FF) + || (c >= 0xE000 && c <= 0xFFFD) + || (c >= 0x10000 && c <= 0x10FFFF)); } ACEXML_INLINE int ACEXML_Parser::isCharRef (const ACEXML_Char c) const - { - return ((c >= 'a' && c <= 'f') || - (c >= 'A' && c <= 'F')); +{ + return ((c >= 'a' && c <= 'f') + || (c >= 'A' && c <= 'F')); } ACEXML_INLINE int diff --git a/ACE/ASNMP/asnmp/address.cpp b/ACE/ASNMP/asnmp/address.cpp index 32f43b4ad4e..edc46f00e3c 100644 --- a/ACE/ASNMP/asnmp/address.cpp +++ b/ACE/ASNMP/asnmp/address.cpp @@ -662,23 +662,34 @@ void IpAddress::mask( const IpAddress& ipaddr) //======================================================================= -Address_Iter::Address_Iter(const char *hostname): valid_(0), count_(0), - entry_(0) -{ - ACE_OS::memset(&buffer_, 0, sizeof(ACE_HOSTENT_DATA)); - ACE_OS::memset(&lookupResult_, 0, sizeof(struct hostent)); - if (ACE_OS::inet_addr(hostname) == (unsigned long) -1) - valid_ = query_dns(hostname); - else { - ACE_ASSERT(0); // don't support dot-quad lookup yet - } +Address_Iter::Address_Iter (const char *hostname) + : valid_(0), + count_(0), + entry_(0) +{ + ACE_OS::memset (&buffer_, 0, sizeof (ACE_HOSTENT_DATA)); + ACE_OS::memset (&lookupResult_, 0, sizeof (struct hostent)); + + if (ACE_OS::inet_addr (hostname) == (unsigned long) -1) + { + valid_ = query_dns (hostname); + } + else + { + ACE_ASSERT (0); // don't support dot-quad lookup yet + } + + // count number of hostnames + int n; + char **pc; + + for (n = 0, pc = lookupResult_.h_addr_list; *pc != 0; ++n, ++pc) + { + // Do nothing. + } - // count number of hostnames - int n; - char **pc; - for (n = 0, pc = lookupResult_.h_addr_list; *pc != 0; ++n, ++pc); - count_ = n; // plus first one - entry_ = lookupResult_.h_addr_list; + count_ = n; // plus first one + entry_ = lookupResult_.h_addr_list; } int Address_Iter::valid() const diff --git a/ACE/ASNMP/asnmp/asn1.cpp b/ACE/ASNMP/asnmp/asn1.cpp index da973e52bc2..88a19b67b63 100644 --- a/ACE/ASNMP/asnmp/asn1.cpp +++ b/ACE/ASNMP/asnmp/asn1.cpp @@ -1020,13 +1020,18 @@ void cmu_snmp::add_var(struct snmp_pdu *pdu, struct variable_list *vars = 0; // if we don't have a vb list ,create one - if (pdu->variables == 0) { - ACE_NEW(pdu->variables, variable_list); - vars = pdu->variables; - } + if (pdu->variables == 0) + { + ACE_NEW(pdu->variables, variable_list); + vars = pdu->variables; + } else { // we have one, find the end - for(vars = pdu->variables; vars->next_variable; vars = vars->next_variable); + for (vars = pdu->variables; vars->next_variable; vars = vars->next_variable) + { + // Do nothing. + } + // create one ACE_NEW(vars->next_variable, variable_list); // bump ptr diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 6c7764cd311..2b3494c0118 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,23 @@ +Tue Aug 5 18:51:02 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu> + + * ace/MMAP_Memory_Pool.cpp: + * ace/Service_Manager.cpp: + * ace/Stream.cpp: + * Kokyu/Dispatcher_Task.cpp: + * apps/gperf/src/List_Node.cpp: + * apps/gperf/src/Key_List.cpp: + * apps/gperf/src/Gen_Perf.cpp: + * apps/gperf/src/Iterator.cpp: + * apps/gperf/src/Hash_Table.cpp: + * ACEXML/common/ZipCharStream.cpp: + * ACEXML/common/HttpCharStream.cpp: + * ACEXML/parser/parser/Parser.inl: + * ASNMP/asnmp/asn1.cpp: + * ASNMP/asnmp/address.cpp: + + Cosmetic changes to eliminate warnings on + Fedora Rawhide. + Tue Aug 5 18:37:11 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl> * rpmbuild/ace-tao-init-fedora.tar.bz2: diff --git a/ACE/Kokyu/Dispatcher_Task.cpp b/ACE/Kokyu/Dispatcher_Task.cpp index 8cbb9cd97ac..c6e1ef9e3ba 100644 --- a/ACE/Kokyu/Dispatcher_Task.cpp +++ b/ACE/Kokyu/Dispatcher_Task.cpp @@ -98,12 +98,19 @@ Dispatcher_Task::svc (void) while (!done) { ACE_Message_Block *mb; + if (this->getq (mb) == -1) - if (ACE_OS::last_error () == ESHUTDOWN) - return 0; - else - ACE_ERROR ((LM_ERROR, - "EC (%P|%t) getq error in Dispatching Queue\n")); + { + if (ACE_OS::last_error () == ESHUTDOWN) + { + return 0; + } + else + { + ACE_ERROR ((LM_ERROR, + "EC (%P|%t) getq error in Dispatching Queue\n")); + } + } //ACE_DEBUG ((LM_DEBUG, "(%t) : next command got from queue\n")); diff --git a/ACE/ace/MMAP_Memory_Pool.cpp b/ACE/ace/MMAP_Memory_Pool.cpp index 61c37b9c856..02e82dcf4cf 100644 --- a/ACE/ace/MMAP_Memory_Pool.cpp +++ b/ACE/ace/MMAP_Memory_Pool.cpp @@ -290,11 +290,11 @@ ACE_MMAP_Memory_Pool::map_file (size_t map_size) this->base_addr_, 0, this->sa_) == -1 - || this->base_addr_ != 0 + || (this->base_addr_ != 0 #ifdef ACE_HAS_WINCE - && this->mmap_.addr () == 0) // WinCE does not allow users to specify alloc addr. + && this->mmap_.addr () == 0)) // WinCE does not allow users to specify alloc addr. #else - && this->mmap_.addr () != this->base_addr_) + && this->mmap_.addr () != this->base_addr_)) #endif // ACE_HAS_WINCE { #if 0 @@ -311,8 +311,12 @@ ACE_MMAP_Memory_Pool::map_file (size_t map_size) { #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) this->base_addr_ = this->mmap_.addr (); - if(obase_addr && this->base_addr_ != obase_addr) - ACE_BASED_POINTER_REPOSITORY::instance ()->unbind (obase_addr); + + if (obase_addr && this->base_addr_ != obase_addr) + { + ACE_BASED_POINTER_REPOSITORY::instance ()->unbind (obase_addr); + } + ACE_BASED_POINTER_REPOSITORY::instance ()->bind (this->base_addr_, map_size); #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ diff --git a/ACE/ace/Service_Manager.cpp b/ACE/ace/Service_Manager.cpp index eb89108e7c6..5561ee6ad44 100644 --- a/ACE/ace/Service_Manager.cpp +++ b/ACE/ace/Service_Manager.cpp @@ -65,7 +65,10 @@ ACE_Service_Manager::open (const ACE_INET_Addr &sia) // Reuse the listening address, even if it's already in use! if (this->acceptor_.open (sia, 1) == -1) - return -1; + { + return -1; + } + return 0; } @@ -77,17 +80,25 @@ ACE_Service_Manager::info (ACE_TCHAR **strp, size_t length) const ACE_TCHAR buf[BUFSIZ]; if (this->acceptor_.get_local_addr (sa) == -1) - return -1; + { + return -1; + } ACE_OS::sprintf (buf, ACE_TEXT ("%d/%s %s"), sa.get_port_number (), ACE_TEXT ("tcp"), ACE_TEXT ("# lists all services in the daemon\n")); + if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) - return -1; + { + return -1; + } else - ACE_OS::strsncpy (*strp, buf, length); + { + ACE_OS::strsncpy (*strp, buf, length); + } + return static_cast<int> (ACE_OS::strlen (buf)); } @@ -119,15 +130,20 @@ ACE_Service_Manager::init (int argc, ACE_TCHAR *argv[]) if (this->get_handle () == ACE_INVALID_HANDLE && this->open (local_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("open")), -1); + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("open")), -1); + } else if (ACE_Reactor::instance ()->register_handler (this, ACE_Event_Handler::ACCEPT_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("registering service with ACE_Reactor\n")), - -1); + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("registering service with ACE_Reactor\n")), + -1); + } + return 0; } @@ -144,15 +160,18 @@ ACE_Service_Manager::fini (void) ACE_TRACE ("ACE_Service_Manager::fini"); int retv = 0; + if (this->get_handle () != ACE_INVALID_HANDLE) { - retv = ACE_Reactor::instance ()->remove_handler - (this, - ACE_Event_Handler::ACCEPT_MASK | - ACE_Event_Handler::DONT_CALL); + retv = + ACE_Reactor::instance ()->remove_handler ( + this, + ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); + this->handle_close (ACE_INVALID_HANDLE, ACE_Event_Handler::NULL_MASK); } + return retv; } @@ -197,19 +216,24 @@ ACE_Service_Manager::list_services (void) len += sr->type ()->info (&p, sizeof buf - len); if (this->debug_) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("len = %d, info = %s%s"), - len, - buf, - buf[len - 1] == '\n' ? ACE_TEXT ("") : ACE_TEXT ("\n"))); + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("len = %d, info = %s%s"), + len, + buf, + buf[len - 1] == '\n' ? ACE_TEXT ("") : ACE_TEXT ("\n"))); + } if (len > 0) { ssize_t n = this->client_stream_.send_n (buf, len); + if (n <= 0 && errno != EPIPE) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("send_n"))); + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("send_n"))); + } } } @@ -251,16 +275,22 @@ ACE_Service_Manager::process_request (ACE_TCHAR *request) for (p = request; (*p != '\0') && (*p != '\r') && (*p != '\n'); p++) - continue; + { + continue; + } *p = '\0'; if (ACE_OS::strcmp (request, ACE_TEXT ("help")) == 0) - // Return a list of the configured services. - this->list_services (); + { + // Return a list of the configured services. + this->list_services (); + } else if (ACE_OS::strcmp (request, ACE_TEXT ("reconfigure") )== 0) - // Trigger a reconfiguration by re-reading the local <svc.conf> file. - this->reconfigure_services (); + { + // Trigger a reconfiguration by re-reading the local <svc.conf> file. + this->reconfigure_services (); + } else { // Just process a single request passed in via the socket @@ -294,7 +324,9 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) 1, // restart reset_new_handle // reset new handler ) == -1) - return -1; + { + return -1; + } if (this->debug_) { @@ -302,8 +334,11 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) ACE_TEXT ("client_stream fd = %d\n"), this->client_stream_.get_handle ())); ACE_INET_Addr sa; + if (this->client_stream_.get_remote_addr (sa) == -1) - return -1; + { + return -1; + } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("accepted from host %C at port %d\n"), @@ -326,12 +361,16 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) // contains an incomplete string. int error; + do { result = client_stream_.recv (offset, remaining); error = errno; + if (result == 0 && error != EWOULDBLOCK) - remaining = 0; + { + remaining = 0; + } if (result >= 0) { @@ -348,18 +387,23 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) if (ACE_OS::strchr (request, '\r') != 0 || ACE_OS::strchr (request, '\n') != 0) - remaining = 0; + { + remaining = 0; + } } } - while (result == -1 && error == EWOULDBLOCK || remaining > 0); + while ((result == -1 && error == EWOULDBLOCK) || remaining > 0); switch (result) { case -1: if (this->debug_) - ACE_DEBUG ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("recv"))); + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("recv"))); + } + break; case 0: return 0; @@ -381,9 +425,12 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) } if (this->client_stream_.close () == -1 && this->debug_) - ACE_DEBUG ((LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("close"))); + { + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("close"))); + } + return 0; } diff --git a/ACE/ace/Stream.cpp b/ACE/ace/Stream.cpp index a83e6cbd942..3e3cc3906ee 100644 --- a/ACE/ace/Stream.cpp +++ b/ACE/ace/Stream.cpp @@ -361,8 +361,8 @@ ACE_Stream<ACE_SYNCH_USE>::open (void *a, } // Make sure *all* the allocation succeeded! - if (head == 0 && (h1 == 0 || h2 == 0) - || tail == 0 && (t1 == 0 || t2 == 0)) + if ((head == 0 && (h1 == 0 || h2 == 0)) + || (tail == 0 && (t1 == 0 || t2 == 0))) { delete h1; delete h2; diff --git a/ACE/apps/gperf/src/Gen_Perf.cpp b/ACE/apps/gperf/src/Gen_Perf.cpp index 548f19ab137..ed1a1bc3cba 100644 --- a/ACE/apps/gperf/src/Gen_Perf.cpp +++ b/ACE/apps/gperf/src/Gen_Perf.cpp @@ -146,12 +146,14 @@ Gen_Perf::affects_prev (char c, List_Node *curr) // Try all legal associated values. - for (int i = total_iterations - 1; i >= 0; i--) + for (int i = total_iterations - 1; i >= 0; --i) { int collisions = 0; - Vectors::asso_values[(int) c] = Vectors::asso_values[(int) c] + - (option.jump () ? option.jump () : ACE_OS::rand ()) & option.asso_max () - 1; + Vectors::asso_values[(int) 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! this->char_search.reset (); @@ -161,17 +163,23 @@ Gen_Perf::affects_prev (char c, List_Node *curr) for (List_Node *ptr = this->key_list.head; this->char_search.find (this->hash (ptr)) == 0 - || ++collisions < fewest_collisions; + || ++collisions < fewest_collisions; ptr = ptr->next) - if (ptr == curr) - { - fewest_collisions = collisions; - if (option[DEBUGGING]) - ACE_DEBUG ((LM_DEBUG, - "- resolved after %d iterations", - total_iterations - i)); - return 0; - } + { + if (ptr == curr) + { + fewest_collisions = collisions; + + if (option[DEBUGGING]) + { + ACE_DEBUG ((LM_DEBUG, + "- resolved after %d iterations", + total_iterations - i)); + } + + return 0; + } + } } // Restore original values, no more tries. @@ -254,8 +262,10 @@ Gen_Perf::open (void) { ACE_OS::srand ((u_int) ACE_OS::time (0)); - for (int i = 0; i < ACE_STANDARD_CHARACTER_SET_SIZE; i++) - Vectors::asso_values[i] = (ACE_OS::rand () & asso_value_max - 1); + for (int i = 0; i < ACE_STANDARD_CHARACTER_SET_SIZE; ++i) + { + Vectors::asso_values[i] = (ACE_OS::rand () & (asso_value_max - 1)); + } } else { @@ -263,11 +273,16 @@ Gen_Perf::open (void) // Initialize array if user requests non-zero default. if (asso_value) - for (int i = ACE_STANDARD_CHARACTER_SET_SIZE - 1; i >= 0; i--) - Vectors::asso_values[i] = asso_value & option.asso_max () - 1; + { + for (int i = ACE_STANDARD_CHARACTER_SET_SIZE - 1; i >= 0; --i) + { + Vectors::asso_values[i] = asso_value & (option.asso_max () - 1); + } + } } - this->max_hash_value = this->key_list.max_key_length () + this->max_hash_value = + this->key_list.max_key_length () + option.asso_max () * option.max_keysig_size (); @@ -372,21 +387,27 @@ Gen_Perf::compute_perfect_hash (void) for (curr = this->key_list.head; curr; curr = curr->next) - if (this->char_search.find (this->hash (curr)) != 0) - if (option[DUP]) - // Keep track of the number of "dynamic" links (i.e., keys - // that hash to the same value) so that we can use it later - // when generating the output. - this->key_list.total_duplicates++; - else + { + if (this->char_search.find (this->hash (curr)) != 0) { - // Yow, big problems. we're outta here! - ACE_ERROR ((LM_ERROR, - "\nInternal error, duplicate value %d:\n" - "try options -D or -r, or use new key positions.\n\n", - this->hash (curr))); - return -1; + if (option[DUP]) + { + // Keep track of the number of "dynamic" links (i.e., keys + // that hash to the same value) so that we can use it later + // when generating the output. + this->key_list.total_duplicates++; + } + else + { + // Yow, big problems. we're outta here! + ACE_ERROR ((LM_ERROR, + "\nInternal error, duplicate value %d:\n" + "try options -D or -r, or use new key positions.\n\n", + this->hash (curr))); + return -1; + } } + } return 0; } diff --git a/ACE/apps/gperf/src/Hash_Table.cpp b/ACE/apps/gperf/src/Hash_Table.cpp index 43c72552cee..26551a8e3a0 100644 --- a/ACE/apps/gperf/src/Hash_Table.cpp +++ b/ACE/apps/gperf/src/Hash_Table.cpp @@ -95,17 +95,21 @@ Hash_Table::find (List_Node *item, // of 2... size_t size = this->size_ - 1; size_t probe; - size_t increment = (hash_val ^ (ignore_length == 0 ? item->length : 0) | 1) & size; + size_t increment = ((hash_val ^ (ignore_length == 0 ? item->length : 0)) | 1) & size; for (probe = hash_val & size; this->table_[probe] && (ACE_OS::strcmp (this->table_[probe]->keysig, item->keysig) != 0 || (ignore_length == 0 && this->table_[probe]->length != item->length)); - probe = probe + increment & size) - this->collisions_++; + probe = (probe + increment) & size) + { + ++this->collisions_; + } if (this->table_[probe]) - return this->table_[probe]; + { + return this->table_[probe]; + } else { this->table_[probe] = item; diff --git a/ACE/apps/gperf/src/Iterator.cpp b/ACE/apps/gperf/src/Iterator.cpp index b4975a41bb5..12ce57de2b5 100644 --- a/ACE/apps/gperf/src/Iterator.cpp +++ b/ACE/apps/gperf/src/Iterator.cpp @@ -76,20 +76,29 @@ Iterator::operator() (void) case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': for (curr_value = 0; ACE_OS::ace_isdigit (*str); str++) - curr_value = curr_value * 10 + *str - '0'; + { + curr_value = curr_value * 10 + *str - '0'; + } if (*str == '-') { for (size = 1, upper_bound = 0; ACE_OS::ace_isdigit (*++str); - upper_bound = upper_bound * 10 + *str - '0'); + upper_bound = upper_bound * 10 + *str - '0') + { + // Do nothing. + } if (upper_bound <= curr_value || upper_bound > hi_bound) - return error_value; + { + return error_value; + } } + return curr_value >= lo_bound && curr_value <= hi_bound - ? curr_value : error_value; + ? curr_value + : error_value; } return end; diff --git a/ACE/apps/gperf/src/Key_List.cpp b/ACE/apps/gperf/src/Key_List.cpp index 5a98c567188..ca4e04d71c9 100644 --- a/ACE/apps/gperf/src/Key_List.cpp +++ b/ACE/apps/gperf/src/Key_List.cpp @@ -358,13 +358,17 @@ Key_List::read_keys (void) List_Node * Key_List::merge (List_Node *list1, List_Node *list2) { - if (!list1) - return list2; - else if (!list2) - return list1; + if (list1 == 0) + { + return list2; + } + else if (list2 == 0) + { + return list1; + } else if (occurrence_sort && list1->occurrence < list2->occurrence - || hash_sort && list1->hash_value > list2->hash_value - || key_sort && ACE_OS::strcmp (list1->key, list2->key) >= 0) + || (hash_sort && list1->hash_value > list2->hash_value) + || (key_sort && ACE_OS::strcmp (list1->key, list2->key) >= 0)) { list2->next = merge (list2->next, list1); return list2; @@ -1699,28 +1703,43 @@ Key_List::output (void) output_hash_function (); if (option[GLOBAL]) - if (option[SWITCH]) - { - if (option[LENTABLE] && option[DUP]) - output_keylength_table (); - if (option[POINTER] && option[TYPE]) + { + if (option[SWITCH]) + { + if (option[LENTABLE] && option[DUP]) + { + output_keylength_table (); + } + + if (option[POINTER] && option[TYPE]) + { + output_keyword_table (); + } + } + else + { + if (option[LENTABLE]) + { + output_keylength_table (); + } + output_keyword_table (); - } - else - { - if (option[LENTABLE]) - output_keylength_table (); - output_keyword_table (); - if (output_lookup_array () == -1) - ACE_ERROR_RETURN ((LM_DEBUG, - "%p\n", - "output_lookup_array"), - -1); - } + + if (output_lookup_array () == -1) + { + ACE_ERROR_RETURN ((LM_DEBUG, + "%p\n", + "output_lookup_array"), + -1); + } + } + } // Use the inline keyword to remove function overhead. if (option[INLINE]) - ACE_OS::printf ("inline\n"); + { + ACE_OS::printf ("inline\n"); + } int pointer_and_type_enabled = option[POINTER] && option[TYPE]; diff --git a/ACE/apps/gperf/src/List_Node.cpp b/ACE/apps/gperf/src/List_Node.cpp index 80f4e96be30..1668ab114c0 100644 --- a/ACE/apps/gperf/src/List_Node.cpp +++ b/ACE/apps/gperf/src/List_Node.cpp @@ -38,17 +38,19 @@ List_Node::sort (char *base, int len) { int i, j; - for (i = 0, j = len - 1; i < j; i++) + for (i = 0, j = len - 1; i < j; ++i) { - char curr, tmp; + char tmp; + int curr; - for (curr = static_cast<char> (i + 1), tmp = base[curr]; - curr > 0 && tmp < base[curr-1]; - curr--) - base[curr] = base[curr - 1]; + for (curr = i + 1, tmp = base[curr]; + curr > 0 && tmp < base[curr - 1]; + --curr) + { + base[curr] = base[curr - 1]; + } base[curr] = tmp; - } } |