more initial work on fileIOPlugin

This commit is contained in:
erwincoumans
2018-10-11 17:00:17 -07:00
parent a24c1436af
commit ad10da57c5

View File

@@ -88,15 +88,16 @@ struct WrapperFileIO : public CommonFileIOInterface
{ {
//find an available wrapperFileHandle slot //find an available wrapperFileHandle slot
int wrapperFileHandle=-1; int wrapperFileHandle=-1;
int slot = -1;
for (int i=0;i<B3_MAX_FILEIO_INTERFACES;i++) for (int i=0;i<B3_MAX_FILEIO_INTERFACES;i++)
{ {
if (m_wrapperFileHandles[i].childFileIO==0) if (m_wrapperFileHandles[i].childFileIO==0)
{ {
wrapperFileHandle=i; slot=i;
break; break;
} }
} }
if (wrapperFileHandle>=0) if (slot>=0)
{ {
//figure out what wrapper interface to use //figure out what wrapper interface to use
//use the first one that can open the file //use the first one that can open the file
@@ -108,8 +109,9 @@ struct WrapperFileIO : public CommonFileIOInterface
int childHandle = childFileIO->fileOpen(fileName, mode); int childHandle = childFileIO->fileOpen(fileName, mode);
if (childHandle>=0) if (childHandle>=0)
{ {
m_wrapperFileHandles[wrapperFileHandle].childFileIO = childFileIO; wrapperFileHandle = slot;
m_wrapperFileHandles[wrapperFileHandle].m_childFileHandle = childHandle; m_wrapperFileHandles[slot].childFileIO = childFileIO;
m_wrapperFileHandles[slot].m_childFileHandle = childHandle;
break; break;
} }
} }