From 4cc58ce93b93e07f2d73228ad7c621c7fccbd2f6 Mon Sep 17 00:00:00 2001 From: Martin Corino Date: Thu, 28 May 2015 13:43:18 +0200 Subject: Changes to fix integer type conversion warnings. * ACE/ace/ETCL/ETCL_y.cpp: * ACE/ace/XML_Utils/XercesString.cpp: * ACE/apps/gperf/src/Gen_Perf.cpp: * ACE/apps/gperf/src/List_Node.cpp: * ACE/apps/gperf/src/Options.cpp: --- ACE/ace/ETCL/ETCL_y.cpp | 2 +- ACE/ace/XML_Utils/XercesString.cpp | 8 +++++--- ACE/apps/gperf/src/Gen_Perf.cpp | 3 ++- ACE/apps/gperf/src/List_Node.cpp | 2 +- ACE/apps/gperf/src/Options.cpp | 3 ++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ACE/ace/ETCL/ETCL_y.cpp b/ACE/ace/ETCL/ETCL_y.cpp index 9fe453f62fa..bee4ad17f11 100644 --- a/ACE/ace/ETCL/ETCL_y.cpp +++ b/ACE/ace/ETCL/ETCL_y.cpp @@ -623,7 +623,7 @@ yynewstate: #endif /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; + int size = (int)(yyssp - yyss + 1); #ifdef yyoverflow /* Each stack pointer address is followed by the size of diff --git a/ACE/ace/XML_Utils/XercesString.cpp b/ACE/ace/XML_Utils/XercesString.cpp index d4fe450e229..5a85dfb43c4 100644 --- a/ACE/ace/XML_Utils/XercesString.cpp +++ b/ACE/ace/XML_Utils/XercesString.cpp @@ -4,6 +4,8 @@ #include "XercesString.h" #include "xercesc/util/PlatformUtils.hpp" +#include "ace/Truncate.h" + using xercesc::XMLString; using xercesc::XMLPlatformUtils; @@ -62,8 +64,8 @@ namespace XML bool XStr::append(const XMLCh *tail) { - int iTailLen = XMLString::stringLen(tail); - int iWorkLen = XMLString::stringLen(_wstr); + XMLSize_t iTailLen = XMLString::stringLen(tail); + XMLSize_t iWorkLen = XMLString::stringLen(_wstr); XMLSize_t bytes = (iWorkLen + iTailLen + 1) * sizeof (XMLCh); void *tmp = XMLPlatformUtils::fgMemoryManager->allocate (bytes); @@ -112,7 +114,7 @@ namespace XML int XStr::size () const { - return XMLString::stringLen(_wstr); + return ACE_Utils::truncate_cast (XMLString::stringLen(_wstr)); } XMLCh XStr::operator [] (const int i) diff --git a/ACE/apps/gperf/src/Gen_Perf.cpp b/ACE/apps/gperf/src/Gen_Perf.cpp index e56ca40e44d..7c46c1ba6a7 100644 --- a/ACE/apps/gperf/src/Gen_Perf.cpp +++ b/ACE/apps/gperf/src/Gen_Perf.cpp @@ -27,6 +27,7 @@ #include "ace/OS_NS_time.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_Memory.h" +#include "ace/Truncate.h" /// Current release version. extern const char *version_string; @@ -77,7 +78,7 @@ Gen_Perf::compute_disjoint_union (char *set1, char *set2, char *set3) set3++; } *set3 = '\0'; - return set3 - base; + return ACE_Utils::truncate_cast (set3 - base); } /// Sort the UNION_SET in increasing frequency of occurrence. This diff --git a/ACE/apps/gperf/src/List_Node.cpp b/ACE/apps/gperf/src/List_Node.cpp index 037f2406435..018f66db6b7 100644 --- a/ACE/apps/gperf/src/List_Node.cpp +++ b/ACE/apps/gperf/src/List_Node.cpp @@ -117,7 +117,7 @@ List_Node::List_Node (char *k, int len) *ptr = '\0'; // Sort the KEYSIG items alphabetically. - sort (keysig, ptr - keysig); + sort (keysig, ACE_Utils::truncate_cast (ptr - keysig)); } List_Node::~List_Node (void) diff --git a/ACE/apps/gperf/src/Options.cpp b/ACE/apps/gperf/src/Options.cpp index 6809f86e999..c93e8dc62e4 100644 --- a/ACE/apps/gperf/src/Options.cpp +++ b/ACE/apps/gperf/src/Options.cpp @@ -27,6 +27,7 @@ #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_stdlib.h" +#include "ace/Truncate.h" /// These need to appear before the global class instantiation, since /// they are static members with a default constructor that initializes @@ -518,7 +519,7 @@ Options::parse_args (int argc, ACE_TCHAR *argv[]) *l_key_pos = EOS; - total_keysig_size_ = (l_key_pos - key_positions_); + total_keysig_size_ = ACE_Utils::truncate_cast (l_key_pos - key_positions_); if (total_keysig_size_ == 0) ACE_ERROR_RETURN ((LM_ERROR, "No keys selected.\n%r", -- cgit v1.2.1