Uint16 ReadFile::readULE16() { Uint16 val; if(!PHYSFS_readULE16(file, &val)) throw Exception("read error: %s", PHYSFS_getLastError()); return val; }
static inline uint16_t read16LE(PHYSFS_file* file) { uint16_t result; if(PHYSFS_readULE16(file, &result) == 0) throw SoundError("file too short"); return result; }
uint16 FileStream::getU16() { uint16 v = 0; if(!m_caching) { if(PHYSFS_readULE16(m_fileHandle, &v) == 0) throwError("read failed", true); } else { if(m_pos+2 > m_data.size()) throwError("read failed"); v = stdext::readLE16(&m_data[m_pos]); m_pos += 2; } return v; }