From 289f51a9f05af8fd1edacd4bb16d36ca47f35908 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Thu, 20 May 2004 15:31:41 +0000 Subject: ChangeLogTag:Thu May 20 10:21:39 2004 Steve Huston --- ChangeLog | 16 ++++++++++++++++ THANKS | 2 ++ examples/APG/Containers/Queues.cpp | 14 +++++++------- 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 + + * 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 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 for + this suggestion. + + * THANKS: Added Dale Hawkins and Bill Hopkins. + Wed May 19 12:46:33 2004 Steve Huston * ace/SSL/SSL_SOCK.i: Added missing #include "ace/OS_NS_sys_socket.h" diff --git a/THANKS b/THANKS index 5ca4e1733f8..8baaeb51183 100644 --- a/THANKS +++ b/THANKS @@ -1880,6 +1880,8 @@ Vinod Kumar Mirek Pabich Christian Egeler J.T. Conklin +Dale Hawkins +Bill Hopkins 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 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 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; } -- cgit v1.2.1