MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / xnOSLoadFile

Function xnOSLoadFile

Source/OpenNI/XnOS.cpp:122–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122XN_C_API XnStatus xnOSLoadFile(const XnChar* cpFileName, void* pBuffer, const XnUInt32 nBufferSize)
123{
124 // Local function variables
125 XN_FILE_HANDLE FileHandle;
126 XnUInt32 nReadBytes = nBufferSize;
127 XnStatus nRetVal = XN_STATUS_OK;
128
129 // Validate the input/output pointers (to make sure none of them is NULL)
130 XN_VALIDATE_INPUT_PTR(cpFileName);
131 XN_VALIDATE_OUTPUT_PTR(pBuffer);
132
133 if (nBufferSize == 0)
134 {
135 return XN_STATUS_NULL_OUTPUT_PTR;
136 }
137
138 nRetVal = xnOSOpenFile(cpFileName, XN_OS_FILE_READ, &FileHandle);
139 XN_IS_STATUS_OK(nRetVal);
140
141 nRetVal = xnOSReadFile(FileHandle, pBuffer, &nReadBytes);
142 if ((nRetVal != XN_STATUS_OK) || (nReadBytes != nBufferSize))
143 {
144 xnOSCloseFile(&FileHandle);
145 return (XN_STATUS_OS_FILE_READ_FAILED);
146 }
147
148 nRetVal = xnOSCloseFile(&FileHandle);
149 XN_IS_STATUS_OK(nRetVal);
150
151 // All is good...
152 return (XN_STATUS_OK);
153}
154
155XN_C_API XnStatus xnOSSaveFile(const XnChar* cpFileName, const void* pBuffer, const XnUInt32 nBufferSize)
156{

Callers 3

FindEntryFunction · 0.85
FindEntryFunction · 0.85
drawInitFunction · 0.85

Calls 3

xnOSOpenFileFunction · 0.50
xnOSReadFileFunction · 0.50
xnOSCloseFileFunction · 0.50

Tested by

no test coverage detected