Skip to content

Commit

Permalink
Merge pull request #856 from jwillemsen/jwi-netsvcscpp11
Browse files Browse the repository at this point in the history
Fix C++11 related warnings given by newer gcc versions
  • Loading branch information
jwillemsen authored Mar 4, 2019
2 parents b2d46d7 + 5864427 commit 9bdf615
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ACE/ace/OS_NS_unistd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ ACE_OS::fork_exec (ACE_TCHAR *argv[])
ACE_OS::exit (errno);
}
# endif /* ACE_HAS_WCHAR */

return result;
default:
// Server process. The fork succeeded.
return result;
Expand Down
8 changes: 8 additions & 0 deletions ACE/netsvcs/lib/Client_Logging_Handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ ACE_Client_Logging_Handler::handle_input (ACE_HANDLE handle)
ACE_Message_Block (ACE_DEFAULT_CDR_BUFSIZE),
-1);

#if defined (ACE_HAS_CPP11)
std::unique_ptr <ACE_Message_Block> header (header_p);
#else
auto_ptr <ACE_Message_Block> header (header_p);
#endif /* ACE_HAS_CPP11 */

// Align the Message Block for a CDR stream
ACE_CDR::mb_align (header.get ());
Expand Down Expand Up @@ -217,7 +221,11 @@ ACE_Client_Logging_Handler::handle_input (ACE_HANDLE handle)
ACE_NEW_RETURN (payload_p,
ACE_Message_Block (length),
-1);
#if defined (ACE_HAS_CPP11)
std::unique_ptr <ACE_Message_Block> payload (payload_p);
#else
auto_ptr <ACE_Message_Block> payload (payload_p);
#endif /* ACE_HAS_CPP11 */

// Ensure there's sufficient room for log record payload.
ACE_CDR::grow (payload.get (), 8 + ACE_CDR::MAX_ALIGNMENT + length);
Expand Down
2 changes: 1 addition & 1 deletion ACE/netsvcs/lib/Name_Handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ ACE_Name_Handler::recv_request (void)
switch (n)
{
case -1:
/* FALLTHROUGH */
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("****************** recv_request returned -1\n")));
/* FALLTHROUGH */
default:
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p got %d bytes, expected %d bytes\n"),
Expand Down
8 changes: 8 additions & 0 deletions ACE/netsvcs/lib/Server_Logging_Handler_T.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ ACE_Server_Logging_Handler_T<ACE_PEER_STREAM_2, COUNTER, ACE_SYNCH_USE, LMR>::ha
ACE_Message_Block (ACE_DEFAULT_CDR_BUFSIZE),
-1);

#if defined (ACE_HAS_CPP11)
std::unique_ptr <ACE_Message_Block> header (header_p);
#else
auto_ptr <ACE_Message_Block> header (header_p);
#endif /* ACE_HAS_CPP11 */

// Align the Message Block for a CDR stream
ACE_CDR::mb_align (header.get ());
Expand Down Expand Up @@ -122,7 +126,11 @@ ACE_Server_Logging_Handler_T<ACE_PEER_STREAM_2, COUNTER, ACE_SYNCH_USE, LMR>::ha
ACE_NEW_RETURN (payload_p,
ACE_Message_Block (length),
-1);
#if defined (ACE_HAS_CPP11)
std::unique_ptr <ACE_Message_Block> payload (payload_p);
#else
auto_ptr <ACE_Message_Block> payload (payload_p);
#endif /* ACE_HAS_CPP11 */

// Ensure there's sufficient room for log record payload.
ACE_CDR::grow (payload.get (), 8 + ACE_CDR::MAX_ALIGNMENT + length);
Expand Down
2 changes: 1 addition & 1 deletion ACE/netsvcs/lib/TS_Clerk_Handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ ACE_TS_Clerk_Handler::recv_reply (ACE_Time_Request &reply)
switch (n)
{
case -1:
// FALLTHROUGH
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("****************** recv_reply returned -1\n")));
// FALLTHROUGH
default:
ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p got %d bytes, expected %d bytes\n"),
ACE_TEXT ("recv failed"), n, bytes_expected));
Expand Down
6 changes: 3 additions & 3 deletions ACE/netsvcs/lib/TS_Server_Handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,19 @@ ACE_TS_Server_Handler::dispatch (void)
ACE_TS_Server_Handler::recv_request (void)
{
ACE_TRACE ("ACE_TS_Server_Handler::recv_request");
ssize_t bytes_expected = this->time_request_.size ();
ssize_t const bytes_expected = this->time_request_.size ();

// Since Time_Request messages are fixed size, read the entire
// message in one go.
ssize_t n = this->peer ().recv ((void *) &this->time_request_, bytes_expected);
ssize_t const n = this->peer ().recv ((void *) &this->time_request_, bytes_expected);
if (n != bytes_expected)
{
switch (n)
{
case -1:
/* FALLTHROUGH */
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("****************** recv_request returned -1\n")));
/* FALLTHROUGH */
default:
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%p got %d bytes, expected %d bytes\n"),
Expand Down

0 comments on commit 9bdf615

Please sign in to comment.