From 60a69747d0d2f410c6656d1ebb011192abf34d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Mon, 6 Nov 2023 19:19:41 -0800 Subject: [PATCH] clean up --- w2c2/compat.c | 20 ++++++++++---------- w2c2/leb128_test.c | 1 - w2c2/typestack.h | 2 +- wasi/Makefile | 2 +- wasi/win32.h | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/w2c2/compat.c b/w2c2/compat.c index eb3600b5..32c10885 100644 --- a/w2c2/compat.c +++ b/w2c2/compat.c @@ -11,16 +11,16 @@ char* basename( char* s ) { - size_t i; + size_t i; if (!s || !*s) { return "."; } - i = strlen(s)-1; + i = strlen(s)-1; for (; i && s[i] == PATH_SEPARATOR; i--) { s[i] = 0; } for (; i && s[i - 1] != PATH_SEPARATOR; i--) { } - return s+i; + return s+i; } /* @@ -31,17 +31,17 @@ char* dirname( char* s ) { - size_t i; - if (!s || !*s) { + size_t i; + if (!s || !*s) { return "."; } - i = strlen(s)-1; - for (; s[i] == PATH_SEPARATOR; i--) { + i = strlen(s)-1; + for (; s[i] == PATH_SEPARATOR; i--) { if (!i) { return PATH_SEPARATOR_STRING; } } - for (; s[i] != PATH_SEPARATOR; i--) { + for (; s[i] != PATH_SEPARATOR; i--) { if (!i) { return "."; } @@ -51,8 +51,8 @@ dirname( return PATH_SEPARATOR_STRING; } } - s[i+1] = 0; - return s; + s[i+1] = 0; + return s; } #endif /* !HAS_LIBGEN */ diff --git a/w2c2/leb128_test.c b/w2c2/leb128_test.c index 7ff83dec..9f85662d 100644 --- a/w2c2/leb128_test.c +++ b/w2c2/leb128_test.c @@ -42,7 +42,6 @@ testReadU32LEB128() { if (count == 0 || actual != testCase.expected) { fprintf(stderr, "FAIL testReadU32LEB128: %u != %u\n", actual, testCase.expected); - } else { } } diff --git a/w2c2/typestack.h b/w2c2/typestack.h index 923a06e5..7271ae6f 100644 --- a/w2c2/typestack.h +++ b/w2c2/typestack.h @@ -75,7 +75,7 @@ wasmTypeStackSet( typeStack->length = newLength; } - typeStack->valueTypes[index] |= (1 << valueType); + typeStack->valueTypes[index] |= (WasmValueType)(1 << valueType); return true; } diff --git a/wasi/Makefile b/wasi/Makefile index 2e69bfd6..87274e11 100644 --- a/wasi/Makefile +++ b/wasi/Makefile @@ -83,7 +83,7 @@ OBJECTS = $(patsubst %.c,%.o,$(filter-out test.c,$(wildcard *.c))) $(CC) $(CFLAGS) -c $< -o $@ libw2c2wasi.a: $(OBJECTS) - $(AR) rcu $@ $^ + $(AR) qc $@ $^ ranlib $@ test: $(OBJECTS) test.c diff --git a/wasi/win32.h b/wasi/win32.h index 0bb32187..2149ea51 100644 --- a/wasi/win32.h +++ b/wasi/win32.h @@ -16,7 +16,7 @@ typedef struct DIR DIR; DIR* opendir(const char*); struct dirent* readdir(DIR*); -int closedir(DIR*); +int closedir(DIR*); /* File types for 'd_type' */ #define DT_UNKNOWN 0