Fix some warnings

This commit is contained in:
Bart van Strien
2011-12-27 21:25:06 +01:00
parent a855a01f02
commit 864c800e10
11 changed files with 49 additions and 25 deletions
+8 -3
View File
@@ -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
+3 -3
View File
@@ -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)
+1 -1
View File
@@ -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
{