diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/links.c | 8 | ||||
-rw-r--r-- | test/mount.c | 4 | ||||
-rw-r--r-- | test/mtime.c | 12 | ||||
-rwxr-xr-x | test/objcopy.c | 16 | ||||
-rw-r--r-- | test/stab.c | 20 | ||||
-rw-r--r-- | test/tattr.c | 14 | ||||
-rw-r--r-- | test/tmisc.c | 60 | ||||
-rw-r--r-- | test/unlink.c | 2 |
8 files changed, 69 insertions, 67 deletions
diff --git a/test/links.c b/test/links.c index 96ebbf4..3c47463 100644 --- a/test/links.c +++ b/test/links.c @@ -244,7 +244,7 @@ cklinks(hid_t fapl) printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); goto error; } - if (sb1.u.obj.objno!=sb2.u.obj.objno) { + if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); @@ -258,7 +258,7 @@ cklinks(hid_t fapl) printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); goto error; } - if (sb1.u.obj.objno!=sb2.u.obj.objno) { + if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { H5_FAILED(); puts(" Soft link test failed. Link seems not to point to the "); puts(" expected file location."); @@ -376,7 +376,7 @@ ck_new_links(hid_t fapl) printf(" %d: Unexpected object type should have been a dataset\n", __LINE__); goto error; } - if( sb_dset.u.obj.objno!=sb_hard1.u.obj.objno || sb_dset.u.obj.objno!=sb_hard2.u.obj.objno ) { + if(HDmemcmp(&sb_dset.objno, &sb_hard1.objno, sizeof(sb_dset.objno)) || HDmemcmp(&sb_dset.objno, &sb_hard2.objno, sizeof(sb_dset.objno))) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); @@ -394,7 +394,7 @@ ck_new_links(hid_t fapl) TEST_ERROR; } - if( sb_dset.u.obj.objno!=sb_soft1.u.obj.objno || sb_dset.u.obj.objno!=sb_soft2.u.obj.objno ) { + if(HDmemcmp(&sb_dset.objno, &sb_soft1.objno, sizeof(sb_dset.objno)) || HDmemcmp(&sb_dset.objno, &sb_soft2.objno, sizeof(sb_dset.objno))) { H5_FAILED(); puts(" Soft link test failed. Link seems not to point to the "); puts(" expected file location."); diff --git a/test/mount.c b/test/mount.c index d997bd9..0f748a8 100644 --- a/test/mount.c +++ b/test/mount.c @@ -293,7 +293,7 @@ test_hide(hid_t fapl) * other names. This is a rather stupid test but demonstrates a point. */ if (H5Gget_objinfo(file1, "/file1", TRUE, &sb2)<0) goto error; - if (sb1.fileno!=sb2.fileno || sb1.u.obj.objno!=sb2.u.obj.objno) { + if (HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) || HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { H5_FAILED(); puts(" Hard link failed for hidden object."); goto error; @@ -363,7 +363,7 @@ test_assoc(hid_t fapl) */ if(H5Gget_objinfo(file1, "/mnt1", TRUE, &sb2) < 0) TEST_ERROR - if(sb1.fileno != sb2.fileno || sb1.u.obj.objno != sb2.u.obj.objno) { + if(HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) || HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { H5_FAILED(); puts(" Association failed."); AT(); diff --git a/test/mtime.c b/test/mtime.c index 963ccb7..da2fe63 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -97,7 +97,7 @@ main(void) if (H5Fclose(file)<0) TEST_ERROR; /* Compare times from the two ways of calling H5Gget_objinfo() */ - if (sb1.u.obj.objno!=sb2.u.obj.objno || sb1.u.obj.mtime!=sb2.u.obj.mtime) { + if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno)) || sb1.mtime!=sb2.mtime) { H5_FAILED(); puts(" Calling H5Gget_objinfo() with the dataset ID returned"); puts(" different values than calling it with a file and dataset"); @@ -106,15 +106,15 @@ main(void) } /* Compare times -- they must be within 60 seconds of one another */ - if (0==sb1.u.obj.mtime) { + if (0==sb1.mtime) { SKIPPED(); puts(" The modification time could not be decoded on this OS."); puts(" Modification times will be mantained in the file but"); puts(" cannot be queried on this system. See H5O_mtime_decode()."); return 0; - } else if (fabs(HDdifftime(now, sb1.u.obj.mtime))>60.0) { + } else if (fabs(HDdifftime(now, sb1.mtime))>60.0) { H5_FAILED(); - tm = localtime(&(sb1.u.obj.mtime)); + tm = localtime(&(sb1.mtime)); strftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); tm = localtime(&now); strftime((char*)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm); @@ -140,7 +140,7 @@ main(void) if (file >= 0){ if(H5Gget_objinfo(file, "/Dataset1", TRUE, &sb1)<0) TEST_ERROR; - if(sb1.u.obj.mtime!=MTIME1) { + if(sb1.mtime!=MTIME1) { H5_FAILED(); /* If this fails, examine H5Omtime.c. Modification time is very * system dependant (e.g., on Windows DST must be hardcoded). */ @@ -175,7 +175,7 @@ main(void) if (file >= 0){ if(H5Gget_objinfo(file, "/Dataset1", TRUE, &sb2)<0) TEST_ERROR; - if(sb2.u.obj.mtime!=MTIME2) { + if(sb2.mtime!=MTIME2) { H5_FAILED(); puts(" Modification time incorrect."); goto error; diff --git a/test/objcopy.c b/test/objcopy.c index b19e5dd..9d77f57 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -108,7 +108,7 @@ addr_insert(H5G_stat_t *sb) /* Don't add it if the link count is 1 because such an object can only * be encountered once. */ - if(sb->u.obj.nlink < 2) + if(sb->nlink < 2) return; /* Extend the table */ @@ -119,7 +119,7 @@ addr_insert(H5G_stat_t *sb) /* Insert the entry */ n = idtab_g.nobjs++; - idtab_g.obj[n] = sb->u.obj.objno; + idtab_g.obj[n] = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long))); } /* end addr_insert() */ @@ -140,12 +140,14 @@ addr_insert(H5G_stat_t *sb) static hbool_t addr_lookup(H5G_stat_t *sb) { + haddr_t obj_addr; /* Object's address in the file */ size_t n; - if (sb->u.obj.nlink<2) return FALSE; /*only one link possible*/ + if (sb->nlink<2) return FALSE; /*only one link possible*/ + obj_addr = (haddr_t)sb->objno[0] | ((haddr_t)sb->objno[1] << (8 * sizeof(long))); for(n = 0; n < idtab_g.nobjs; n++) - if(idtab_g.obj[n] == sb->u.obj.objno) + if(idtab_g.obj[n] == obj_addr) return TRUE; return FALSE; } /* end addr_lookup() */ @@ -804,9 +806,9 @@ compare_groups(hid_t gid, hid_t gid2) if(H5Gget_objinfo(gid2, objname2, FALSE, &objstat2) < 0) TEST_ERROR; if(objstat.type != objstat2.type) TEST_ERROR; if(objstat.type != H5G_LINK) { - if(objstat.u.obj.nlink != objstat2.u.obj.nlink) TEST_ERROR; - if(objstat.u.obj.ohdr.nmesgs != objstat2.u.obj.ohdr.nmesgs) TEST_ERROR; - if(objstat.u.obj.ohdr.nchunks != objstat2.u.obj.ohdr.nchunks) TEST_ERROR; + if(objstat.nlink != objstat2.nlink) TEST_ERROR; + if(objstat.ohdr.nmesgs != objstat2.ohdr.nmesgs) TEST_ERROR; + if(objstat.ohdr.nchunks != objstat2.ohdr.nchunks) TEST_ERROR; } /* end if */ /* Check for object already having been compared */ diff --git a/test/stab.c b/test/stab.c index 4cf73d9..09a5438 100644 --- a/test/stab.c +++ b/test/stab.c @@ -380,13 +380,13 @@ lifecycle(hid_t fapl) /* Check that the object header is only one chunk and the space has been allocated correctly */ if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR; #ifdef H5_HAVE_LARGE_HSIZET - if(obj_stat.u.obj.ohdr.size != 232) TEST_ERROR; + if(obj_stat.ohdr.size != 232) TEST_ERROR; #else /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.u.obj.ohdr.size != 224) TEST_ERROR; + if(obj_stat.ohdr.size != 224) TEST_ERROR; #endif /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.u.obj.ohdr.free != 0) TEST_ERROR; - if(obj_stat.u.obj.ohdr.nmesgs != 6) TEST_ERROR; - if(obj_stat.u.obj.ohdr.nchunks != 1) TEST_ERROR; + if(obj_stat.ohdr.free != 0) TEST_ERROR; + if(obj_stat.ohdr.nmesgs != 6) TEST_ERROR; + if(obj_stat.ohdr.nchunks != 1) TEST_ERROR; /* Create one more "bottom" group, which should push top group into using a symbol table */ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); @@ -408,13 +408,13 @@ lifecycle(hid_t fapl) /* Check that the object header is still one chunk and the space has been allocated correctly */ if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR; #ifdef H5_HAVE_LARGE_HSIZET - if(obj_stat.u.obj.ohdr.size != 232) TEST_ERROR; + if(obj_stat.ohdr.size != 232) TEST_ERROR; #else /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.u.obj.ohdr.size != 224) TEST_ERROR; + if(obj_stat.ohdr.size != 224) TEST_ERROR; #endif /* H5_HAVE_LARGE_HSIZET */ - if(obj_stat.u.obj.ohdr.free != 136) TEST_ERROR; - if(obj_stat.u.obj.ohdr.nmesgs != 4) TEST_ERROR; - if(obj_stat.u.obj.ohdr.nchunks != 1) TEST_ERROR; + if(obj_stat.ohdr.free != 136) TEST_ERROR; + if(obj_stat.ohdr.nmesgs != 4) TEST_ERROR; + if(obj_stat.ohdr.nchunks != 1) TEST_ERROR; /* Unlink objects from top group */ while(u >= LIFECYCLE_MIN_DENSE) { diff --git a/test/tattr.c b/test/tattr.c index d7b0e58..5bb9947 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -1547,7 +1547,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 1, "H5Tcommit"); + VERIFY(statbuf.nlink, 1, "H5Tcommit"); /* Create dataspace for dataset */ space_id=H5Screate(H5S_SCALAR); @@ -1560,7 +1560,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 2, "H5Dcreate"); + VERIFY(statbuf.nlink, 2, "H5Dcreate"); /* Create attribute on dataset */ attr_id=H5Acreate(dset_id,ATTR1_NAME,type_id,space_id,H5P_DEFAULT); @@ -1569,7 +1569,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 3, "H5Acreate"); + VERIFY(statbuf.nlink, 3, "H5Acreate"); /* Close attribute */ ret=H5Aclose(attr_id); @@ -1582,7 +1582,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 2, "H5Adelete"); + VERIFY(statbuf.nlink, 2, "H5Adelete"); /* Create attribute on dataset */ attr_id=H5Acreate(dset_id,ATTR1_NAME,type_id,space_id,H5P_DEFAULT); @@ -1591,7 +1591,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 3, "H5Acreate"); + VERIFY(statbuf.nlink, 3, "H5Acreate"); /* Write data into the attribute */ ret=H5Awrite(attr_id,H5T_NATIVE_INT,&data); @@ -1645,7 +1645,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 3, "H5Aopen_name"); + VERIFY(statbuf.nlink, 3, "H5Aopen_name"); /* Unlink the dataset */ ret=H5Gunlink(file_id,DSET1_NAME); @@ -1654,7 +1654,7 @@ test_attr_dtype_shared(void) /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.nlink, 1, "H5Gunlink"); + VERIFY(statbuf.nlink, 1, "H5Gunlink"); /* Unlink the named datatype */ ret=H5Gunlink(file_id,TYPE1_NAME); diff --git a/test/tmisc.c b/test/tmisc.c index 90e20d2..c114048 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -623,12 +623,12 @@ test_misc4(void) CHECK(ret, FAIL, "H5Gget_objinfo"); /* Verify that the fileno values are the same for groups from file1 */ - VERIFY(stat1.fileno,stat2.fileno,"H5Gget_objinfo"); + VERIFY(stat1.fileno[0],stat2.fileno[0],"H5Gget_objinfo"); /* Verify that the fileno values are not the same between file1 & file2 */ - if(stat1.fileno==stat3.fileno) + if(stat1.fileno[0]==stat3.fileno[0]) TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); - if(stat2.fileno==stat3.fileno) + if(stat2.fileno[0]==stat3.fileno[0]) TestErrPrintf("Error on line %d: stat1.fileno==stat3.fileno\n",__LINE__); /* Close the objects */ @@ -2827,13 +2827,13 @@ test_misc18(void) /* Get object information */ ret = H5Gget_objinfo(fid,MISC18_DSET1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nmesgs, 6, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 1, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 272, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 6, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 1, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 272, "H5Gget_objinfo"); #ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.u.obj.ohdr.free, 152, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 152, "H5Gget_objinfo"); #else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.u.obj.ohdr.free, 160, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 160, "H5Gget_objinfo"); #endif /* H5_HAVE_LARGE_HSIZET */ /* Create second dataset */ @@ -2843,13 +2843,13 @@ test_misc18(void) /* Get object information */ ret = H5Gget_objinfo(fid,MISC18_DSET2_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nmesgs, 6, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 1, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 272, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 6, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 1, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 272, "H5Gget_objinfo"); #ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.u.obj.ohdr.free, 152, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 152, "H5Gget_objinfo"); #else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.u.obj.ohdr.free, 160, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 160, "H5Gget_objinfo"); #endif /* H5_HAVE_LARGE_HSIZET */ /* Loop creating attributes on each dataset, flushing them to the file each time */ @@ -2880,30 +2880,30 @@ test_misc18(void) ret = H5Gget_objinfo(fid,MISC18_DSET1_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); #ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.u.obj.ohdr.nmesgs, 28, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 944, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.free, 72, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 28, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 944, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 72, "H5Gget_objinfo"); #else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.u.obj.ohdr.nmesgs, 26, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 888, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.free, 24, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 26, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 888, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 24, "H5Gget_objinfo"); #endif /* H5_HAVE_LARGE_HSIZET */ /* Get object information for dataset #2 now */ ret = H5Gget_objinfo(fid,MISC18_DSET2_NAME,0,&statbuf); CHECK(ret, FAIL, "H5Gget_objinfo"); #ifdef H5_HAVE_LARGE_HSIZET - VERIFY(statbuf.u.obj.ohdr.nmesgs, 28, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 944, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.free, 72, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 28, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 944, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 72, "H5Gget_objinfo"); #else /* H5_HAVE_LARGE_HSIZET */ - VERIFY(statbuf.u.obj.ohdr.nmesgs, 26, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.nchunks, 9, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.size, 888, "H5Gget_objinfo"); - VERIFY(statbuf.u.obj.ohdr.free, 24, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nmesgs, 26, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.nchunks, 9, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.size, 888, "H5Gget_objinfo"); + VERIFY(statbuf.ohdr.free, 24, "H5Gget_objinfo"); #endif /* H5_HAVE_LARGE_HSIZET */ /* Close second dataset */ @@ -3843,7 +3843,7 @@ test_misc23(void) status = H5Gget_objinfo(tmp_id, ".", FALSE, &sb); CHECK(status, FAIL, "H5Gget_objinfo"); - VERIFY(sb.u.obj.nlink,1,"H5Gget_objinfo"); + VERIFY(sb.nlink,1,"H5Gget_objinfo"); status = H5Gclose(tmp_id); CHECK(status, FAIL, "H5Gclose"); diff --git a/test/unlink.c b/test/unlink.c index 5555dab..ee938d9 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -462,7 +462,7 @@ check_new_move(void) puts(" Unexpected object type, should have been a group"); goto error; } - if( sb_hard1.u.obj.objno!=sb_hard2.u.obj.objno) { + if (HDmemcmp(&sb_hard1.objno, &sb_hard2.objno, sizeof(sb_hard1.objno))) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); |