From cb445492055195f1f4885378dcb6a9341f69f202 Mon Sep 17 00:00:00 2001 From: bjorn Date: Tue, 25 Apr 2023 21:45:30 -0700 Subject: [PATCH] Fix more prototypes; --- src/core/gpu_vk.c | 2 +- src/core/os_android.c | 20 ++++++++++---------- src/core/os_glfw.h | 14 +++++++------- src/core/os_linux.c | 10 +++++----- src/core/os_macos.c | 10 +++++----- src/core/os_win32.c | 10 +++++----- src/modules/audio/audio.c | 6 +++--- src/modules/audio/spatializer_phonon.c | 2 +- src/modules/event/event.c | 8 ++++---- src/modules/graphics/graphics.c | 14 +++++++------- src/modules/headset/headset_webxr.c | 4 ++-- src/modules/math/math.c | 8 ++++---- src/modules/system/system.c | 2 +- src/util.c | 2 +- 14 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/core/gpu_vk.c b/src/core/gpu_vk.c index b96f61d6..22cec638 100644 --- a/src/core/gpu_vk.c +++ b/src/core/gpu_vk.c @@ -2667,7 +2667,7 @@ static void condemn(void* handle, VkObjectType type) { morgue->data[morgue->head++ & MORGUE_MASK] = (gpu_victim) { handle, type, state.tick[CPU] }; } -static void expunge() { +static void expunge(void) { gpu_morgue* morgue = &state.morgue; while (morgue->tail != morgue->head && state.tick[GPU] >= morgue->data[morgue->tail & MORGUE_MASK].tick) { gpu_victim* victim = &morgue->data[morgue->tail++ & MORGUE_MASK]; diff --git a/src/core/os_android.c b/src/core/os_android.c index 136f76c7..c5570cdc 100644 --- a/src/core/os_android.c +++ b/src/core/os_android.c @@ -165,11 +165,11 @@ void android_main(struct android_app* app) { (*app->activity->vm)->DetachCurrentThread(app->activity->vm); } -bool os_init() { +bool os_init(void) { return true; } -void os_destroy() { +void os_destroy(void) { // There are two ways a quit can happen, which need to be handled slightly differently: // - If the system tells us to quit, we get an event with APP_CMD_DESTROY. In response we push a // QUIT event to lovr.event and main will eventually exit cleanly. No other teardown necessary. @@ -189,11 +189,11 @@ void os_destroy() { memset(&state, 0, sizeof(state)); } -const char* os_get_name() { +const char* os_get_name(void) { return "Android"; } -uint32_t os_get_core_count() { +uint32_t os_get_core_count(void) { return sysconf(_SC_NPROCESSORS_ONLN); } @@ -220,14 +220,14 @@ static void* log_main(void* data) { return 0; } -void os_open_console() { +void os_open_console(void) { pthread_create(&log.thread, NULL, log_main, log.handles); pthread_detach(log.thread); } #define NS_PER_SEC 1000000000ULL -double os_get_time() { +double os_get_time(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return (double) t.tv_sec + (t.tv_nsec / (double) NS_PER_SEC); @@ -287,7 +287,7 @@ bool os_vm_release(void* p, size_t size) { // - Block if the app is paused or no window is present // - If the app was active and becomes inactive after an event, break instead of waiting for // another event. This gives the main loop a chance to respond (e.g. exit VR mode). -void os_poll_events() { +void os_poll_events(void) { while (!state.app->destroyRequested) { int events; struct android_poll_source* source; @@ -342,7 +342,7 @@ bool os_window_open(const os_window_config* config) { return true; } -bool os_window_is_open() { +bool os_window_is_open(void) { return false; } @@ -426,11 +426,11 @@ bool os_is_key_down(os_key key) { // Private, must be declared manually to use -void* os_get_java_vm() { +void* os_get_java_vm(void) { return state.app->activity->vm; } -void* os_get_jni_context() { +void* os_get_jni_context(void) { return state.app->activity->clazz; } diff --git a/src/core/os_glfw.h b/src/core/os_glfw.h index cb8959b0..17a32359 100644 --- a/src/core/os_glfw.h +++ b/src/core/os_glfw.h @@ -1,10 +1,10 @@ #ifndef LOVR_USE_GLFW -void os_destroy() { +void os_destroy(void) { // } -void os_poll_events() { +void os_poll_events(void) { // } @@ -12,7 +12,7 @@ bool os_window_open(const os_window_config* config) { return false; } -bool os_window_is_open() { +bool os_window_is_open(void) { return false; } @@ -276,11 +276,11 @@ static int convertKey(os_key key) { } } -void os_destroy() { +void os_destroy(void) { glfwTerminate(); } -void os_poll_events() { +void os_poll_events(void) { if (glfwState.window) { glfwPollEvents(); } @@ -341,7 +341,7 @@ bool os_window_open(const os_window_config* config) { return true; } -bool os_window_is_open() { +bool os_window_is_open(void) { return glfwState.window; } @@ -420,7 +420,7 @@ bool os_is_key_down(os_key key) { } #ifdef _WIN32 -HANDLE os_get_win32_window() { +HANDLE os_get_win32_window(void) { return (HANDLE) glfwGetWin32Window(glfwState.window); } #endif diff --git a/src/core/os_linux.c b/src/core/os_linux.c index e3639291..fa451ce3 100644 --- a/src/core/os_linux.c +++ b/src/core/os_linux.c @@ -10,23 +10,23 @@ #define NS_PER_SEC 1000000000ULL -bool os_init() { +bool os_init(void) { return true; } -const char* os_get_name() { +const char* os_get_name(void) { return "Linux"; } -uint32_t os_get_core_count() { +uint32_t os_get_core_count(void) { return sysconf(_SC_NPROCESSORS_ONLN); } -void os_open_console() { +void os_open_console(void) { // } -double os_get_time() { +double os_get_time(void) { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); return (double) t.tv_sec + (t.tv_nsec / (double) NS_PER_SEC); diff --git a/src/core/os_macos.c b/src/core/os_macos.c index 78f86cbd..487d847e 100644 --- a/src/core/os_macos.c +++ b/src/core/os_macos.c @@ -19,29 +19,29 @@ static struct { fn_permission* onPermissionEvent; } state; -bool os_init() { +bool os_init(void) { mach_timebase_info_data_t info; mach_timebase_info(&info); state.frequency = (info.denom * 1e9) / info.numer; return true; } -const char* os_get_name() { +const char* os_get_name(void) { return "macOS"; } -uint32_t os_get_core_count() { +uint32_t os_get_core_count(void) { uint32_t count; size_t size = sizeof(count); sysctlbyname("hw.logicalcpu", &count, &size, NULL, 0); return count; } -void os_open_console() { +void os_open_console(void) { // } -double os_get_time() { +double os_get_time(void) { return mach_absolute_time() / (double) state.frequency; } diff --git a/src/core/os_win32.c b/src/core/os_win32.c index 29772659..71724758 100644 --- a/src/core/os_win32.c +++ b/src/core/os_win32.c @@ -55,24 +55,24 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev, LPSTR args, int show) { #endif -bool os_init() { +bool os_init(void) { LARGE_INTEGER f; QueryPerformanceFrequency(&f); frequency = f.QuadPart; return true; } -const char* os_get_name() { +const char* os_get_name(void) { return "Windows"; } -uint32_t os_get_core_count() { +uint32_t os_get_core_count(void) { SYSTEM_INFO info; GetSystemInfo(&info); return info.dwNumberOfProcessors; } -void os_open_console() { +void os_open_console(void) { if (!AttachConsole(ATTACH_PARENT_PROCESS)) { if (GetLastError() != ERROR_ACCESS_DENIED) { if (!AllocConsole()) { @@ -86,7 +86,7 @@ void os_open_console() { freopen("CONOUT$", "w", stderr); } -double os_get_time() { +double os_get_time(void) { LARGE_INTEGER t; QueryPerformanceCounter(&t); return t.QuadPart / (double) frequency; diff --git a/src/modules/audio/audio.c b/src/modules/audio/audio.c index a050fff7..3ba5a0e7 100644 --- a/src/modules/audio/audio.c +++ b/src/modules/audio/audio.c @@ -224,7 +224,7 @@ bool lovrAudioInit(const char* spatializer, uint32_t sampleRate) { return state.initialized = true; } -void lovrAudioDestroy() { +void lovrAudioDestroy(void) { if (!state.initialized) return; for (size_t i = 0; i < 2; i++) { ma_device_uninit(&state.devices[i]); @@ -362,11 +362,11 @@ bool lovrAudioSetGeometry(float* vertices, uint32_t* indices, uint32_t vertexCou return success; } -const char* lovrAudioGetSpatializer() { +const char* lovrAudioGetSpatializer(void) { return state.spatializer->name; } -uint32_t lovrAudioGetSampleRate() { +uint32_t lovrAudioGetSampleRate(void) { return state.sampleRate; } diff --git a/src/modules/audio/spatializer_phonon.c b/src/modules/audio/spatializer_phonon.c index acb838ad..b241ed0b 100644 --- a/src/modules/audio/spatializer_phonon.c +++ b/src/modules/audio/spatializer_phonon.c @@ -166,7 +166,7 @@ bool phonon_init(void) { return true; } -void phonon_destroy() { +void phonon_destroy(void) { if (state.scratchpad) free(state.scratchpad); for (size_t i = 0; i < MAX_SOURCES; i++) { if (state.binauralEffect[i]) phonon_iplDestroyBinauralEffect(&state.binauralEffect[i]); diff --git a/src/modules/event/event.c b/src/modules/event/event.c index 83a5483b..a58a5417 100644 --- a/src/modules/event/event.c +++ b/src/modules/event/event.c @@ -20,13 +20,13 @@ void lovrVariantDestroy(Variant* variant) { } } -bool lovrEventInit() { +bool lovrEventInit(void) { if (state.initialized) return false; arr_init(&state.events, arr_alloc); return state.initialized = true; } -void lovrEventDestroy() { +void lovrEventDestroy(void) { if (!state.initialized) return; for (size_t i = state.head; i < state.events.length; i++) { Event* event = &state.events.data[i]; @@ -46,7 +46,7 @@ void lovrEventDestroy() { memset(&state, 0, sizeof(state)); } -void lovrEventPump() { +void lovrEventPump(void) { os_poll_events(); } @@ -76,7 +76,7 @@ bool lovrEventPoll(Event* event) { return true; } -void lovrEventClear() { +void lovrEventClear(void) { arr_clear(&state.events); state.head = 0; } diff --git a/src/modules/graphics/graphics.c b/src/modules/graphics/graphics.c index 538c9c96..d282db7e 100644 --- a/src/modules/graphics/graphics.c +++ b/src/modules/graphics/graphics.c @@ -689,7 +689,7 @@ bool lovrGraphicsInit(GraphicsConfig* config) { return true; } -void lovrGraphicsDestroy() { +void lovrGraphicsDestroy(void) { if (!state.initialized) return; #ifndef LOVR_DISABLE_HEADSET // If there's an active headset session it needs to be stopped so it can clean up its Pass and @@ -770,7 +770,7 @@ void lovrGraphicsDestroy() { memset(&state, 0, sizeof(state)); } -bool lovrGraphicsIsInitialized() { +bool lovrGraphicsIsInitialized(void) { return state.initialized; } @@ -1100,7 +1100,7 @@ void lovrGraphicsSubmit(Pass** passes, uint32_t count) { releasePassResources(); } -void lovrGraphicsPresent() { +void lovrGraphicsPresent(void) { if (state.presentable) { state.window->gpu = NULL; state.window->renderView = NULL; @@ -1109,7 +1109,7 @@ void lovrGraphicsPresent() { } } -void lovrGraphicsWait() { +void lovrGraphicsWait(void) { gpu_wait_idle(); } @@ -1305,7 +1305,7 @@ void lovrBufferClear(Buffer* buffer, uint32_t offset, uint32_t size) { // Texture -Texture* lovrGraphicsGetWindowTexture() { +Texture* lovrGraphicsGetWindowTexture(void) { if (!state.window->gpu) { beginFrame(); @@ -2326,7 +2326,7 @@ const MaterialInfo* lovrMaterialGetInfo(Material* material) { // Font -Font* lovrGraphicsGetDefaultFont() { +Font* lovrGraphicsGetDefaultFont(void) { if (!state.defaultFont) { Rasterizer* rasterizer = lovrRasterizerCreate(NULL, 32); state.defaultFont = lovrFontCreate(&(FontInfo) { @@ -3667,7 +3667,7 @@ static void lovrPassCheckValid(Pass* pass) { lovrCheck(pass->tick == state.tick, "Passes can only be used for a single frame (unable to use this Pass again because lovr.graphics.submit has been called since it was created)"); } -Pass* lovrGraphicsGetWindowPass() { +Pass* lovrGraphicsGetWindowPass(void) { if (!state.windowPass && state.window) { Texture* window = lovrGraphicsGetWindowTexture(); diff --git a/src/modules/headset/headset_webxr.c b/src/modules/headset/headset_webxr.c index fda1acd7..55ee05bf 100644 --- a/src/modules/headset/headset_webxr.c +++ b/src/modules/headset/headset_webxr.c @@ -33,7 +33,7 @@ extern double webxr_update(void); static bool webxrAttached = false; static HeadsetInterface* previousHeadsetDriver; -void webxr_attach() { +void webxr_attach(void) { if (webxrAttached || lovrHeadsetInterface == &lovrHeadsetWebXRDriver) { return; } @@ -43,7 +43,7 @@ void webxr_attach() { webxrAttached = true; } -void webxr_detach() { +void webxr_detach(void) { if (!webxrAttached) { return; } diff --git a/src/modules/math/math.c b/src/modules/math/math.c index 39a771ee..23e178c8 100644 --- a/src/modules/math/math.c +++ b/src/modules/math/math.c @@ -35,7 +35,7 @@ static struct { RandomGenerator* generator; } state; -bool lovrMathInit() { +bool lovrMathInit(void) { if (state.initialized) return false; state.generator = lovrRandomGeneratorCreate(); Seed seed = { .b64 = (uint64_t) time(0) }; @@ -43,7 +43,7 @@ bool lovrMathInit() { return state.initialized = true; } -void lovrMathDestroy() { +void lovrMathDestroy(void) { if (!state.initialized) return; lovrRelease(state.generator, lovrRandomGeneratorDestroy); memset(&state, 0, sizeof(state)); @@ -81,7 +81,7 @@ double lovrMathNoise4(double x, double y, double z, double w) { return snoise4(x, y, z, w) * .5 + .5; } -RandomGenerator* lovrMathGetRandomGenerator() { +RandomGenerator* lovrMathGetRandomGenerator(void) { return state.generator; } @@ -225,7 +225,7 @@ static const size_t vectorComponents[] = { [V_MAT4] = 16 }; -Pool* lovrPoolCreate() { +Pool* lovrPoolCreate(void) { Pool* pool = calloc(1, sizeof(Pool)); lovrAssert(pool, "Out of memory"); pool->ref = 1; diff --git a/src/modules/system/system.c b/src/modules/system/system.c index 1b8b1006..f84c8225 100644 --- a/src/modules/system/system.c +++ b/src/modules/system/system.c @@ -81,7 +81,7 @@ bool lovrSystemInit(void) { return true; } -void lovrSystemDestroy() { +void lovrSystemDestroy(void) { if (!state.initialized) return; os_on_key(NULL); os_on_text(NULL); diff --git a/src/util.c b/src/util.c index 416a5f9c..433759ea 100644 --- a/src/util.c +++ b/src/util.c @@ -235,7 +235,7 @@ static uint32_t mantissa[2048]; static uint32_t exponent[64]; static uint16_t offset[64]; -void float16Init() { +void float16Init(void) { for (uint32_t i = 0; i < 256; i++) { int e = i - 127; if (e < -24) {