mirror of
https://github.com/love2d/love.git
synced 2026-08-18 03:34:23 +02:00
Fix some warnings
This commit is contained in:
@@ -139,6 +139,8 @@ namespace physfs
|
||||
int64 max = (int64)PHYSFS_fileLength(file);
|
||||
size = (size == ALL) ? max : size;
|
||||
size = (size > max) ? max : size;
|
||||
// Sadly, we'll have to clamp to 32 bits here
|
||||
size = (size > UINT32_MAX) ? UINT32_MAX : size;
|
||||
|
||||
int64 read = (int64)PHYSFS_read(file, dst, 1, size);
|
||||
|
||||
@@ -153,8 +155,11 @@ namespace physfs
|
||||
if (file == 0)
|
||||
throw love::Exception("Could not write to file. File not open.");
|
||||
|
||||
// Another clamp, for the time being.
|
||||
size = (size > UINT32_MAX) ? UINT32_MAX : size;
|
||||
|
||||
// Try to write.
|
||||
int written = static_cast<int64>(PHYSFS_write(file, data, 1, size));
|
||||
int64 written = static_cast<int64>(PHYSFS_write(file, data, 1, size));
|
||||
|
||||
// Check that correct amount of data was written.
|
||||
if (written != size)
|
||||
@@ -174,8 +179,8 @@ namespace physfs
|
||||
// It zigs, we zag.
|
||||
inline bool test_eof(File * that, PHYSFS_File *)
|
||||
{
|
||||
int pos = that->tell();
|
||||
int size = that->getSize();
|
||||
int64 pos = that->tell();
|
||||
int64 size = that->getSize();
|
||||
return pos == -1 || size == -1 || pos >= size;
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -481,14 +481,14 @@ namespace physfs
|
||||
|
||||
// Find the next newline.
|
||||
// pos must be at the start of the line we're trying to find.
|
||||
int pos = file->tell();
|
||||
int64 pos = file->tell();
|
||||
int newline = -1;
|
||||
int totalread = 0;
|
||||
|
||||
while (!file->eof())
|
||||
{
|
||||
int current = file->tell();
|
||||
int read = file->read(buf, bufsize);
|
||||
int64 current = file->tell();
|
||||
int64 read = file->read(buf, bufsize);
|
||||
totalread += read;
|
||||
|
||||
if (read < 0)
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace physfs
|
||||
File * file = luax_checkfile(L, 1);
|
||||
Data * d = 0;
|
||||
|
||||
int64 size = (int64)luaL_optnumber(L, 2, file->getSize());
|
||||
int64 size = (int64)luaL_optnumber(L, 2, (lua_Number) file->getSize());
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user