@@ -55,16 +55,16 @@ extern void *NXpData;
5555typedef struct __NexusFile5 {
5656 struct iStack5 {
5757 char irefn [1024 ];
58- int iVref ;
58+ hid_t iVref ;
5959 hsize_t iCurrentIDX ;
6060 } iStack5 [NXMAXSTACK ];
6161 struct iStack5 iAtt5 ;
62- int iFID ;
63- int iCurrentG ;
64- int iCurrentD ;
65- int iCurrentS ;
66- int iCurrentT ;
67- int iCurrentA ;
62+ hid_t iFID ;
63+ hid_t iCurrentG ;
64+ hid_t iCurrentD ;
65+ hid_t iCurrentS ;
66+ hid_t iCurrentT ;
67+ hid_t iCurrentA ;
6868 int iNX ;
6969 int iNXID ;
7070 int iStackPtr ;
@@ -489,14 +489,13 @@ NXstatus NX5makegroup(NXhandle fid, CONSTCHAR * name, CONSTCHAR * nxclass)
489489 } else {
490490 snprintf (pBuffer , 1023 , "/%s/%s" , pFile -> name_ref , name );
491491 }
492- iRet =
492+ iVID =
493493 H5Gcreate (pFile -> iFID , (const char * )pBuffer , H5P_DEFAULT ,
494494 H5P_DEFAULT , H5P_DEFAULT );
495- if (iRet < 0 ) {
495+ if (iVID < 0 ) {
496496 NXReportError ("ERROR: could not create Group" );
497497 return NX_ERROR ;
498498 }
499- iVID = iRet ;
500499 aid2 = H5Screate (H5S_SCALAR );
501500 aid1 = H5Tcopy (H5T_C_S1 );
502501 H5Tset_size (aid1 , strlen (nxclass ));
@@ -534,7 +533,7 @@ NXstatus NX5opengroup(NXhandle fid, CONSTCHAR * name, CONSTCHAR * nxclass)
534533{
535534
536535 pNexusFile5 pFile ;
537- hid_t attr1 , atype ;
536+ hid_t attr1 , atype , iVID ;
538537 herr_t iRet ;
539538 char pBuffer [1024 ];
540539 char data [128 ];
@@ -545,14 +544,14 @@ NXstatus NX5opengroup(NXhandle fid, CONSTCHAR * name, CONSTCHAR * nxclass)
545544 } else {
546545 sprintf (pBuffer , "%s/%s" , pFile -> name_tmp , name );
547546 }
548- iRet = H5Gopen (pFile -> iFID , (const char * )pBuffer , H5P_DEFAULT );
549- if (iRet < 0 ) {
547+ iVID = H5Gopen (pFile -> iFID , (const char * )pBuffer , H5P_DEFAULT );
548+ if (iVID < 0 ) {
550549 sprintf (pBuffer , "ERROR: group %s does not exist" ,
551550 pFile -> name_tmp );
552551 NXReportError (pBuffer );
553552 return NX_ERROR ;
554553 }
555- pFile -> iCurrentG = iRet ;
554+ pFile -> iCurrentG = iVID ;
556555 strcpy (pFile -> name_tmp , pBuffer );
557556 strcpy (pFile -> name_ref , pBuffer );
558557
@@ -711,7 +710,7 @@ NXstatus NX5compmakedata64(NXhandle fid, CONSTCHAR * name,
711710 int rank , int64_t dimensions [],
712711 int compress_type , int64_t chunk_size [])
713712{
714- hid_t datatype1 , dataspace , iNew ;
713+ hid_t datatype1 , dataspace , iNew , dID ;
715714 herr_t iRet ;
716715 hid_t type , cparms = -1 ;
717716 pNexusFile5 pFile ;
@@ -813,7 +812,7 @@ NXstatus NX5compmakedata64(NXhandle fid, CONSTCHAR * name,
813812 }
814813 H5Pset_shuffle (cparms ); // mrt: improves compression
815814 H5Pset_deflate (cparms , compress_level );
816- iRet = H5Dcreate (pFile -> iCurrentG , (char * )name , datatype1 ,
815+ dID = H5Dcreate (pFile -> iCurrentG , (char * )name , datatype1 ,
817816 dataspace , H5P_DEFAULT , cparms , H5P_DEFAULT );
818817 } else if (compress_type == NX_COMP_NONE ) {
819818 if (unlimiteddim ) {
@@ -824,12 +823,12 @@ NXstatus NX5compmakedata64(NXhandle fid, CONSTCHAR * name,
824823 ("ERROR: size of chunks could not be set" );
825824 return NX_ERROR ;
826825 }
827- iRet =
826+ dID =
828827 H5Dcreate (pFile -> iCurrentG , (char * )name , datatype1 ,
829828 dataspace , H5P_DEFAULT , cparms ,
830829 H5P_DEFAULT );
831830 } else {
832- iRet =
831+ dID =
833832 H5Dcreate (pFile -> iCurrentG , (char * )name , datatype1 ,
834833 dataspace , H5P_DEFAULT , H5P_DEFAULT ,
835834 H5P_DEFAULT );
@@ -841,7 +840,7 @@ NXstatus NX5compmakedata64(NXhandle fid, CONSTCHAR * name,
841840 NXReportError ("ERROR: size of chunks could not be set" );
842841 return NX_ERROR ;
843842 }
844- iRet = H5Dcreate (pFile -> iCurrentG , (char * )name , datatype1 ,
843+ dID = H5Dcreate (pFile -> iCurrentG , (char * )name , datatype1 ,
845844 dataspace , H5P_DEFAULT , cparms , H5P_DEFAULT );
846845
847846 } else {
@@ -851,11 +850,11 @@ NXstatus NX5compmakedata64(NXhandle fid, CONSTCHAR * name,
851850 H5Dcreate (pFile -> iCurrentG , (char * )name , datatype1 ,
852851 dataspace , H5P_DEFAULT , H5P_DEFAULT , H5P_DEFAULT );
853852 }
854- if (iRet < 0 ) {
853+ if (dID < 0 ) {
855854 NXReportError ("ERROR: creating chunked dataset failed" );
856855 return NX_ERROR ;
857856 } else {
858- pFile -> iCurrentD = iRet ;
857+ pFile -> iCurrentD = dID ;
859858 }
860859 if (unlimiteddim ) {
861860 iNew = H5Dset_extent (pFile -> iCurrentD , size );
@@ -1025,9 +1024,9 @@ NXstatus NX5putdata(NXhandle fid, const void *data)
10251024}
10261025
10271026/*------------------------------------------------------------------*/
1028- static int getAttVID (pNexusFile5 pFile )
1027+ static hid_t getAttVID (pNexusFile5 pFile )
10291028{
1030- int vid ;
1029+ hid_t vid ;
10311030 if (pFile -> iCurrentG == 0 && pFile -> iCurrentD == 0 ) {
10321031 /* global attribute */
10331032 vid = H5Gopen (pFile -> iFID , "/" , H5P_DEFAULT );
@@ -1058,17 +1057,17 @@ NXstatus NX5putattr(NXhandle fid, CONSTCHAR * name, const void *data,
10581057 hid_t attr1 , aid1 , aid2 ;
10591058 hid_t type ;
10601059 herr_t iRet ;
1061- int vid ;
1060+ hid_t vid , attRet ;
10621061
10631062 pFile = NXI5assert (fid );
10641063
10651064 type = nxToHDF5Type (iType );
10661065
10671066 /* determine vid */
10681067 vid = getAttVID (pFile );
1069- iRet = H5Aopen_by_name (vid , "." , name , H5P_DEFAULT , H5P_DEFAULT );
1070- if (iRet > 0 ) {
1071- H5Aclose (iRet );
1068+ attRet = H5Aopen_by_name (vid , "." , name , H5P_DEFAULT , H5P_DEFAULT );
1069+ if (attRet > 0 ) {
1070+ H5Aclose (attRet );
10721071 iRet = H5Adelete (vid , name );
10731072 if (iRet < 0 ) {
10741073 NXReportError
@@ -2089,7 +2088,8 @@ NXstatus NX5getattr(NXhandle fid, const char *name,
20892088 void * data , int * datalen , int * iType )
20902089{
20912090 pNexusFile5 pFile ;
2092- int iNew , vid , i ;
2091+ int i ;
2092+ hid_t vid , iNew ;
20932093 hsize_t ndims , dims [H5S_MAX_RANK ], totalsize ;
20942094 herr_t iRet ;
20952095 hid_t type , filespace ;
@@ -2147,7 +2147,7 @@ NXstatus NX5getattrinfo(NXhandle fid, int *iN)
21472147{
21482148 pNexusFile5 pFile ;
21492149 hid_t idx ;
2150- int vid ;
2150+ hid_t vid ;
21512151 H5O_info_t oinfo ;
21522152
21532153 pFile = NXI5assert (fid );
@@ -2350,7 +2350,8 @@ NXstatus NX5putattra(NXhandle handle, CONSTCHAR* name, const void* data, const
23502350 hid_t type , cparms = -1 ;
23512351 pNexusFile5 pFile ;
23522352 char pBuffer [256 ];
2353- int i , vid ;
2353+ int i ;
2354+ hid_t vid , iATT ;
23542355 herr_t iRet ;
23552356 hsize_t mydim [H5S_MAX_RANK ];
23562357
@@ -2362,9 +2363,9 @@ NXstatus NX5putattra(NXhandle handle, CONSTCHAR* name, const void* data, const
23622363
23632364 /* determine vid */
23642365 vid = getAttVID (pFile );
2365- iRet = H5Aopen_by_name (vid , "." , name , H5P_DEFAULT , H5P_DEFAULT );
2366- if (iRet > 0 ) {
2367- H5Aclose (iRet );
2366+ iATT = H5Aopen_by_name (vid , "." , name , H5P_DEFAULT , H5P_DEFAULT );
2367+ if (iATT > 0 ) {
2368+ H5Aclose (iATT );
23682369 iRet = H5Adelete (vid , name );
23692370 if (iRet < 0 ) {
23702371 NXReportError ("ERROR: old attribute cannot be removed! " );
@@ -2389,14 +2390,14 @@ NXstatus NX5putattra(NXhandle handle, CONSTCHAR* name, const void* data, const
23892390 dataspace = H5Screate_simple (rank , mydim , NULL );
23902391 }
23912392
2392- iRet = H5Acreate (vid , (char * )name , datatype1 ,
2393+ iATT = H5Acreate (vid , (char * )name , datatype1 ,
23932394 dataspace , H5P_DEFAULT , H5P_DEFAULT );
23942395
2395- if (iRet < 0 ) {
2396+ if (iATT < 0 ) {
23962397 NXReportError ("ERROR: creating attribute failed" );
23972398 return NX_ERROR ;
23982399 } else {
2399- pFile -> iCurrentA = iRet ;
2400+ pFile -> iCurrentA = iATT ;
24002401 }
24012402 if (cparms != -1 ) {
24022403 iRet = H5Pclose (cparms );
@@ -2427,7 +2428,7 @@ NXstatus NX5getnextattra(NXhandle handle, NXname pName, int *rank, int dim[], i
24272428 herr_t iRet ;
24282429 char * iname = NULL ;
24292430 hsize_t idx , intern_idx = -1 ;
2430- int vid ;
2431+ hid_t vid ;
24312432 H5O_info_t oinfo ;
24322433
24332434 pFile = NXI5assert (handle );
@@ -2483,7 +2484,8 @@ NXstatus NX5getnextattra(NXhandle handle, NXname pName, int *rank, int dim[], i
24832484NXstatus NX5getattra (NXhandle handle , const char * name , void * data )
24842485{
24852486 pNexusFile5 pFile ;
2486- int i , iStart [H5S_MAX_RANK ], status , vid ;
2487+ int i , iStart [H5S_MAX_RANK ], status ;
2488+ hid_t vid ;
24872489 hid_t memtype_id , filespace , datatype ;
24882490 H5T_class_t tclass ;
24892491 hsize_t ndims , dims [H5S_MAX_RANK ];
@@ -2565,7 +2567,8 @@ return NX_OK;
25652567NXstatus NX5getattrainfo (NXhandle handle , NXname name , int * rank , int dim [], int * iType )
25662568{
25672569 pNexusFile5 pFile ;
2568- int i , iRet , mType , vid ;
2570+ int i , iRet , mType ;
2571+ hid_t vid ;
25692572 hid_t filespace , attrt , memtype ;
25702573 hsize_t myDim [H5S_MAX_RANK ], myrank ;
25712574 H5T_class_t tclass ;
0 commit comments