Core/File: Fix compilation

Former-commit-id: 69d173fe734dde3d0ca0f008826addce0d5d50bf
This commit is contained in:
Lynix 2015-11-19 12:18:27 +01:00
parent 3fb9e57360
commit 6eada337b8
3 changed files with 4 additions and 5 deletions

View File

@ -68,7 +68,6 @@ namespace Nz
bool SetCursorPos(CursorPosition pos, Int64 offset = 0); bool SetCursorPos(CursorPosition pos, Int64 offset = 0);
bool SetCursorPos(UInt64 offset) override; bool SetCursorPos(UInt64 offset) override;
void SetEndianness(Endianness endianness);
bool SetFile(const String& filePath); bool SetFile(const String& filePath);
using OutputStream::Write; using OutputStream::Write;

View File

@ -561,8 +561,8 @@ namespace Nz
char buffer[NAZARA_CORE_FILE_BUFFERSIZE]; char buffer[NAZARA_CORE_FILE_BUFFERSIZE];
while (remainingSize > 0) while (remainingSize > 0)
{ {
unsigned int size = static_cast<unsigned int>(std::min(remainingSize, static_cast<UInt64>(NAZARA_CORE_FILE_BUFFERSIZE))); std::size_t size = std::min<std::size_t>(static_cast<std::size_t>(remainingSize), NAZARA_CORE_FILE_BUFFERSIZE);
if (file.Read(&buffer[0], sizeof(char), size) != sizeof(char)*size) if (file.Read(&buffer[0], size) != size)
{ {
NazaraError("Unable to read file"); NazaraError("Unable to read file");
return false; return false;

View File

@ -17,7 +17,7 @@ SCENARIO("File", "[CORE][FILE]")
Nz::ByteArray byteArray(message, 11); Nz::ByteArray byteArray(message, 11);
file.Write("Test String"); file.Write("Test String");
file.Write(byteArray); file.Write(byteArray);
file.Write(message, sizeof(char), 11); file.Write(message, 11);
} }
AND_THEN("We can retrieve 3 times 'Test String'") AND_THEN("We can retrieve 3 times 'Test String'")
@ -27,7 +27,7 @@ SCENARIO("File", "[CORE][FILE]")
message[11] = '\0'; message[11] = '\0';
REQUIRE(Nz::String(message) == "Test String"); REQUIRE(Nz::String(message) == "Test String");
REQUIRE(file.Read(message, sizeof(char), 11) == 11); REQUIRE(file.Read(message, 11) == 11);
message[11] = '\0'; message[11] = '\0';
REQUIRE(Nz::String(message) == "Test String"); REQUIRE(Nz::String(message) == "Test String");
} }