mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Hopefully fix some more warnings in filesystem
This commit is contained in:
@@ -29,7 +29,7 @@ namespace love
|
||||
namespace filesystem
|
||||
{
|
||||
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)
|
||||
extension = filename.substr(filename.rfind('.')+1);
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace physfs
|
||||
// Sadly, we'll have to clamp to 32 bits here
|
||||
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)
|
||||
close();
|
||||
@@ -159,7 +159,7 @@ namespace physfs
|
||||
size = (size > LOVE_UINT32_MAX) ? LOVE_UINT32_MAX : size;
|
||||
|
||||
// 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.
|
||||
if (written != size)
|
||||
|
||||
@@ -489,7 +489,7 @@ namespace physfs
|
||||
{
|
||||
int64 current = file->tell();
|
||||
int64 read = file->read(buf, bufsize);
|
||||
totalread += read;
|
||||
totalread += (int) read; //TODO: Support integer-overflowing files/lines
|
||||
|
||||
if (read < 0)
|
||||
return luaL_error(L, "Readline failed!");
|
||||
@@ -498,7 +498,7 @@ namespace physfs
|
||||
{
|
||||
if (buf[i] == '\n')
|
||||
{
|
||||
newline = current+i;
|
||||
newline = (int) current+i; // TODO: See above
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -509,13 +509,13 @@ namespace physfs
|
||||
|
||||
// Special case for the last "line".
|
||||
if (newline <= 0 && file->eof() && totalread > 0)
|
||||
newline = pos + totalread;
|
||||
newline = (int) pos + totalread; // TODO: See above
|
||||
|
||||
// We've got a newline.
|
||||
if (newline > 0)
|
||||
{
|
||||
// Ok, we've got a line.
|
||||
int linesize = (newline-pos);
|
||||
int linesize = (newline-(int) pos); // TODO: See above
|
||||
|
||||
// Allocate memory for the string.
|
||||
char * str = new char[linesize];
|
||||
|
||||
Reference in New Issue
Block a user