diff options
-rw-r--r-- | c++/test/ttypes.cpp | 7 | ||||
-rw-r--r-- | config/cmake/ConfigureChecks.cmake | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 5fc82a5..a244965 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -726,8 +726,11 @@ test_named() // It should be possible to define an attribute for the named type Attribute attr1 = itype.createAttribute("attr1", PredType::NATIVE_UCHAR, space); - for (i = 0; i < ds_size[0] * ds_size[1]; i++) - attr_data[0][i] = (int)i; /*tricky*/ + for (hsize_t i = 0; i < ds_size[0]; i++) { + for (hsize_t j = 0; j < ds_size[1]; j++) { + attr_data[i][j] = static_cast<unsigned>(i * ds_size[1] + j); + } + } attr1.write(PredType::NATIVE_UINT, attr_data); attr1.close(); diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 6983786..902ddd3 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -253,6 +253,7 @@ endif () # The provided CMake C macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- +set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR}) macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") message (VERBOSE "Detecting C ${FUNCTION_NAME}") @@ -330,7 +331,7 @@ set (PROG_SRC ) C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES) -file (READ "${CMAKE_BINARY_DIR}/pac_Cconftest.out" PROG_OUTPUT4) +file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_Cconftest.out" PROG_OUTPUT4) message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}") # dnl The output from the above program will be: |