Skip to content

Commit da2160f

Browse files
authored
Merge pull request #4135 from mitza-oci/typesupport-data-conversions
Fixed warnings in FooTypeSupportImpl::encode_to_bytes
2 parents fa417f8 + 5ca9058 commit da2160f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

dds/idl/ts_generator.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,16 @@ bool ts_generator::generate_ts(AST_Decl* node, UTL_ScopedName* name)
413413
" if (jrf) {\n"
414414
" CORBA::String_var buffer;\n"
415415
" const ::DDS::ReturnCode_t ret = encode_to_string(in, buffer, format);\n"
416-
" const ::DDS::UInt32 len = static_cast< ::DDS::UInt32>(std::strlen(buffer));\n"
417-
" out = new ::DDS::OctetSeq(len);\n"
418-
" out->length(len);\n"
419-
" std::memcpy(out->get_buffer(), buffer, len);\n"
420-
" return ::DDS::RETCODE_OK;\n"
416+
" if (ret == ::DDS::RETCODE_OK) {\n"
417+
" const ::DDS::UInt32 len = static_cast< ::DDS::UInt32>(std::strlen(buffer));\n"
418+
" out = new ::DDS::OctetSeq(len);\n"
419+
" out->length(len);\n"
420+
" std::memcpy(out->get_buffer(), buffer, len);\n"
421+
" return ::DDS::RETCODE_OK;\n"
422+
" } else {\n"
423+
" out = new ::DDS::OctetSeq();\n"
424+
" return ret;\n"
425+
" }\n"
421426
" }\n"
422427
"#else\n"
423428
" ACE_UNUSED_ARG(in);\n"

0 commit comments

Comments
 (0)