mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-19 16:39:57 +01:00
Core/Misc: Don't use tellg() to estimate file sizes
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "Log.h"
|
||||
#include "M2Structure.h"
|
||||
#include "Timer.h"
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <G3D/Vector4.h>
|
||||
#include <fstream>
|
||||
@@ -191,8 +192,7 @@ TC_GAME_API void LoadM2Cameras(std::string const& dataPath)
|
||||
continue;
|
||||
|
||||
// Get file size
|
||||
m2file.seekg(0, std::ios::end);
|
||||
std::streamoff fileSize = m2file.tellg();
|
||||
std::streamoff fileSize = boost::filesystem::file_size(filename);
|
||||
|
||||
// Reject if not at least the size of the header
|
||||
if (static_cast<uint32>(fileSize) < sizeof(M2Header) + 4)
|
||||
@@ -203,7 +203,6 @@ TC_GAME_API void LoadM2Cameras(std::string const& dataPath)
|
||||
}
|
||||
|
||||
// Read 4 bytes (signature)
|
||||
m2file.seekg(0, std::ios::beg);
|
||||
char fileCheck[5];
|
||||
m2file.read(fileCheck, 4);
|
||||
fileCheck[4] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user