Fix a bunch of compile warnings. (#691)

This commit is contained in:
Tom van Dijck 2017-02-10 09:03:26 -08:00 committed by GitHub
parent 3230f8ccf1
commit 566936cbe7
4 changed files with 7 additions and 4 deletions

View File

@ -10,6 +10,9 @@
#include <string.h>
#include <errno.h>
#if PLATFORM_WINDOWS
#include <io.h>
#endif
int os_chmod(lua_State* L)
{

View File

@ -24,7 +24,7 @@ int do_getcwd(char* buffer, size_t size)
int result;
#if PLATFORM_WINDOWS
result = (GetCurrentDirectoryA(size, buffer) != 0);
result = (GetCurrentDirectoryA((DWORD)size, buffer) != 0);
if (result) {
do_translate(buffer, '/');
}

View File

@ -18,14 +18,14 @@ int os_getpass(lua_State* L)
char buffer[1024];
const char* newline = "\n";
WriteConsoleA(hstdout, prompt, strlen(prompt), &written_chars, NULL);
WriteConsoleA(hstdout, prompt, (DWORD)strlen(prompt), &written_chars, NULL);
GetConsoleMode(hstdin, &mode);
SetConsoleMode(hstdin, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT);
ReadConsoleA(hstdin, buffer, sizeof (buffer), &read_chars, NULL);
SetConsoleMode(hstdin, mode);
WriteConsoleA(hstdout, newline, strlen(newline), &written_chars, NULL);
WriteConsoleA(hstdout, newline, (DWORD)strlen(newline), &written_chars, NULL);
buffer[strcspn(buffer, "\r\n")] = '\0';

View File

@ -26,7 +26,7 @@ int do_mkdir(const char* path)
return 1;
// find the parent folder name.
length = strlen(path);
length = (int)strlen(path);
for (i = length - 1; i >= 0; --i)
{
if (path[i] == '/' || path[i] == '\\')