mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-25 23:13:39 +00:00
[host] use variable-relative sizeof where possible
This commit is contained in:
parent
c3f7327187
commit
982b4e6625
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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<NvFBCToSys *>(params.pNvFBC);
|
||||
|
||||
if (maxWidth)
|
||||
|
Loading…
Reference in New Issue
Block a user