Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions src/napi4.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ static int findNapiClass(pNexusFile pFile, int groupRef, NXname nxclass)
int32 tags[2], attID, linkID, groupID;

groupID = Vattach(pFile->iVID,groupRef,"r");
Vgetclass(groupID, classText);
size_t classBufSize = sizeof(classText);
Vgetclass(groupID, classText, &classBufSize);
if(strcmp(classText,"NAPIlink") != 0)
{
/* normal group */
Expand All @@ -93,7 +94,8 @@ static int findNapiClass(pNexusFile pFile, int groupRef, NXname nxclass)
{
Vgetattr(groupID,attID, tags);
linkID = Vattach(pFile->iVID,tags[1],"r");
Vgetclass(linkID, linkClass);
size_t linkClassBufSize = sizeof(linkClass);
Vgetclass(linkID, linkClass, &linkClassBufSize);
Vdetach(groupID);
Vdetach(linkID);
strcpy(nxclass,linkClass);
Expand Down Expand Up @@ -135,7 +137,8 @@ static int findNapiClass(pNexusFile pFile, int groupRef, NXname nxclass)
/* loop and check */
for (i = 0; i < iN; i++) {
iNew = Vattach (pFile->iVID, pArray[i], "r");
Vgetname (iNew, pText);
size_t bufSize = sizeof(pText);
Vgetname (iNew, pText, &bufSize);
Vdetach(iNew);
if (strcmp (pText, name) == 0) {
pArray[i] = findNapiClass(pFile,pArray[i],pText);
Expand All @@ -156,7 +159,8 @@ static int findNapiClass(pNexusFile pFile, int groupRef, NXname nxclass)
Vgettagref (pFile->iCurrentVG, i, &iTag, &iRef);
if (iTag == DFTAG_VG) {
iNew = Vattach (pFile->iVID, iRef, "r");
Vgetname (iNew, pText);
size_t bufSize = sizeof(pText);
Vgetname (iNew, pText, &bufSize);
Vdetach(iNew);
if (strcmp (pText, name) == 0) {
iRef = findNapiClass(pFile,iRef, pText);
Expand Down Expand Up @@ -351,7 +355,8 @@ static int findNapiClass(pNexusFile pFile, int groupRef, NXname nxclass)
groupID = Vattach(pFile->iVID,pFile->iStack[i].iVref, "r");
if (groupID != -1)
{
if (Vgetname(groupID, pText) != -1) {
size_t bufSize = sizeof(pText);
if (Vgetname(groupID, pText, &bufSize) != -1) {
strncat(buffer,pText,bufLen-strlen(buffer));
} else {
NXReportError( "ERROR: NXIbuildPath cannot get vgroup name");
Expand Down Expand Up @@ -1527,7 +1532,8 @@ static int findNapiClass(pNexusFile pFile, int groupRef, NXname nxclass)
NXReportError( "ERROR: HDF cannot attach to Vgroup");
return NX_ERROR;
}
Vgetname (iTemp, name);
size_t bufSize = sizeof(NXname);
Vgetname (iTemp, name, &bufSize);
Vdetach (iTemp);
findNapiClass(pFile, pFile->iStack[pFile->iStackPtr].iRefDir[iCurDir], nxclass);
*datatype = DFTAG_VG;
Expand All @@ -1541,7 +1547,8 @@ static int findNapiClass(pNexusFile pFile, int groupRef, NXname nxclass)
NXReportError( "ERROR: HDF cannot attach to Vgroup");
return NX_ERROR;
}
Vgetname (iTemp, name);
size_t bufSize = sizeof(NXname);
Vgetname (iTemp, name, &bufSize);
Vdetach(iTemp);
findNapiClass(pFile, pFile->iStack[pFile->iStackPtr].iRefDir[iCurDir], nxclass);
*datatype = DFTAG_VG;
Expand Down Expand Up @@ -1908,8 +1915,10 @@ static int findNapiClass(pNexusFile pFile, int groupRef, NXname nxclass)
}
else {
*iN = Vntagrefs (pFile->iCurrentVG);
Vgetname (pFile->iCurrentVG, pName);
Vgetclass (pFile->iCurrentVG, pClass);
size_t bufSize = sizeof(NXname);
Vgetname (pFile->iCurrentVG, pName, &bufSize);
bufSize = sizeof(NXname);
Vgetclass (pFile->iCurrentVG, pClass, &bufSize);
}
return NX_OK;
}
Expand Down
5 changes: 3 additions & 2 deletions test/napi_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ int main (int argc, char *argv[])
int unlimited_dims[1] = {NX_UNLIMITED};
int chunk_size[2]={5,4};
int slab_start[2], slab_size[2];
char name[64], char_class[64], char_buffer[128];
char group_name[64], class_name[64];
NXname name, char_class;
char char_buffer[128];
NXname group_name, class_name;
char c1_array[5][4] = {{'a', 'b', 'c' ,'d'}, {'e', 'f', 'g' ,'h'},
{'i', 'j', 'k', 'l'}, {'m', 'n', 'o', 'p'}, {'q', 'r', 's' , 't'}};
int unlimited_cdims[2] = {NX_UNLIMITED, 4};
Expand Down