mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-07-04 02:01:51 +00:00
refactor: only use sizeof with parenthesis
This commit is contained in:
@ -44,7 +44,7 @@ void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawF
|
||||
while (zs.avail_in > 0)
|
||||
{
|
||||
zs.next_out = buffer;
|
||||
zs.avail_out = sizeof buffer;
|
||||
zs.avail_out = sizeof(buffer);
|
||||
ret = inflate(&zs, Z_SYNC_FLUSH);
|
||||
|
||||
if (ret < 0)
|
||||
@ -54,7 +54,7 @@ void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawF
|
||||
return;
|
||||
}
|
||||
|
||||
stream.write(reinterpret_cast<char*>(buffer), sizeof buffer - zs.avail_out);
|
||||
stream.write(reinterpret_cast<char*>(buffer), sizeof(buffer) - zs.avail_out);
|
||||
}
|
||||
|
||||
inflateEnd(&zs);
|
||||
|
@ -44,7 +44,7 @@ void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawF
|
||||
while (zs.avail_in > 0)
|
||||
{
|
||||
zs.next_out = buffer;
|
||||
zs.avail_out = sizeof buffer;
|
||||
zs.avail_out = sizeof(buffer);
|
||||
ret = inflate(&zs, Z_SYNC_FLUSH);
|
||||
|
||||
if (ret < 0)
|
||||
@ -54,7 +54,7 @@ void AssetDumperRawFile::DumpAsset(AssetDumpingContext& context, XAssetInfo<RawF
|
||||
return;
|
||||
}
|
||||
|
||||
stream.write(reinterpret_cast<char*>(buffer), sizeof buffer - zs.avail_out);
|
||||
stream.write(reinterpret_cast<char*>(buffer), sizeof(buffer) - zs.avail_out);
|
||||
}
|
||||
|
||||
inflateEnd(&zs);
|
||||
|
@ -59,7 +59,7 @@ void AssetDumperRawFile::DumpGsc(AssetDumpingContext& context, XAssetInfo<RawFil
|
||||
while (zs.avail_in > 0)
|
||||
{
|
||||
zs.next_out = buffer;
|
||||
zs.avail_out = sizeof buffer;
|
||||
zs.avail_out = sizeof(buffer);
|
||||
ret = inflate(&zs, Z_SYNC_FLUSH);
|
||||
|
||||
if (ret < 0)
|
||||
@ -69,7 +69,7 @@ void AssetDumperRawFile::DumpGsc(AssetDumpingContext& context, XAssetInfo<RawFil
|
||||
return;
|
||||
}
|
||||
|
||||
const auto inflateOutSize = sizeof buffer - zs.avail_out;
|
||||
const auto inflateOutSize = sizeof(buffer) - zs.avail_out;
|
||||
|
||||
if (writtenSize + inflateOutSize >= outLen)
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ void AssetDumperRawFile::DumpAnimtree(AssetDumpingContext& context, XAssetInfo<R
|
||||
while (zs.avail_in > 0)
|
||||
{
|
||||
zs.next_out = buffer;
|
||||
zs.avail_out = sizeof buffer;
|
||||
zs.avail_out = sizeof(buffer);
|
||||
ret = inflate(&zs, Z_SYNC_FLUSH);
|
||||
|
||||
if (ret < 0)
|
||||
@ -65,7 +65,7 @@ void AssetDumperRawFile::DumpAnimtree(AssetDumpingContext& context, XAssetInfo<R
|
||||
return;
|
||||
}
|
||||
|
||||
const auto inflateOutSize = sizeof buffer - zs.avail_out;
|
||||
const auto inflateOutSize = sizeof(buffer) - zs.avail_out;
|
||||
|
||||
stream.write(reinterpret_cast<char*>(buffer), inflateOutSize);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class DdsWriterInternal
|
||||
|
||||
void PopulateDdsHeader(DDS_HEADER& header)
|
||||
{
|
||||
header.dwSize = sizeof header;
|
||||
header.dwSize = sizeof(header);
|
||||
header.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
|
||||
|
||||
if (m_texture->HasMipMaps())
|
||||
@ -201,14 +201,14 @@ public:
|
||||
|
||||
constexpr auto magic = MakeFourCc('D', 'D', 'S', ' ');
|
||||
|
||||
m_stream.write(reinterpret_cast<const char*>(&magic), sizeof magic);
|
||||
m_stream.write(reinterpret_cast<const char*>(&header), sizeof header);
|
||||
m_stream.write(reinterpret_cast<const char*>(&magic), sizeof(magic));
|
||||
m_stream.write(reinterpret_cast<const char*>(&header), sizeof(header));
|
||||
|
||||
if (m_use_dx10_extension)
|
||||
{
|
||||
DDS_HEADER_DXT10 dxt10{};
|
||||
PopulateDxt10Header(dxt10);
|
||||
m_stream.write(reinterpret_cast<const char*>(&dxt10), sizeof dxt10);
|
||||
m_stream.write(reinterpret_cast<const char*>(&dxt10), sizeof(dxt10));
|
||||
}
|
||||
|
||||
const auto mipCount = m_texture->HasMipMaps() ? m_texture->GetMipMapCount() : 1;
|
||||
|
Reference in New Issue
Block a user