1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 09:47:17 +00:00

try and remove warnings on windows, format os.c.

This commit is contained in:
Calvin Rose 2020-03-18 21:15:50 -05:00
parent c344a543b0
commit 00450cd9db

View File

@ -673,7 +673,13 @@ static Janet os_date(int32_t argc, Janet *argv) {
return janet_wrap_struct(janet_struct_end(st)); return janet_wrap_struct(janet_struct_end(st));
} }
static int64_t entry_getint(Janet env_entry, char *field) { #ifdef JANET_WINDOWS
typedef int32_t timeint_t;
#else
typedef int64_t timeint_t;
#endif
static timeint_t entry_getint(Janet env_entry, char *field) {
Janet i; Janet i;
if (janet_checktype(env_entry, JANET_TABLE)) { if (janet_checktype(env_entry, JANET_TABLE)) {
JanetTable *entry = janet_unwrap_table(env_entry); JanetTable *entry = janet_unwrap_table(env_entry);
@ -689,12 +695,19 @@ static int64_t entry_getint(Janet env_entry, char *field) {
return 0; return 0;
} }
if (!janet_checkint64(i)) { #ifdef JANET_WINDOWS
janet_panicf("bad slot :%s, expected 64 bit signed integer, got %v", if (!janet_checkint(i)) {
janet_panicf("bad slot #%s, expected 32 bit signed integer, got %v",
field, i); field, i);
} }
#else
if (!janet_checkint64(i)) {
janet_panicf("bad slot #%s, expected 64 bit signed integer, got %v",
field, i);
}
#endif
return (int64_t)janet_unwrap_number(i); return (timeint_t)janet_unwrap_number(i);
} }
static Janet os_mktime(int32_t argc, Janet *argv) { static Janet os_mktime(int32_t argc, Janet *argv) {