removed several bad casts to 'long'.

The 'long' type should generally be avoided because its size differs on Windows and Linux/Mac so it is almost guaranteed to cause undefined behavior
This commit is contained in:
Professor Hastig 2023-10-04 09:58:18 +02:00 committed by Christoph Oelckers
commit ab8711b57a
15 changed files with 29 additions and 27 deletions

View file

@ -402,7 +402,7 @@ public:
OutProcessed = 0;
// Read zip LZMA properties header
if (File->Read(header, sizeof(header)) < (long)sizeof(header))
if (File->Read(header, sizeof(header)) < (ptrdiff_t)sizeof(header))
{
DecompressionError("DecompressorLZMA: File too short\n");
return false;
@ -488,7 +488,7 @@ public:
return 0;
}
return (long)(next_out - (Byte *)buffer);
return (ptrdiff_t)(next_out - (Byte *)buffer);
}
void FillBuffer ()
@ -698,7 +698,7 @@ public:
while(AvailOut && Stream.State != STREAM_FINAL);
assert(AvailOut == 0);
return (long)(Out - (uint8_t*)buffer);
return (ptrdiff_t)(Out - (uint8_t*)buffer);
}
};