1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-25 07:50:27 +00:00

Fix compiler warnings on emscripten.

This commit is contained in:
Calvin Rose 2019-01-05 20:52:32 -05:00
parent 338b31f5a2
commit 1f98eff33a
2 changed files with 10 additions and 4 deletions

View File

@ -165,7 +165,7 @@ JanetRange janet_getslice(int32_t argc, const Janet *argv) {
if (range.start < 0 || range.start > length) {
janet_panicf("slice start: index %d out of range [0,%d]", range.start, length);
}
} else if (argc == 3) {
} else {
range.start = janet_getinteger(argv, 1);
range.end = janet_getinteger(argv, 2);
if (range.start < 0) {

View File

@ -99,6 +99,14 @@ static Janet makef(FILE *f, int flags) {
}
/* Open a process */
#ifdef __EMSCRIPTEN__
static Janet janet_io_popen(int32_t argc, Janet *argv) {
(void) argc;
(void) argv;
janet_panic("not implemented on this platform");
return janet_wrap_nil();
}
#else
static Janet janet_io_popen(int32_t argc, Janet *argv) {
janet_arity(argc, 1, 2);
const uint8_t *fname = janet_getstring(argv, 0);
@ -115,9 +123,6 @@ static Janet janet_io_popen(int32_t argc, Janet *argv) {
: IO_PIPED | IO_READ;
#ifdef JANET_WINDOWS
#define popen _popen
#endif
#ifdef __EMSCRIPTEN__
#define popen(A, B) (errno = 0, NULL)
#endif
FILE *f = popen((const char *)fname, (const char *)fmode);
if (!f) {
@ -125,6 +130,7 @@ static Janet janet_io_popen(int32_t argc, Janet *argv) {
}
return makef(f, flags);
}
#endif
/* Open a a file and return a userdata wrapper around the C file API. */
static Janet janet_io_fopen(int32_t argc, Janet *argv) {