summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/ttypes.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp
index b633740..7d0337d 100644
--- a/c++/test/ttypes.cpp
+++ b/c++/test/ttypes.cpp
@@ -656,7 +656,6 @@ static void
test_named()
{
static hsize_t ds_size[2] = {10, 20};
- hsize_t i;
unsigned attr_data[10][20];
DataType * ds_type = NULL;
@@ -726,8 +725,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] = (unsigned)(i * ds_size[1] + j);
+ }
+ }
attr1.write(PredType::NATIVE_UINT, attr_data);
attr1.close();