mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-22 02:53:06 +00:00
Fix a few compiler warnings (#171)
Fixes warnings (probably) introduced with 64-bit. Mainly explicit typecasts to int to silence "possible loss of precision" warnings. These are lengths of filenames, so they're not going to exceed 4GB.
This commit is contained in:
@@ -281,7 +281,7 @@ static int get_dir(lua_State * L)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
path = path2;
|
path = path2;
|
||||||
if (getcwd(path, size) != NULL) {
|
if (getcwd(path, (int)size) != NULL) {
|
||||||
/* success, push the path to the Lua stack */
|
/* success, push the path to the Lua stack */
|
||||||
lua_pushstring(L, path);
|
lua_pushstring(L, path);
|
||||||
result = 1;
|
result = 1;
|
||||||
@@ -1062,7 +1062,7 @@ static int push_link_target(lua_State * L)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
char *target = NULL;
|
char *target = NULL;
|
||||||
int tsize, size = 256; /* size = initial buffer capacity */
|
int tsize = 0, size = 256; /* size = initial buffer capacity */
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
while (!ok) {
|
while (!ok) {
|
||||||
char *target2 = realloc(target, size);
|
char *target2 = realloc(target, size);
|
||||||
@@ -1071,9 +1071,9 @@ static int push_link_target(lua_State * L)
|
|||||||
}
|
}
|
||||||
target = target2;
|
target = target2;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
tsize = GetFinalPathNameByHandle(h, target, size, FILE_NAME_OPENED);
|
tsize = (int)GetFinalPathNameByHandle(h, target, size, FILE_NAME_OPENED);
|
||||||
#else
|
#else
|
||||||
tsize = readlink(file, target, size);
|
tsize = (int)readlink(file, target, size);
|
||||||
#endif
|
#endif
|
||||||
if (tsize < 0) { /* a readlink() error occurred */
|
if (tsize < 0) { /* a readlink() error occurred */
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user