MCPcopy Create free account
hub / github.com/crownengine/crown / read

Method read

3rdparty/bx/src/file.cpp:139–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137 }
138
139 virtual int32_t read(void* _data, int32_t _size, Error* _err) override
140 {
141 BX_ASSERT(NULL != m_file, "Reader/Writer file is not open.");
142 BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
143
144 int32_t size = (int32_t)fread(_data, 1, _size, m_file);
145 if (size != _size)
146 {
147 if (0 != feof(m_file) )
148 {
149 BX_ERROR_SET(_err, kErrorReaderWriterEof, "FileReader: EOF.");
150 }
151 else if (0 != ferror(m_file) )
152 {
153 BX_ERROR_SET(_err, kErrorReaderWriterRead, "FileReader: read error.");
154 }
155
156 return size >= 0 ? size : 0;
157 }
158
159 return size;
160 }
161
162 private:
163 FILE* m_file;

Callers

nothing calls this directly

Calls 4

freadFunction · 0.85
feofFunction · 0.85
ferrorFunction · 0.85
readFunction · 0.70

Tested by

no test coverage detected