Optimized file reading to buffer

Optimized the code that reads the file to the buffer as suggested by
@jamesu
This commit is contained in:
Nathan Bowhay 2015-02-12 12:07:55 -08:00
parent 0a76809092
commit 0915a642a5

View file

@ -416,11 +416,7 @@ bool TCPObject::sendFile(const char* fileName)
//Read each byte into our buffer
Vector<U8> buffer(readFile.getStreamSize());
U8 byte;
while(readFile.read(&byte))
{
buffer.push_back(byte);
}
readFile.read(buffer.size(), &buffer);
//Send the buffer
send(buffer.address(), buffer.size());