From 5f17eea9cdda27b6d5e56359f4cc540cb5bb57d9 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 31 Mar 2014 00:27:17 -0500 Subject: [svn-r24929] Description: Added proper deallocation/allocation to test. Revised incorrect comments. Platforms tested: Linux/ppc64 (ostrich) Linux/32 2.6 (jam) SunOS 5.11 (emu) --- c++/src/H5DxferProp.cpp | 7 +++---- c++/test/tdspl.cpp | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 3379678..1e5c7b8 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -237,9 +237,8 @@ void DSetMemXferPropList::setDataTransform(const H5std_string& expression) const //-------------------------------------------------------------------------- ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const { - // If application does not pass in - // H5Pget_data_transform will get buf_size characters of the expression including - // the null terminator + // H5Pget_data_transform will get buf_size characters of the expression + // including the null terminator ssize_t exp_len; exp_len = H5Pget_data_transform(id, exp, buf_size); @@ -254,7 +253,7 @@ ssize_t DSetMemXferPropList::getDataTransform(char* exp, size_t buf_size) const // expression or at [buf_size-1] if the expression is at least the size // of the buffer. - // Return the actual comment length, which might be different from buf_size + // Return the expression length, which might be different from buf_size return(exp_len); } diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index 6364671..5944fb1 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -80,6 +80,7 @@ static void test_transfplist() dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len+1); verify_val((const char*)c_to_f_read, (const char*)c_to_f, "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); + HDfree(c_to_f_read); // // Read the expression of each of the prop lists and verify the read @@ -89,10 +90,12 @@ static void test_transfplist() // Get and verify the expression with: // ssize_t getDataTransform(char* exp, const size_t buf_size [default=0]) tran_len = dxpl_c_to_f.getDataTransform(NULL); + c_to_f_read = (char *)HDmalloc(tran_len+1); HDmemset(c_to_f_read, 0, tran_len+1); dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len+1); verify_val((const char*)c_to_f_read, (const char*)c_to_f, "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); + HDfree(c_to_f_read); // Get and verify the expression with: // H5std_string DSetMemXferPropList::getDataTransform() @@ -108,6 +111,7 @@ static void test_transfplist() dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len+1); verify_val((const char*)utrans_inv_read, (const char*)utrans_inv, "DSetMemXferPropList::getDataTransform", __LINE__, __FILE__); + HDfree(utrans_inv_read); PASSED(); } -- cgit v0.12