summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorocielliottc <elliottc@objectcomputing.com>2022-12-08 12:22:17 -0600
committerGitHub <noreply@github.com>2022-12-08 12:22:17 -0600
commit4749c83a1686db98a4cbc661333b549db3235873 (patch)
tree562d300a9f70e5c59fb487bd3fbda6c10f88aaba
parenta824af374a4ed77a7a4f603675680e395b87cdc9 (diff)
parentb222c09aa3e259839ca2c22c5a033bf29dcebf38 (diff)
downloadATCD-4749c83a1686db98a4cbc661333b549db3235873.tar.gz
Merge pull request #1989 from DOCGroup/elliottc/fix-more-warnings
[ace6tao2] Fix more build warnings (as shown by builds for OpenDDS)
-rw-r--r--ACE/ace/Acceptor.cpp14
-rw-r--r--ACE/ace/Configuration.cpp9
-rw-r--r--ACE/ace/OS_NS_Thread.inl2
-rw-r--r--ACE/ace/SPIPE_Addr.h3
-rw-r--r--ACE/ace/SPIPE_Addr.inl7
5 files changed, 28 insertions, 7 deletions
diff --git a/ACE/ace/Acceptor.cpp b/ACE/ace/Acceptor.cpp
index 624e69cd82f..31cfe1db91f 100644
--- a/ACE/ace/Acceptor.cpp
+++ b/ACE/ace/Acceptor.cpp
@@ -830,7 +830,6 @@ ACE_Strategy_Acceptor<SVC_HANDLER, PEER_ACCEPTOR>::info (ACE_TCHAR **strp,
{
ACE_TRACE ("ACE_Strategy_Acceptor::info");
- ACE_TCHAR buf[BUFSIZ];
ACE_TCHAR service_addr_str[BUFSIZ];
typename PEER_ACCEPTOR::PEER_ADDR addr;
@@ -840,8 +839,17 @@ ACE_Strategy_Acceptor<SVC_HANDLER, PEER_ACCEPTOR>::info (ACE_TCHAR **strp,
sizeof service_addr_str) == -1)
return -1;
- // @@ Should add the protocol in...
- ACE_OS::snprintf (buf, BUFSIZ,
+ //
+ // gcc10 complains that it is possible that buf could be truncated by up to
+ // 6 bytes in this call to snprintf. Technically, this is possible
+ // (however unlikely that may be). Since service_addr_str is defined to be
+ // of size BUFSIZ, gcc assumes that the string could actually be BUFSIZ in
+ // length. That makes the possible total length of the combined string
+ // (given the size of the literal string constants) 5 + BUFSIZE + 1.
+ //
+ const size_t additional = 6;
+ ACE_TCHAR buf[BUFSIZ + additional];
+ ACE_OS::snprintf (buf, sizeof buf,
ACE_TEXT ("%s\t %s #%s\n"),
this->service_name_ == 0
? ACE_TEXT ("<unknown>")
diff --git a/ACE/ace/Configuration.cpp b/ACE/ace/Configuration.cpp
index 10b0ad2b05b..ee492ccefef 100644
--- a/ACE/ace/Configuration.cpp
+++ b/ACE/ace/Configuration.cpp
@@ -1537,9 +1537,12 @@ ACE_Configuration_Heap::open_section (const ACE_Configuration_Section_Key& base,
(separator = ACE_OS::strchr (sub_section, ACE_TEXT ('\\'))) != 0;
)
{
- ACE_TString simple_section (sub_section, separator - sub_section);
- int ret_val =
- open_simple_section (result, simple_section.c_str (), create, result);
+ // Create a substring from the current location until the new found separator
+ // Because ACE_TString works with the character length we need to keep in mind
+ // the size of a single character
+ ACE_TString tsub_section (sub_section);
+ ACE_TString const simple_section = tsub_section.substring(0, (separator - sub_section) / sizeof (ACE_TCHAR));
+ int const ret_val = open_simple_section (result, simple_section.c_str(), create, result);
if (ret_val)
return ret_val;
sub_section = separator + 1;
diff --git a/ACE/ace/OS_NS_Thread.inl b/ACE/ace/OS_NS_Thread.inl
index 29dbb28ae2a..a50db7e42af 100644
--- a/ACE/ace/OS_NS_Thread.inl
+++ b/ACE/ace/OS_NS_Thread.inl
@@ -3754,7 +3754,7 @@ ACE_OS::thread_mutex_trylock (ACE_thread_mutex_t *m)
# if defined (ACE_HAS_WTHREADS)
# if defined (ACE_HAS_WIN32_TRYLOCK)
BOOL result = ::TryEnterCriticalSection (m);
- if (result == TRUE)
+ if (result)
{
return 0;
}
diff --git a/ACE/ace/SPIPE_Addr.h b/ACE/ace/SPIPE_Addr.h
index e6d781e195e..8d76f92d2ed 100644
--- a/ACE/ace/SPIPE_Addr.h
+++ b/ACE/ace/SPIPE_Addr.h
@@ -43,6 +43,9 @@ public:
/// system.
ACE_SPIPE_Addr (const ACE_TCHAR *rendezvous_point, gid_t = 0, uid_t = 0);
+ /// Assignment operator
+ ACE_SPIPE_Addr &operator = (const ACE_SPIPE_Addr &rhs);
+
/// Acts like a copy constructor...
int set (const ACE_SPIPE_Addr &sa);
diff --git a/ACE/ace/SPIPE_Addr.inl b/ACE/ace/SPIPE_Addr.inl
index b92aed80916..ec859a53830 100644
--- a/ACE/ace/SPIPE_Addr.inl
+++ b/ACE/ace/SPIPE_Addr.inl
@@ -4,6 +4,13 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+ACE_INLINE ACE_SPIPE_Addr &
+ACE_SPIPE_Addr::operator = (const ACE_SPIPE_Addr &rhs)
+{
+ this->set (rhs);
+ return *this;
+}
+
// Compare two addresses for equality.
ACE_INLINE bool