nexusformat / code

NeXus API code and helper applications
GNU Lesser General Public License v2.1
12 stars 16 forks source link

Eliminate warnings (errors?) on Windows #445

Closed MarkRivers closed 7 years ago

MarkRivers commented 7 years ago

I changed the code to avoid copying hid_t values to int (since they don't fit), and remove some other warnings on Windows.

diff --git a/supportApp/nexusSrc/napi5.c b/supportApp/nexusSrc/napi5.c
index fd4a132..9624042 100644
--- a/supportApp/nexusSrc/napi5.c
+++ b/supportApp/nexusSrc/napi5.c
@@ -1067,7 +1067,7 @@ static hid_t getAttVID(pNexusFile5 pFile)
 }

 /*---------------------------------------------------------------*/
-static void killAttVID(pNexusFile5 pFile, int vid)
+static void killAttVID(pNexusFile5 pFile, hid_t vid)
 {
        if (pFile->iCurrentG == 0 && pFile->iCurrentD == 0) {
                H5Gclose(vid);
@@ -1082,8 +1082,7 @@ NXstatus NX5putattr(NXhandle fid, CONSTCHAR * name, const void *data,
        pNexusFile5 pFile;
        hid_t attr1, aid1, aid2;
        hid_t type;
-    hid_t attr_id;
-       herr_t iRet;
+       herr_t iRet;
        hid_t vid, attRet;

        pFile = NXI5assert(fid);
@@ -2173,7 +2172,7 @@ NXstatus NX5getattr(NXhandle fid, const char *name,
 NXstatus NX5getattrinfo(NXhandle fid, int *iN)
 {
        pNexusFile5 pFile;
-       hid_t idx;
+       int idx;
        hid_t vid;
        H5O_info_t oinfo;

@@ -2184,7 +2183,7 @@ NXstatus NX5getattrinfo(NXhandle fid, int *iN)
        vid = getAttVID(pFile);

        H5Oget_info(vid, &oinfo);
-       idx = (hid_t) oinfo.num_attrs;
+       idx = oinfo.num_attrs;
        if (idx > 0) {
                if (pFile->iCurrentG > 0 && pFile->iCurrentD == 0) {
                        *iN = idx - 1;
zjttoefs commented 7 years ago

Looks like there are a few more warnings to get rid of. Thanks for fixing these Mark!