diff --git a/dds/DCPS/RTPS/ParameterListConverter.cpp b/dds/DCPS/RTPS/ParameterListConverter.cpp index 24ec7087d06..6dce47fb9c8 100644 --- a/dds/DCPS/RTPS/ParameterListConverter.cpp +++ b/dds/DCPS/RTPS/ParameterListConverter.cpp @@ -1397,7 +1397,7 @@ bool from_param_list(const ParameterList& param_list, // Interoperability note: // Spec creators for RTPS have reliability indexed at 1 { - const CORBA::Short rtpsKind = param.reliability().kind.value; + const CORBA::Short rtpsKind = static_cast(param.reliability().kind.value); const CORBA::Short OLD_RELIABLE_VALUE = 3; if (rtpsKind == RTPS::RELIABLE || rtpsKind == OLD_RELIABLE_VALUE) { reader_data.ddsSubscriptionData.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS; diff --git a/dds/DCPS/RTPS/RtpsDiscoveryConfig.cpp b/dds/DCPS/RTPS/RtpsDiscoveryConfig.cpp index b3b142ff236..c652c45e9e6 100644 --- a/dds/DCPS/RTPS/RtpsDiscoveryConfig.cpp +++ b/dds/DCPS/RTPS/RtpsDiscoveryConfig.cpp @@ -192,8 +192,8 @@ void RtpsDiscoveryConfig::sedp_port_mode(PortMode value) DDS::UInt16 RtpsDiscoveryConfig::pb() const { - return TheServiceParticipant->config_store()->get_uint32(config_key("PB").c_str(), - default_port_base); + return static_cast(TheServiceParticipant->config_store()->get_uint32(config_key("PB").c_str(), + default_port_base)); } void @@ -206,8 +206,8 @@ RtpsDiscoveryConfig::pb(DDS::UInt16 port_base) DDS::UInt16 RtpsDiscoveryConfig::dg() const { - return TheServiceParticipant->config_store()->get_uint32(config_key("DG").c_str(), - default_domain_gain); + return static_cast(TheServiceParticipant->config_store()->get_uint32(config_key("DG").c_str(), + default_domain_gain)); } void @@ -220,8 +220,8 @@ RtpsDiscoveryConfig::dg(DDS::UInt16 domain_gain) DDS::UInt16 RtpsDiscoveryConfig::pg() const { - return TheServiceParticipant->config_store()->get_uint32(config_key("PG").c_str(), - default_part_gain); + return static_cast(TheServiceParticipant->config_store()->get_uint32(config_key("PG").c_str(), + default_part_gain)); } void @@ -241,8 +241,8 @@ RtpsDiscoveryConfig::d0() const default_value = static_cast(std::atoi(from_env)); } #endif - return TheServiceParticipant->config_store()->get_uint32(config_key("D0").c_str(), - default_value); + return static_cast(TheServiceParticipant->config_store()->get_uint32(config_key("D0").c_str(), + default_value)); } void @@ -255,8 +255,8 @@ RtpsDiscoveryConfig::d0(DDS::UInt16 spdp_multicast_offset) DDS::UInt16 RtpsDiscoveryConfig::d1() const { - return TheServiceParticipant->config_store()->get_uint32(config_key("D1").c_str(), - default_spdp_unicast_offset); + return static_cast(TheServiceParticipant->config_store()->get_uint32(config_key("D1").c_str(), + default_spdp_unicast_offset)); } void @@ -268,8 +268,8 @@ RtpsDiscoveryConfig::d1(DDS::UInt16 spdp_unicast_offset) DDS::UInt16 RtpsDiscoveryConfig::dx() const { - return TheServiceParticipant->config_store()->get_uint32(config_key("DX").c_str(), - default_sedp_multicast_offset); + return static_cast(TheServiceParticipant->config_store()->get_uint32(config_key("DX").c_str(), + default_sedp_multicast_offset)); } void @@ -282,8 +282,8 @@ RtpsDiscoveryConfig::dx(DDS::UInt16 sedp_multicast_offset) DDS::UInt16 RtpsDiscoveryConfig::dy() const { - return TheServiceParticipant->config_store()->get_uint32(config_key("DY").c_str(), - default_sedp_unicast_offset); + return static_cast(TheServiceParticipant->config_store()->get_uint32(config_key("DY").c_str(), + default_sedp_unicast_offset)); } void @@ -309,7 +309,7 @@ bool RtpsDiscoveryConfig::set_spdp_unicast_port(DCPS::NetworkAddress& addr, bool unsigned char RtpsDiscoveryConfig::ttl() const { - return TheServiceParticipant->config_store()->get_uint32(config_key("TTL").c_str(), 1); + return static_cast(TheServiceParticipant->config_store()->get_uint32(config_key("TTL").c_str(), 1)); } void diff --git a/dds/DCPS/Serializer.cpp b/dds/DCPS/Serializer.cpp index 182a7d6abe2..b6070cb34bc 100644 --- a/dds/DCPS/Serializer.cpp +++ b/dds/DCPS/Serializer.cpp @@ -170,10 +170,10 @@ Serializer::ScopedAlignmentContext::ScopedAlignmentContext(Serializer& ser, size : ser_(ser) , max_align_(ser.encoding().max_align()) , start_rpos_(ser.rpos()) - , rblock_((max_align_ && ser.current_) ? (ptrdiff_t(ser.current_->rd_ptr()) - ser.align_rshift_) % max_align_ : 0) + , rblock_((max_align_ && ser.current_) ? (reinterpret_cast(ser.current_->rd_ptr()) - ser.align_rshift_) % max_align_ : 0) , min_read_(min_read) , start_wpos_(ser.wpos()) - , wblock_((max_align_ && ser.current_) ? (ptrdiff_t(ser.current_->wr_ptr()) - ser.align_wshift_) % max_align_ : 0) + , wblock_((max_align_ && ser.current_) ? (reinterpret_cast(ser.current_->wr_ptr()) - ser.align_wshift_) % max_align_ : 0) { ser_.reset_alignment(); } @@ -214,7 +214,7 @@ Serializer::peek(ACE_CDR::ULong& t) void Serializer::reset_alignment() { - const ptrdiff_t align = encoding().max_align(); + const size_t align = encoding().max_align(); if (current_ && align) { align_rshift_ = offset(current_->rd_ptr(), 0, align); align_wshift_ = offset(current_->wr_ptr(), 0, align); @@ -503,7 +503,7 @@ bool Serializer::read_parameter_id(unsigned& id, size_t& size, bool& must_unders if (!(*this >> long_id) || !(*this >> long_size)) { return false; } - const unsigned short_size_left = short_size - 8; + const unsigned short_size_left = short_size - 8u; if (short_size_left) { skip(short_size_left); } diff --git a/dds/DCPS/ValueHelper.h b/dds/DCPS/ValueHelper.h index 9f44c15b115..83737229e59 100644 --- a/dds/DCPS/ValueHelper.h +++ b/dds/DCPS/ValueHelper.h @@ -98,7 +98,7 @@ std::ostream& char_helper(std::ostream& o, CharType value) return o << "\\a"; } const unsigned cvalue = char_value(value); - if (cvalue <= UCHAR_MAX && isprint(cvalue)) { + if (cvalue <= UCHAR_MAX && isprint(static_cast(cvalue))) { return o << static_cast(value); } return hex_value(o << "\\x", cvalue, sizeof(CharType) == 1 ? 1 : 2); diff --git a/dds/DCPS/XTypes/IdlScanner.h b/dds/DCPS/XTypes/IdlScanner.h index dbd259ef156..2ab93ba8200 100644 --- a/dds/DCPS/XTypes/IdlScanner.h +++ b/dds/DCPS/XTypes/IdlScanner.h @@ -73,10 +73,6 @@ class OpenDDS_Dcps_Export IdlToken { IdlToken() : kind_(Error) - , signed_(false) - , integer_value_(0) - , exponent_signed_(false) - , exponent_value_(0) {} static IdlToken make_error() @@ -121,8 +117,8 @@ class OpenDDS_Dcps_Export IdlToken { { IdlToken token; token.kind_ = IntegerLiteral; - token.signed_ = is_signed; - token.integer_value_ = value; + token.numeric_value_.signed_ = is_signed; + token.numeric_value_.integer_value_ = value; return token; } @@ -130,10 +126,10 @@ class OpenDDS_Dcps_Export IdlToken { { IdlToken token; token.kind_ = FloatLiteral; - token.signed_ = is_signed; - token.integer_value_ = value; - token.exponent_signed_ = exponent_is_signed; - token.exponent_value_ = exponent_value; + token.numeric_value_.signed_ = is_signed; + token.numeric_value_.integer_value_ = value; + token.numeric_value_.exponent_signed_ = exponent_is_signed; + token.numeric_value_.exponent_value_ = exponent_value; return token; } @@ -166,10 +162,13 @@ class OpenDDS_Dcps_Export IdlToken { case BooleanLiteral: return boolean_value_ == other.boolean_value_; case IntegerLiteral: - return signed_ == other.signed_ && integer_value_ == other.integer_value_; + return numeric_value_.signed_ == other.numeric_value_.signed_ + && numeric_value_.integer_value_ == other.numeric_value_.integer_value_; case FloatLiteral: - return signed_ == other.signed_ && integer_value_ == other.integer_value_ - && exponent_signed_ == other.exponent_signed_ && exponent_value_ == other.exponent_value_; + return numeric_value_.signed_ == other.numeric_value_.signed_ + && numeric_value_.integer_value_ == other.numeric_value_.integer_value_ + && numeric_value_.exponent_signed_ == other.numeric_value_.exponent_signed_ + && numeric_value_.exponent_value_ == other.numeric_value_.exponent_value_; case StringLiteral: return string_value_ == other.string_value_; case CharacterLiteral: @@ -208,22 +207,22 @@ class OpenDDS_Dcps_Export IdlToken { bool is_signed() const { - return signed_; + return numeric_value_.signed_; } ACE_UINT64 integer_value() const { - return integer_value_; + return numeric_value_.integer_value_; } bool exponent_is_signed() const { - return exponent_signed_; + return numeric_value_.exponent_signed_; } ACE_UINT64 exponent_value() const { - return exponent_value_; + return numeric_value_.exponent_value_; } const std::string& identifier_value() const @@ -232,16 +231,18 @@ class OpenDDS_Dcps_Export IdlToken { } private: + struct Numeric { + bool signed_; // Integer or Float is signed. + ACE_UINT64 integer_value_; // Integer or Float. + bool exponent_signed_; // Exponent is signed for Float. + ACE_UINT64 exponent_value_; // Exponent value for Float. + }; + Kind kind_; union { bool boolean_value_; char character_value_; - struct { - bool signed_; // Integer or Float is signed. - ACE_UINT64 integer_value_; // Integer or Float. - bool exponent_signed_; // Exponent is signed for Float. - ACE_UINT64 exponent_value_; // Exponent value for Float. - }; + Numeric numeric_value_; }; std::string string_value_; std::string identifier_value_; @@ -549,11 +550,11 @@ class OpenDDS_Dcps_Export IdlScanner { IdlToken scan_numeric_literal() { - signed_ = false; - integer_value_ = 0; - digits_after_decimal_ = 0; - exponent_signed_ = false; - exponent_value_ = 0; + numeric_literal_.signed_ = false; + numeric_literal_.integer_value_ = 0; + numeric_literal_.digits_after_decimal_ = 0; + numeric_literal_.exponent_signed_ = false; + numeric_literal_.exponent_value_ = 0; if (scanner_.eoi()) { return IdlToken::make_error(); @@ -562,7 +563,7 @@ class OpenDDS_Dcps_Export IdlScanner { const char c = scanner_.peek(); if (c == '-') { scanner_.match(c); - signed_ = true; + numeric_literal_.signed_ = true; } if (scanner_.eoi()) { @@ -581,7 +582,7 @@ class OpenDDS_Dcps_Export IdlScanner { if (e >= '0' && e <= '7') { // Octal if (scan_numeric_octal()) { - return IdlToken::make_integer(signed_, integer_value_); + return IdlToken::make_integer(numeric_literal_.signed_, numeric_literal_.integer_value_); } else { return IdlToken::make_error(); } @@ -589,7 +590,7 @@ class OpenDDS_Dcps_Export IdlScanner { // Hex. scanner_.match(e); if (scan_numeric_hex()) { - return IdlToken::make_integer(signed_, integer_value_); + return IdlToken::make_integer(numeric_literal_.signed_, numeric_literal_.integer_value_); } else { return IdlToken::make_error(); } @@ -629,7 +630,7 @@ class OpenDDS_Dcps_Export IdlScanner { const char c = scanner_.peek(); if (c >= '0' && c <= '7') { - return scanner_.match(c) && scale_integer(8, c - '0'); + return scanner_.match(c) && scale_integer(8, static_cast(c - '0')); } return false; @@ -643,7 +644,8 @@ class OpenDDS_Dcps_Export IdlScanner { const char c = scanner_.peek(); if (c >= '0' && c <= '7') { - return scanner_.match(c) && scale_integer(8, c - '0') && scan_numeric_octal_optional_digits(); + return scanner_.match(c) && scale_integer(8, static_cast(c - '0')) + && scan_numeric_octal_optional_digits(); } return true; @@ -707,7 +709,7 @@ class OpenDDS_Dcps_Export IdlScanner { const char c = scanner_.peek(); if (c >= '0' && c <= '9') { - ++digits_after_decimal_; + ++numeric_literal_.digits_after_decimal_; return scanner_.match(c) && scale_integer(10, c - '0'); } else { return false; @@ -722,7 +724,7 @@ class OpenDDS_Dcps_Export IdlScanner { const char c = scanner_.peek(); if (c >= '0' && c <= '9') { - ++digits_after_decimal_; + ++numeric_literal_.digits_after_decimal_; return scanner_.match(c) && scale_integer(10, c - '0') && scan_numeric_fraction_optional_digits(); } else { return true; @@ -752,7 +754,7 @@ class OpenDDS_Dcps_Export IdlScanner { const char c = scanner_.peek(); if (c == '-') { scanner_.match(c); - exponent_signed_ = true; + numeric_literal_.exponent_signed_ = true; } return scan_numeric_exponent_digit() && scan_numeric_exponent_optional_digits(); @@ -790,7 +792,7 @@ class OpenDDS_Dcps_Export IdlScanner { { if (scan_numeric_integer_digit() && scan_numeric_integer_optional_digits()) { if (scanner_.eoi()) { - return IdlToken::make_integer(signed_, integer_value_); + return IdlToken::make_integer(numeric_literal_.signed_, numeric_literal_.integer_value_); } const char c = scanner_.peek(); @@ -807,7 +809,7 @@ class OpenDDS_Dcps_Export IdlScanner { return IdlToken::make_error(); } } else { - return IdlToken::make_integer(signed_, integer_value_); + return IdlToken::make_integer(numeric_literal_.signed_, numeric_literal_.integer_value_); } } else { return IdlToken::make_error(); @@ -844,56 +846,59 @@ class OpenDDS_Dcps_Export IdlScanner { IdlToken make_float() { - while (digits_after_decimal_) { - if (exponent_signed_) { - ++exponent_value_; - if (exponent_value_ == 0) { + while (numeric_literal_.digits_after_decimal_) { + if (numeric_literal_.exponent_signed_) { + ++numeric_literal_.exponent_value_; + if (numeric_literal_.exponent_value_ == 0) { return IdlToken::make_error(); } } else { - if (exponent_value_ > 0) { - --exponent_value_; + if (numeric_literal_.exponent_value_ > 0) { + --numeric_literal_.exponent_value_; } else { - exponent_signed_ = true; - exponent_value_ = 1; + numeric_literal_.exponent_signed_ = true; + numeric_literal_.exponent_value_ = 1; } } - --digits_after_decimal_; + --numeric_literal_.digits_after_decimal_; } - return IdlToken::make_float(signed_, integer_value_, exponent_signed_, exponent_value_); + return IdlToken::make_float(numeric_literal_.signed_, numeric_literal_.integer_value_, + numeric_literal_.exponent_signed_, numeric_literal_.exponent_value_); } bool scale_integer(ACE_UINT64 base, ACE_UINT64 value) { - const ACE_UINT64 next = integer_value_ * base + value; - if (integer_value_ && next < integer_value_) { + const ACE_UINT64 next = numeric_literal_.integer_value_ * base + value; + if (numeric_literal_.integer_value_ && next < numeric_literal_.integer_value_) { return false; } - integer_value_ = next; + numeric_literal_.integer_value_ = next; return true; } bool scale_exponent(ACE_UINT64 value) { - const ACE_UINT64 next = exponent_value_ * 10 + value; - if (exponent_value_ && next < exponent_value_) { + const ACE_UINT64 next = numeric_literal_.exponent_value_ * 10 + value; + if (numeric_literal_.exponent_value_ && next < numeric_literal_.exponent_value_) { return false; } - exponent_value_ = next; + numeric_literal_.exponent_value_ = next; return true; } + struct Numeric { + bool signed_; + ACE_UINT64 integer_value_; + ACE_UINT64 digits_after_decimal_; + bool exponent_signed_; + ACE_UINT64 exponent_value_; // TODO: Handle overflow. + }; + CharacterScanner& scanner_; union { bool boolean_literal_; char character_literal_; - struct { - bool signed_; - ACE_UINT64 integer_value_; - ACE_UINT64 digits_after_decimal_; - bool exponent_signed_; - ACE_UINT64 exponent_value_; // TODO: Handle overflow. - }; + Numeric numeric_literal_; }; std::string string_literal_; std::string identifier_; diff --git a/dds/DCPS/debug.cpp b/dds/DCPS/debug.cpp index c48ec75f796..60cc121d356 100644 --- a/dds/DCPS/debug.cpp +++ b/dds/DCPS/debug.cpp @@ -72,7 +72,7 @@ namespace { {"info", "INFO", LogLevel::Info}, {"debug", "DEBUG", LogLevel::Debug} }; -}; +} void LogLevel::set_from_string(const char* name) { diff --git a/dds/DCPS/transport/multicast/MulticastInst.cpp b/dds/DCPS/transport/multicast/MulticastInst.cpp index ddb8bc73838..02e99629799 100644 --- a/dds/DCPS/transport/multicast/MulticastInst.cpp +++ b/dds/DCPS/transport/multicast/MulticastInst.cpp @@ -156,7 +156,7 @@ MulticastInst::port_offset(u_short po) u_short MulticastInst::port_offset() const { - return TheServiceParticipant->config_store()->get_uint32(config_key("PORT_OFFSET").c_str(), DEFAULT_PORT_OFFSET); + return static_cast(TheServiceParticipant->config_store()->get_uint32(config_key("PORT_OFFSET").c_str(), DEFAULT_PORT_OFFSET)); } void @@ -338,7 +338,7 @@ MulticastInst::ttl(unsigned char t) unsigned char MulticastInst::ttl() const { - return TheServiceParticipant->config_store()->get_uint32(config_key("TTL").c_str(), DEFAULT_TTL); + return static_cast(TheServiceParticipant->config_store()->get_uint32(config_key("TTL").c_str(), DEFAULT_TTL)); } void diff --git a/dds/DCPS/transport/rtps_udp/RtpsSampleHeader.cpp b/dds/DCPS/transport/rtps_udp/RtpsSampleHeader.cpp index 920bdfaaec3..d57c0acae1e 100644 --- a/dds/DCPS/transport/rtps_udp/RtpsSampleHeader.cpp +++ b/dds/DCPS/transport/rtps_udp/RtpsSampleHeader.cpp @@ -644,7 +644,7 @@ RtpsSampleHeader::split(const ACE_Message_Block& orig, size_t size, using namespace RTPS; size_t data_offset = 0; const char* rd = orig.rd_ptr(); - ACE_CDR::ULong starting_frag, sample_size; + ACE_CDR::ULong starting_frag = 0, sample_size = 0; ACE_CDR::Octet flags; bool swap_bytes; diff --git a/dds/FACE/config/TopicSettings.cpp b/dds/FACE/config/TopicSettings.cpp index 4b165d64e76..8226069c11a 100644 --- a/dds/FACE/config/TopicSettings.cpp +++ b/dds/FACE/config/TopicSettings.cpp @@ -10,6 +10,13 @@ OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL namespace OpenDDS { namespace FaceTSS { namespace config { +TopicSettings::TopicSettings() + : platform_view_guid_(0) + , max_message_size_(0) +{ + std::strcpy(type_name_, ""); +} + int TopicSettings::set(const char* name, const char* value) { diff --git a/dds/FACE/config/TopicSettings.h b/dds/FACE/config/TopicSettings.h index 86bd57517f0..3f4cc408a04 100644 --- a/dds/FACE/config/TopicSettings.h +++ b/dds/FACE/config/TopicSettings.h @@ -14,6 +14,8 @@ class OpenDDS_FACE_Export TopicSettings { public: static const int TYPE_NAME_LEN = 128; + TopicSettings(); + int set(const char* name, const char* value); char type_name_[TYPE_NAME_LEN]; diff --git a/dds/idl/be_util.h b/dds/idl/be_util.h index 2e073c25332..950ec6058d4 100644 --- a/dds/idl/be_util.h +++ b/dds/idl/be_util.h @@ -40,6 +40,6 @@ namespace be_util { /// Report a miscellaneous error and abort. void misc_error_and_abort(const std::string& message, AST_Decl* node = 0); -}; +} #endif // if !defined diff --git a/dds/monitor/DRMonitorImpl.cpp b/dds/monitor/DRMonitorImpl.cpp index b85082e8961..24c97117e00 100644 --- a/dds/monitor/DRMonitorImpl.cpp +++ b/dds/monitor/DRMonitorImpl.cpp @@ -54,7 +54,7 @@ DRMonitorImpl::report() { iter != writer_states.end(); ++iter) { report.associations[length].dw_id = iter->first; - report.associations[length].state = iter->second; + report.associations[length].state = static_cast(iter->second); length++; } dr_writer_->write(report, DDS::HANDLE_NIL); diff --git a/java/idl2jni/codegen/idl2jni_visitor.cpp b/java/idl2jni/codegen/idl2jni_visitor.cpp index 1ab2bfd8d3c..c7d00809da8 100644 --- a/java/idl2jni/codegen/idl2jni_visitor.cpp +++ b/java/idl2jni/codegen/idl2jni_visitor.cpp @@ -177,8 +177,9 @@ idl2jni_visitor::visit_interface(AST_Interface *node) // dynamic cast for each element. //vector inherits(node->inherits(), // node->inherits() + node->n_inherits()); - vector inherits(node->n_inherits()); - for (int i = 0; i < node->n_inherits(); i++) { + const size_t n_inherits = static_cast(node->n_inherits()); + vector inherits(n_inherits); + for (size_t i = 0; i < n_inherits; i++) { inherits[i] = dynamic_cast(*(node->inherits()+i)); } diff --git a/java/idl2jni/codegen/im_java.cpp b/java/idl2jni/codegen/im_java.cpp index eaa57a45dbc..819c52cb60d 100644 --- a/java/idl2jni/codegen/im_java.cpp +++ b/java/idl2jni/codegen/im_java.cpp @@ -340,23 +340,23 @@ namespace { //"ju" helper functions: Java Unsigned type conversion ACE_CDR::Char ju_c(ACE_CDR::Octet u) { - return (u > 0x7F) ? -static_cast(~u+1) : u; + return (u > 0x7F) ? -static_cast(~u+1) : static_cast(u); } ACE_CDR::Short ju_s(ACE_CDR::UShort u) { - return (u > 0x7FFF) ? -static_cast(~u+1) : u; + return (u > 0x7FFF) ? -static_cast(~u+1) : static_cast(u); } ACE_CDR::Long ju_l(ACE_CDR::ULong u) { - return (u > 0x7FFFFFFFUL) ? -static_cast(~u+1) : u; + return (u > 0x7FFFFFFFUL) ? -static_cast(~u+1) : static_cast(u); } ACE_CDR::LongLong ju_ll(ACE_CDR::ULongLong u) { return (u > 0x7FFFFFFFFFFFFFFFULL) - ? -static_cast(~u+1) : u; + ? -static_cast(~u+1) : static_cast(u); } string unicode_escape(int in, bool char_literal = false) @@ -398,8 +398,8 @@ string unicode_escape(int in, bool char_literal = false) // Java uses a UTF-16 Surrogate Pair to represent larger characters, with // each surrogate represented as its own \uXXXX escape in the source code. - const unsigned int lead = 0xd7c0 + (in >> 10); - const unsigned int trail = 0xdc0 + (in & 0x3ff); + const unsigned int lead = 0xd7c0 + static_cast(in >> 10); + const unsigned int trail = 0xdc0 + static_cast(in & 0x3ff); string escaped(13, '\0'); ACE_OS::snprintf(&escaped[0], escaped.size(), "\\u%04x\\u%04x", lead, trail); return escaped; diff --git a/java/idl2jni/codegen/im_jni.cpp b/java/idl2jni/codegen/im_jni.cpp index 559e2c61a69..9114e4a4997 100644 --- a/java/idl2jni/codegen/im_jni.cpp +++ b/java/idl2jni/codegen/im_jni.cpp @@ -1775,7 +1775,6 @@ bool idl_mapping_jni::gen_union(UTL_ScopedName *name, for (unsigned long j = 0; j < n_labels; ++j) { AST_UnionLabel *ul = branches[i]->label(j); - ostringstream oss; if (ul->label_kind() == AST_UnionLabel::UL_default) { hasDefault = true; diff --git a/performance-tests/DCPS/SimpleLatency/raw_tcp/common/TestData.h b/performance-tests/DCPS/SimpleLatency/raw_tcp/common/TestData.h index f381919a90c..edded3b8b0d 100644 --- a/performance-tests/DCPS/SimpleLatency/raw_tcp/common/TestData.h +++ b/performance-tests/DCPS/SimpleLatency/raw_tcp/common/TestData.h @@ -30,11 +30,11 @@ namespace TestData struct Packet { Header header_; - ElemType payload_[1 << DATA_SIZE]; + ElemType payload_[1u << DATA_SIZE]; Packet() { - header_.payload_size_ = (1 << DATA_SIZE) * sizeof(ElemType); + header_.payload_size_ = (1u << DATA_SIZE) * sizeof(ElemType); ACE_OS::memset(payload_, 0, header_.payload_size_); } }; diff --git a/performance-tests/DCPS/SimpleLatency/raw_tcp/publisher/TcpPublisher.cpp b/performance-tests/DCPS/SimpleLatency/raw_tcp/publisher/TcpPublisher.cpp index ba491be8230..324fdb9ef63 100644 --- a/performance-tests/DCPS/SimpleLatency/raw_tcp/publisher/TcpPublisher.cpp +++ b/performance-tests/DCPS/SimpleLatency/raw_tcp/publisher/TcpPublisher.cpp @@ -34,7 +34,7 @@ add_stats ( cout << static_cast (ACE_UINT64_DBLCAST_ADAPTER (data)) << endl; - stats.average = (stats.count * stats.average + data)/(stats.count + 1); + stats.average = static_cast((stats.count * stats.average + data)/(stats.count + 1)); stats.min = (stats.count == 0 || data < stats.min) ? data : stats.min; stats.max = (stats.count == 0 || data > stats.max) ? data : stats.max; stats.sum = stats.sum + data; diff --git a/performance-tests/DCPS/SimpleLatency/raw_tcp/publisher/TestDriver.cpp b/performance-tests/DCPS/SimpleLatency/raw_tcp/publisher/TestDriver.cpp index 579a309aae0..487d74f69e9 100644 --- a/performance-tests/DCPS/SimpleLatency/raw_tcp/publisher/TestDriver.cpp +++ b/performance-tests/DCPS/SimpleLatency/raw_tcp/publisher/TestDriver.cpp @@ -86,7 +86,7 @@ TestDriver::parse_args(int& argc, ACE_TCHAR* argv[]) throw TestException(); } - num_packets_ = tmp; + num_packets_ = static_cast(tmp); } // The '-d' option else if ((current_arg = arg_shifter.get_the_parameter(ACE_TEXT("-d")))) { diff --git a/performance-tests/DCPS/SimpleLatency/raw_tcp/subscriber/TestDriver.cpp b/performance-tests/DCPS/SimpleLatency/raw_tcp/subscriber/TestDriver.cpp index 60d419c7792..65a04fa1eb7 100644 --- a/performance-tests/DCPS/SimpleLatency/raw_tcp/subscriber/TestDriver.cpp +++ b/performance-tests/DCPS/SimpleLatency/raw_tcp/subscriber/TestDriver.cpp @@ -88,7 +88,7 @@ TestDriver::parse_args(int& argc, ACE_TCHAR* argv[]) throw TestException(); } - num_packets_ = tmp; + num_packets_ = static_cast(tmp); } // The '-d' option else if ((current_arg = arg_shifter.get_the_parameter(ACE_TEXT("-d")))) { diff --git a/performance-tests/DCPS/Sync/SyncClient_i.cpp b/performance-tests/DCPS/Sync/SyncClient_i.cpp index 77ef5fce786..130d5418bce 100644 --- a/performance-tests/DCPS/Sync/SyncClient_i.cpp +++ b/performance-tests/DCPS/Sync/SyncClient_i.cpp @@ -15,7 +15,7 @@ SyncClient_i::SyncClient_i (const std::string& sync_server { // create new ORB int argc = 2; - char* argv[] = {(char*) "-ORBDebuglevel", (char*) "0"}; + char* argv[] = {const_cast("-ORBDebuglevel"), const_cast("0")}; orb_ = CORBA::ORB_init (argc, argv, "SyncClient"); if (CORBA::is_nil (orb_.in())) { throw InitError ("SyncClient_i::ctr> Orb init failed."); diff --git a/performance-tests/DCPS/TCPProfilingTest/raw_tcp/common/TestData.h b/performance-tests/DCPS/TCPProfilingTest/raw_tcp/common/TestData.h index f381919a90c..edded3b8b0d 100644 --- a/performance-tests/DCPS/TCPProfilingTest/raw_tcp/common/TestData.h +++ b/performance-tests/DCPS/TCPProfilingTest/raw_tcp/common/TestData.h @@ -30,11 +30,11 @@ namespace TestData struct Packet { Header header_; - ElemType payload_[1 << DATA_SIZE]; + ElemType payload_[1u << DATA_SIZE]; Packet() { - header_.payload_size_ = (1 << DATA_SIZE) * sizeof(ElemType); + header_.payload_size_ = (1u << DATA_SIZE) * sizeof(ElemType); ACE_OS::memset(payload_, 0, header_.payload_size_); } }; diff --git a/performance-tests/DCPS/TCPProfilingTest/raw_tcp/publisher/TestDriver.cpp b/performance-tests/DCPS/TCPProfilingTest/raw_tcp/publisher/TestDriver.cpp index 08f6c7bf8b0..c894d8368c2 100644 --- a/performance-tests/DCPS/TCPProfilingTest/raw_tcp/publisher/TestDriver.cpp +++ b/performance-tests/DCPS/TCPProfilingTest/raw_tcp/publisher/TestDriver.cpp @@ -83,7 +83,7 @@ TestDriver::parse_args(int& argc, ACE_TCHAR* argv[]) throw TestException(); } - num_packets_ = tmp; + num_packets_ = static_cast(tmp); } // The '-d' option else if ((current_arg = arg_shifter.get_the_parameter(ACE_TEXT("-d")))) { diff --git a/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TcpSubscriber.cpp b/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TcpSubscriber.cpp index 0c4ecb362c0..94c36a0fcec 100644 --- a/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TcpSubscriber.cpp +++ b/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TcpSubscriber.cpp @@ -112,12 +112,12 @@ TcpSubscriber::handle_input(ACE_HANDLE) // the remainder bytes, we need to move the remainder_ content // to the beginning of the underlying buffer - adjusting the // raw_block accordingly. - uintptr_t bytes_used = remainder_->wr_ptr() - remainder_->base(); + uintptr_t bytes_used = static_cast(remainder_->wr_ptr() - remainder_->base()); if (bytes_used > (TcpSubscriber::block_size_ / 2)) { raw_block->rd_ptr(raw_block->base()); raw_block->wr_ptr(raw_block->base()); raw_block->copy(remainder_->rd_ptr(), - remainder_->wr_ptr() - remainder_->rd_ptr()); + static_cast(remainder_->wr_ptr() - remainder_->rd_ptr())); } } } @@ -128,7 +128,7 @@ TcpSubscriber::handle_input(ACE_HANDLE) // We need to receive as many bytes as possible into the raw block. uintptr_t num_bytes_left = TcpSubscriber::block_size_ - - (raw_block->wr_ptr() - raw_block->base()); + static_cast(raw_block->wr_ptr() - raw_block->base()); ssize_t result; @@ -166,7 +166,7 @@ TcpSubscriber::handle_input(ACE_HANDLE) while (1) { // Check if a complete header exists in the the raw_block. // If not, we are done collecting pairs. - uintptr_t raw_size = raw_block->wr_ptr() - raw_block->rd_ptr(); + uintptr_t raw_size = static_cast(raw_block->wr_ptr() - raw_block->rd_ptr()); if (header_size > raw_size) { // We are done. diff --git a/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TestDriver.cpp b/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TestDriver.cpp index fe0e592b33b..982929fdabf 100644 --- a/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TestDriver.cpp +++ b/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TestDriver.cpp @@ -64,7 +64,7 @@ TestDriver::parse_args(int& argc, ACE_TCHAR* argv[]) throw TestException(); } - num_publishers_ = tmp; + num_publishers_ = static_cast(tmp); } // The '-n' option else if ((current_arg = arg_shifter.get_the_parameter(ACE_TEXT("-n")))) { @@ -78,7 +78,7 @@ TestDriver::parse_args(int& argc, ACE_TCHAR* argv[]) throw TestException(); } - num_packets_ = tmp; + num_packets_ = static_cast(tmp); } // The '-d' option else if ((current_arg = arg_shifter.get_the_parameter(ACE_TEXT("-d")))) { @@ -159,7 +159,7 @@ TestDriver::init() delete packet; // Init the stats - stats_.init(num_publishers_,num_packets_,data_size_,num_bytes_per_packet); + stats_.init(num_publishers_, num_packets_, static_cast(data_size_), num_bytes_per_packet); } diff --git a/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TestStats.h b/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TestStats.h index 9a7257eb265..2d9c87ae32d 100644 --- a/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TestStats.h +++ b/performance-tests/DCPS/TCPProfilingTest/raw_tcp/subscriber/TestStats.h @@ -74,7 +74,7 @@ class TestStats ACE_Message_Block* header_block = *itr; TestData::Header* header = (TestData::Header*)(header_block->rd_ptr()); - unsigned index = header->publisher_id_; + unsigned index = static_cast(header->publisher_id_); // Increment the appropriate publisher packet count. ++pub_stats_[index]; diff --git a/tests/DCPS/TcpReconnect/stub.cpp b/tests/DCPS/TcpReconnect/stub.cpp index a13e50928fb..b7d5759d63f 100644 --- a/tests/DCPS/TcpReconnect/stub.cpp +++ b/tests/DCPS/TcpReconnect/stub.cpp @@ -83,12 +83,12 @@ class Pub_Handler : public ACE_Svc_Handler ACE_DEBUG((LM_DEBUG, "stub(%P): Pub_Handler handle_input(), this=%@\n", this)); } iovec iov; - size_t result = this->peer ().recvv (&iov); + size_t result = static_cast(this->peer().recvv(&iov)); if (result > 0) { if (debug_level) { ACE_DEBUG ((LM_DEBUG, "stub(%P): read %d bytes from publisher\n", result)); } - size_t sent = sub_handler_->peer().sendv_n(&iov, 1); + size_t sent = static_cast(sub_handler_->peer().sendv_n(&iov, 1)); if (debug_level) { ACE_DEBUG ((LM_DEBUG, "stub(%P): wrote %d bytes to subscriber\n", sent)); } @@ -113,12 +113,12 @@ class Pub_Handler : public ACE_Svc_Handler int Sub_Handler::handle_input (ACE_HANDLE fd) { ACE_DEBUG((LM_DEBUG, "stub(%P): Sub_Handler handle_input(), this=%@\n", this)); iovec iov; - size_t result = this->peer ().recvv (&iov); + size_t result = static_cast(this->peer().recvv(&iov)); if (result > 0) { if (debug_level) { ACE_DEBUG ((LM_DEBUG, "stub(%P): read %d bytes from subscriber\n", result)); } - size_t sent = pub_handler_->peer().sendv_n(&iov, 1); + size_t sent = static_cast(pub_handler_->peer().sendv_n(&iov, 1)); if (debug_level) { ACE_DEBUG ((LM_DEBUG, "stub(%P): wrote %d bytes to publisher\n", sent)); }