From 3be10052c8ca3574fe2ee3adc0367fa2e495dbac Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Tue, 4 Jun 2024 12:38:46 -0500 Subject: [PATCH] Add missing include, No null from create_sample --- dds/DCPS/TypeSupportImpl.h | 1 + dds/idl/ts_generator.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dds/DCPS/TypeSupportImpl.h b/dds/DCPS/TypeSupportImpl.h index aa15ca429fc..2babcc37b77 100644 --- a/dds/DCPS/TypeSupportImpl.h +++ b/dds/DCPS/TypeSupportImpl.h @@ -7,6 +7,7 @@ #define OPENDDS_DCPS_TYPESUPPORTIMPL_H #include "dcps_export.h" +#include "debug.h" #include "Definitions.h" #include "LocalObject.h" #include "Serializer.h" diff --git a/dds/idl/ts_generator.cpp b/dds/idl/ts_generator.cpp index 392db6a7b46..1bdbd1544e7 100644 --- a/dds/idl/ts_generator.cpp +++ b/dds/idl/ts_generator.cpp @@ -333,18 +333,18 @@ bool ts_generator::generate_ts(AST_Type* node, UTL_ScopedName* name) if (op_ret_is_ptr) { be_global->impl_ << " " << short_cxx_name << "* value = new " << short_cxx_name << ";\n" - " if (" << ts_base << "::create_sample_rc(src, *value) == ::DDS::RETCODE_OK) {\n" - " return value;\n" - " }\n" - " delete value;\n" - " return 0;\n"; + " const ::DDS::ReturnCode_t rc = " << ts_base << "::create_sample_rc(src, *value);\n"; } else { be_global->impl_ << " " << short_cxx_name << " value;\n" - " " << ts_base << "::create_sample_rc(src, value);\n" - " return value;\n"; + " const ::DDS::ReturnCode_t rc = " << ts_base << "::create_sample_rc(src, value);\n"; } be_global->impl_ << + " if (rc != DDS::RETCODE_OK && OpenDDS::DCPS::log_level >= OpenDDS::DCPS::LogLevel::Warning) {\n" + " ACE_ERROR((LM_WARNING, \"(%P|%t) WARNING: " << short_tsi_name << "::create_sample: \"\n" + " \"create_sample_rc failed: %C\\n\", OpenDDS::DCPS::retcode_to_string(rc)));\n" + " }\n" + " return value;\n" "}\n" "#endif\n" "\n"