From cdda89cef73499f98f68d380ce21980a30385ef9 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sun, 15 Aug 2021 18:46:46 -0400 Subject: [PATCH] [host] use correct argument order for calloc --- host/platform/Linux/capture/XCB/src/xcb.c | 2 +- host/platform/Windows/capture/DXGI/src/dxgi.c | 4 ++-- host/platform/Windows/capture/NVFBC/src/nvfbc.c | 2 +- host/platform/Windows/capture/NVFBC/src/wrapper.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/host/platform/Linux/capture/XCB/src/xcb.c b/host/platform/Linux/capture/XCB/src/xcb.c index c7848b96..2ccbfae0 100644 --- a/host/platform/Linux/capture/XCB/src/xcb.c +++ b/host/platform/Linux/capture/XCB/src/xcb.c @@ -64,7 +64,7 @@ static const char * xcb_getName(void) static bool xcb_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostPointerBuffer postPointerBufferFn) { DEBUG_ASSERT(!this); - this = (struct xcb *)calloc(sizeof(*this), 1); + this = (struct xcb *)calloc(1, sizeof(*this)); this->shmID = -1; this->data = (void *)-1; this->frameEvent = lgCreateEvent(true, 20); diff --git a/host/platform/Windows/capture/DXGI/src/dxgi.c b/host/platform/Windows/capture/DXGI/src/dxgi.c index 2fe17fa6..7eedf447 100644 --- a/host/platform/Windows/capture/DXGI/src/dxgi.c +++ b/host/platform/Windows/capture/DXGI/src/dxgi.c @@ -170,7 +170,7 @@ static void dxgi_initOptions(void) static bool dxgi_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostPointerBuffer postPointerBufferFn) { DEBUG_ASSERT(!this); - this = calloc(sizeof(*this), 1); + this = calloc(1, sizeof(*this)); if (!this) { DEBUG_ERROR("failed to allocate iface struct"); @@ -190,7 +190,7 @@ static bool dxgi_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostP this->maxTextures = 1; this->useAcquireLock = option_get_bool("dxgi", "useAcquireLock"); - this->texture = calloc(sizeof(*this->texture), this->maxTextures); + this->texture = calloc(this->maxTextures, sizeof(*this->texture)); this->getPointerBufferFn = getPointerBufferFn; this->postPointerBufferFn = postPointerBufferFn; this->avgMapTime = runningavg_new(10); diff --git a/host/platform/Windows/capture/NVFBC/src/nvfbc.c b/host/platform/Windows/capture/NVFBC/src/nvfbc.c index 7d1ecc37..2052a737 100644 --- a/host/platform/Windows/capture/NVFBC/src/nvfbc.c +++ b/host/platform/Windows/capture/NVFBC/src/nvfbc.c @@ -153,7 +153,7 @@ static bool nvfbc_create( if (!NvFBCInit()) return false; - this = (struct iface *)calloc(sizeof(*this), 1); + this = (struct iface *)calloc(1, sizeof(*this)); this->seperateCursor = option_get_bool("nvfbc", "decoupleCursor"); this->getPointerBufferFn = getPointerBufferFn; diff --git a/host/platform/Windows/capture/NVFBC/src/wrapper.cpp b/host/platform/Windows/capture/NVFBC/src/wrapper.cpp index af1660ba..8df5a11a 100644 --- a/host/platform/Windows/capture/NVFBC/src/wrapper.cpp +++ b/host/platform/Windows/capture/NVFBC/src/wrapper.cpp @@ -133,7 +133,7 @@ bool NvFBCToSysCreate( return false; } - *handle = (NvFBCHandle)calloc(sizeof(**handle), 1); + *handle = (NvFBCHandle)calloc(1, sizeof(**handle)); (*handle)->nvfbc = static_cast(params.pNvFBC); if (maxWidth)