Browse Source

Hopefully fix some more warnings in filesystem

Bart van Strien 13 years ago
parent
commit
4b6df9baa2

+ 1 - 1
src/modules/filesystem/FileData.cpp

@@ -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
src/modules/filesystem/physfs/File.cpp

@@ -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
src/modules/filesystem/physfs/Filesystem.cpp

@@ -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];