[codec,xcrush] annotate bugprone-sizeof

This commit is contained in:
akallabeth 2024-09-30 17:53:39 +02:00
parent 7cd4884de1
commit e2eb8f6a28
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -341,8 +341,12 @@ static int xcrush_find_next_matching_chunk(XCRUSH_CONTEXT* WINPR_RESTRICT xcrush
if (chunk->next)
{
UINT32 index = (chunk - xcrush->Chunks) / sizeof(XCRUSH_CHUNK);
// NOLINTNEXTLINE(bugprone-sizeof-expression)
const intptr_t diff = (chunk - xcrush->Chunks);
if (diff < 0)
return -4011;
const size_t index = (size_t)diff / sizeof(XCRUSH_CHUNK);
if (index >= 65534)
return -4002; /* error */