diff --git a/host/platform/Linux/capture/XCB/src/xcb.c b/host/platform/Linux/capture/XCB/src/xcb.c index d38861a2..c7848b96 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(struct xcb), 1); + this = (struct xcb *)calloc(sizeof(*this), 1); 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 d6f77f21..2fe17fa6 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(struct iface), 1); + this = calloc(sizeof(*this), 1); 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(struct Texture), this->maxTextures); + this->texture = calloc(sizeof(*this->texture), this->maxTextures); this->getPointerBufferFn = getPointerBufferFn; this->postPointerBufferFn = postPointerBufferFn; this->avgMapTime = runningavg_new(10); @@ -499,7 +499,7 @@ static bool dxgi_init(void) output5, (IUnknown *)this->device, 0, - sizeof(supportedFormats) / sizeof(DXGI_FORMAT), + ARRAY_LENGTH(supportedFormats), supportedFormats, &this->dup); @@ -871,7 +871,7 @@ static CaptureResult dxgi_capture(void) else { memcpy(tex->texDamageRects + tex->texDamageCount, tex->damageRects, - tex->damageRectsCount * sizeof(FrameDamageRect)); + tex->damageRectsCount * sizeof(*tex->damageRects)); tex->texDamageCount += tex->damageRectsCount; tex->texDamageCount = rectsMergeOverlapping(tex->texDamageRects, tex->texDamageCount); } @@ -920,7 +920,7 @@ static CaptureResult dxgi_capture(void) t->texDamageCount + tex->damageRectsCount <= KVMFR_MAX_DAMAGE_RECTS) { memcpy(t->texDamageRects + t->texDamageCount, tex->damageRects, - tex->damageRectsCount * sizeof(FrameDamageRect)); + tex->damageRectsCount * sizeof(*tex->damageRects)); t->texDamageCount += tex->damageRectsCount; } else @@ -1093,7 +1093,7 @@ static CaptureResult dxgi_getFrame(FrameBuffer * frame, else { memcpy(damage->rects + damage->count, tex->damageRects, - tex->damageRectsCount * sizeof(FrameDamageRect)); + tex->damageRectsCount * sizeof(*tex->damageRects)); damage->count += tex->damageRectsCount; rectsBufferToFramebuffer(damage->rects, damage->count, frame, this->pitch, height, tex->map.pData, this->pitch); @@ -1108,7 +1108,7 @@ static CaptureResult dxgi_getFrame(FrameBuffer * frame, damage->count + tex->damageRectsCount <= KVMFR_MAX_DAMAGE_RECTS) { memcpy(damage->rects + damage->count, tex->damageRects, - tex->damageRectsCount * sizeof(FrameDamageRect)); + tex->damageRectsCount * sizeof(*tex->damageRects)); damage->count += tex->damageRectsCount; } else diff --git a/host/platform/Windows/capture/NVFBC/src/nvfbc.c b/host/platform/Windows/capture/NVFBC/src/nvfbc.c index 9ef82b39..7d1ecc37 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(struct iface), 1); + this = (struct iface *)calloc(sizeof(*this), 1); 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 0d5d8a2c..af1660ba 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(struct stNvFBCHandle), 1); + *handle = (NvFBCHandle)calloc(sizeof(**handle), 1); (*handle)->nvfbc = static_cast(params.pNvFBC); if (maxWidth)