iT2D 1.5 - FileObject has confusing API
by Tim Newell · in iTorque 2D · 12/12/2011 (11:44 am) · 0 replies
Build:1.5, 1.4, T3D 1.2, and im guessing all versions of torque
Platform: All
Target: Any
Issue: The C++ API for FileObject has openForRead, openForWrite, and readMemory. yet openForRead just throws an assert and readMemory does the real work that openForRead should do. You write using openForWrite. The Torquescript function openForRead actually calls readMemory in the C++ source code. So its confusing to call ReadMemory to read (you wont get a compile error since openForRead exists but is an assert stub) and using openForWrite to write.
Step to Reproduce:
1) Look at source code
Suggested Fix: put the body of readMemory into openForRead and either delete readMemory or change it so that it takes a unsigned char* of data as if you already loaded the file contents into memory as the name suggests.
Platform: All
Target: Any
Issue: The C++ API for FileObject has openForRead, openForWrite, and readMemory. yet openForRead just throws an assert and readMemory does the real work that openForRead should do. You write using openForWrite. The Torquescript function openForRead actually calls readMemory in the C++ source code. So its confusing to call ReadMemory to read (you wont get a compile error since openForRead exists but is an assert stub) and using openForWrite to write.
Step to Reproduce:
1) Look at source code
Suggested Fix: put the body of readMemory into openForRead and either delete readMemory or change it so that it takes a unsigned char* of data as if you already loaded the file contents into memory as the name suggests.