mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Optimized file reading to buffer
Optimized the code that reads the file to the buffer as suggested by @jamesu
This commit is contained in:
parent
0a76809092
commit
0915a642a5
1 changed files with 1 additions and 5 deletions
|
|
@ -416,11 +416,7 @@ bool TCPObject::sendFile(const char* fileName)
|
||||||
|
|
||||||
//Read each byte into our buffer
|
//Read each byte into our buffer
|
||||||
Vector<U8> buffer(readFile.getStreamSize());
|
Vector<U8> buffer(readFile.getStreamSize());
|
||||||
U8 byte;
|
readFile.read(buffer.size(), &buffer);
|
||||||
while(readFile.read(&byte))
|
|
||||||
{
|
|
||||||
buffer.push_back(byte);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Send the buffer
|
//Send the buffer
|
||||||
send(buffer.address(), buffer.size());
|
send(buffer.address(), buffer.size());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue