diff options
author | Steve Huston <shuston@riverace.com> | 2004-05-20 15:31:41 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2004-05-20 15:31:41 +0000 |
commit | 289f51a9f05af8fd1edacd4bb16d36ca47f35908 (patch) | |
tree | 8938b15a868dead3da6217967d34cd5bb9bf5106 | |
parent | 25e8e08194f0958b014499281b060c17e94251bb (diff) | |
download | ATCD-289f51a9f05af8fd1edacd4bb16d36ca47f35908.tar.gz |
ChangeLogTag:Thu May 20 10:21:39 2004 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | THANKS | 2 | ||||
-rw-r--r-- | examples/APG/Containers/Queues.cpp | 14 | ||||
-rw-r--r-- | examples/APG/Reactor/Client.cpp | 12 |
4 files changed, 31 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog index d99e14e0741..7ce755ea93a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Thu May 20 10:21:39 2004 Steve Huston <shuston@riverace.com> + + * examples/APG/Reactor/Client.cpp: In handle_input(), use "%.*C", + not "%*C" to limit output to string length. In handle_timeout (), + referring to a buffer in ACE_Message_Block's ctor doesn't copy the + data; it simply refers to it. This would produce garbage output. + Thanks to Dale Hawkins <dhawkins@cdrgts.com> for these fixes. + + * examples/APG/Containers/Queues.cpp (runStackUnboundedQueue): The + DataElement arrays inserted into the queue should be defined outside + their 'for' loops to avoid repeated, unnecessary constructor and + destruction. Thanks to Bill Hopkins <bill.hopkins@level3.com> for + this suggestion. + + * THANKS: Added Dale Hawkins and Bill Hopkins. + Wed May 19 12:46:33 2004 Steve Huston <shuston@riverace.com> * ace/SSL/SSL_SOCK.i: Added missing #include "ace/OS_NS_sys_socket.h" @@ -1880,6 +1880,8 @@ Vinod Kumar <vinod_kumar at agilent dot com> Mirek Pabich <miropabich at tenbit dot pl> Christian Egeler <Christian dot Egeler at motorola dot com> J.T. Conklin <jtc at acorntoolworks dot com> +Dale Hawkins <dhawkins at cdrgts dot com> +Bill Hopkins <bill dot hopkins at level3 dot com> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile diff --git a/examples/APG/Containers/Queues.cpp b/examples/APG/Containers/Queues.cpp index e023ebe3284..857dc554f8d 100644 --- a/examples/APG/Containers/Queues.cpp +++ b/examples/APG/Containers/Queues.cpp @@ -52,19 +52,19 @@ int QueueExample::runStackUnboundedQueue (void) ACE_TRACE (ACE_TEXT ("QueueExample::runStackUnboundedQueue")); ACE_Unbounded_Queue<DataElement> queue; + DataElement elem1[10]; int i; for (i = 0; i < 10; i++) { - DataElement elem[10]; - elem[i].setData (9-i); - queue.enqueue_head (elem[i]); + elem1[i].setData (9-i); + queue.enqueue_head (elem1[i]); } - for (i = 0; i< 10; i++) + DataElement elem2[10]; + for (i = 0; i < 10; i++) { - DataElement elem[10]; - elem[i].setData (i+10); - queue.enqueue_tail (elem[i]); + elem2[i].setData (i+10); + queue.enqueue_tail (elem2[i]); } for (ACE_Unbounded_Queue_Iterator<DataElement> iter (queue); diff --git a/examples/APG/Reactor/Client.cpp b/examples/APG/Reactor/Client.cpp index 4611bf49613..72b5485770d 100644 --- a/examples/APG/Reactor/Client.cpp +++ b/examples/APG/Reactor/Client.cpp @@ -31,7 +31,7 @@ int Client::handle_input (ACE_HANDLE) ssize_t recv_cnt = this->peer ().recv (buf, sizeof (buf) - 1); if (recv_cnt > 0) { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%*C"), + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%.*C"), ACE_static_cast (int, recv_cnt), buf)); return 0; @@ -56,11 +56,11 @@ int Client::handle_timeout(const ACE_Time_Value &, const void *) } ACE_Message_Block *mb; - char msg[128]; - ACE_OS::sprintf (msg, "Iteration %d\n", this->iterations_); - ACE_NEW_RETURN - (mb, ACE_Message_Block (ACE_OS::strlen (msg) + 1), -1); - mb->copy (msg); + ACE_NEW_RETURN (mb, ACE_Message_Block (128), -1); + int nbytes = ACE_OS::sprintf + (mb->wr_ptr (), "Iteration %d\n", this->iterations_); + ACE_ASSERT (nbytes > 0); + mb->wr_ptr (ACE_static_cast (size_t, nbytes)); this->putq (mb); return 0; } |