aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrpatters1 <rpatters1@users.noreply.github.com>2023-12-12 17:05:42 -0600
committerGitHub <noreply@github.com>2023-12-12 20:05:42 -0300
commit472cd783d7a98f6dfe549ac0d59f3fe8f2ea59c8 (patch)
tree17be2db91d604df741ba4e54530b4b9d5dd70e30
parent912e06714fc276c15b4d5d1b42bd2b11edb8deff (diff)
downloadluafilesystem-472cd783d7a98f6dfe549ac0d59f3fe8f2ea59c8.tar.gz
luafilesystem-472cd783d7a98f6dfe549ac0d59f3fe8f2ea59c8.tar.bz2
luafilesystem-472cd783d7a98f6dfe549ac0d59f3fe8f2ea59c8.zip
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.
-rw-r--r--src/lfs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lfs.c b/src/lfs.c
index e5e5ee4..f0a0db9 100644
--- a/src/lfs.c
+++ b/src/lfs.c
@@ -281,7 +281,7 @@ static int get_dir(lua_State * L)
281 break; 281 break;
282 } 282 }
283 path = path2; 283 path = path2;
284 if (getcwd(path, size) != NULL) { 284 if (getcwd(path, (int)size) != NULL) {
285 /* success, push the path to the Lua stack */ 285 /* success, push the path to the Lua stack */
286 lua_pushstring(L, path); 286 lua_pushstring(L, path);
287 result = 1; 287 result = 1;
@@ -1062,7 +1062,7 @@ static int push_link_target(lua_State * L)
1062 } 1062 }
1063#endif 1063#endif
1064 char *target = NULL; 1064 char *target = NULL;
1065 int tsize, size = 256; /* size = initial buffer capacity */ 1065 int tsize = 0, size = 256; /* size = initial buffer capacity */
1066 int ok = 0; 1066 int ok = 0;
1067 while (!ok) { 1067 while (!ok) {
1068 char *target2 = realloc(target, size); 1068 char *target2 = realloc(target, size);
@@ -1071,9 +1071,9 @@ static int push_link_target(lua_State * L)
1071 } 1071 }
1072 target = target2; 1072 target = target2;
1073#ifdef _WIN32 1073#ifdef _WIN32
1074 tsize = GetFinalPathNameByHandle(h, target, size, FILE_NAME_OPENED); 1074 tsize = (int)GetFinalPathNameByHandle(h, target, size, FILE_NAME_OPENED);
1075#else 1075#else
1076 tsize = readlink(file, target, size); 1076 tsize = (int)readlink(file, target, size);
1077#endif 1077#endif
1078 if (tsize < 0) { /* a readlink() error occurred */ 1078 if (tsize < 0) { /* a readlink() error occurred */
1079 break; 1079 break;