瀏覽代碼

Optimized file reading to buffer

Optimized the code that reads the file to the buffer as suggested by
@jamesu
Nathan Bowhay 10 年之前
父節點
當前提交
0915a642a5
共有 1 個文件被更改,包括 1 次插入5 次删除
  1. 1 5
      Engine/source/app/net/tcpObject.cpp

+ 1 - 5
Engine/source/app/net/tcpObject.cpp

@@ -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());