From 0915a642a5f96d6076047aa7e2243ea9a4bccb5f Mon Sep 17 00:00:00 2001 From: Nathan Bowhay Date: Thu, 12 Feb 2015 12:07:55 -0800 Subject: [PATCH] Optimized file reading to buffer Optimized the code that reads the file to the buffer as suggested by @jamesu --- Engine/source/app/net/tcpObject.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Engine/source/app/net/tcpObject.cpp b/Engine/source/app/net/tcpObject.cpp index 28e91ba45..ac21cd43b 100644 --- a/Engine/source/app/net/tcpObject.cpp +++ b/Engine/source/app/net/tcpObject.cpp @@ -416,11 +416,7 @@ bool TCPObject::sendFile(const char* fileName) //Read each byte into our buffer Vector 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());