Hopefully fix some more warnings in filesystem

This commit is contained in:
Bart van Strien
2011-12-28 14:39:13 +01:00
parent cde8b92113
commit 4b6df9baa2
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ namespace love
namespace filesystem namespace filesystem
{ {
FileData::FileData(uint64 size, const std::string & filename) FileData::FileData(uint64 size, const std::string & filename)
: data(new char[size]), size(size), filename(filename) : data(new char[(size_t) size]), size(size), filename(filename)
{ {
if (filename.rfind('.') != std::string::npos) if (filename.rfind('.') != std::string::npos)
extension = filename.substr(filename.rfind('.')+1); extension = filename.substr(filename.rfind('.')+1);
+2 -2
View File
@@ -142,7 +142,7 @@ namespace physfs
// Sadly, we'll have to clamp to 32 bits here // Sadly, we'll have to clamp to 32 bits here
size = (size > LOVE_UINT32_MAX) ? LOVE_UINT32_MAX : size; size = (size > LOVE_UINT32_MAX) ? LOVE_UINT32_MAX : size;
int64 read = (int64)PHYSFS_read(file, dst, 1, size); int64 read = (int64)PHYSFS_read(file, dst, 1, (int) size);
if (!isOpen) if (!isOpen)
close(); close();
@@ -159,7 +159,7 @@ namespace physfs
size = (size > LOVE_UINT32_MAX) ? LOVE_UINT32_MAX : size; size = (size > LOVE_UINT32_MAX) ? LOVE_UINT32_MAX : size;
// Try to write. // Try to write.
int64 written = static_cast<int64>(PHYSFS_write(file, data, 1, size)); int64 written = static_cast<int64>(PHYSFS_write(file, data, 1, (int) size));
// Check that correct amount of data was written. // Check that correct amount of data was written.
if (written != size) if (written != size)
+4 -4
View File
@@ -489,7 +489,7 @@ namespace physfs
{ {
int64 current = file->tell(); int64 current = file->tell();
int64 read = file->read(buf, bufsize); int64 read = file->read(buf, bufsize);
totalread += read; totalread += (int) read; //TODO: Support integer-overflowing files/lines
if (read < 0) if (read < 0)
return luaL_error(L, "Readline failed!"); return luaL_error(L, "Readline failed!");
@@ -498,7 +498,7 @@ namespace physfs
{ {
if (buf[i] == '\n') if (buf[i] == '\n')
{ {
newline = current+i; newline = (int) current+i; // TODO: See above
break; break;
} }
} }
@@ -509,13 +509,13 @@ namespace physfs
// Special case for the last "line". // Special case for the last "line".
if (newline <= 0 && file->eof() && totalread > 0) if (newline <= 0 && file->eof() && totalread > 0)
newline = pos + totalread; newline = (int) pos + totalread; // TODO: See above
// We've got a newline. // We've got a newline.
if (newline > 0) if (newline > 0)
{ {
// Ok, we've got a line. // Ok, we've got a line.
int linesize = (newline-pos); int linesize = (newline-(int) pos); // TODO: See above
// Allocate memory for the string. // Allocate memory for the string.
char * str = new char[linesize]; char * str = new char[linesize];