1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Update Script.cpp

This commit is contained in:
Sandu Liviu Catalin 2021-02-01 00:22:28 +02:00
parent 66599b5df3
commit a09948770f

View File

@ -95,7 +95,12 @@ void ScriptSrc::Process()
// Go back to the beginning // Go back to the beginning
std::fseek(fp, 0, SEEK_SET); std::fseek(fp, 0, SEEK_SET);
// Read the file contents into allocated data // Read the file contents into allocated data
std::fread(&mData[0], 1, static_cast< size_t >(length), fp); size_t r = std::fread(&mData[0], 1, static_cast< size_t >(length), fp);
// Read completely?
if (r != static_cast< size_t >(length))
{
return SqThrowF("Failed to read script contents."); // Not cool
}
// Where the last line ended // Where the last line ended
size_t line_start = 0, line_end = 0; size_t line_start = 0, line_end = 0;
// Process the file data and locate new lines // Process the file data and locate new lines