CScanCooking: Make use of unsigned stream helpers
@@ -12,7 +12,7 @@ bool CScanCooker::CookSCAN(CScan* pScan, IOutputStream& SCAN)
SCAN.WriteLong(5); // Version number; must be 5
SCAN.WriteLong(0x0BADBEEF); // SCAN magic
- CStructRef ScanProperties = pScan->ScanData();
+ const CStructRef ScanProperties = pScan->ScanData();
CScriptCooker Cooker(pScan->Game());
Cooker.WriteProperty(SCAN, ScanProperties.Property(), ScanProperties.DataPointer(), true);
}
@@ -26,19 +26,19 @@ bool CScanCooker::CookSCAN(CScan* pScan, IOutputStream& SCAN)
// Scans in MP2/3 are saved with the script object data format
// Write a dummy script object header here
SCAN.WriteLong( FOURCC('SNFO') ); // ScannableObjectInfo object ID
- uint ScanInstanceSizeOffset = SCAN.Tell();
+ const uint32 ScanInstanceSizeOffset = SCAN.Tell();
SCAN.WriteShort(0); // Object size
SCAN.WriteLong(0); // Instance ID
SCAN.WriteShort(0); // Link count
- CStructRef ScanProperties = pScan->ScanData();
+ const CStructRef ScanProperties = pScan->ScanData();
CScriptCooker Cooker(pScan->Game());
Cooker.WriteProperty(SCAN, ScanProperties.Property(), ScanProperties.DataPointer(), false);
- uint ScanInstanceEnd = SCAN.Tell();
- uint ScanInstanceSize = ScanInstanceEnd - ScanInstanceSizeOffset - 2;
+ const uint32 ScanInstanceEnd = SCAN.Tell();
+ const uint32 ScanInstanceSize = ScanInstanceEnd - ScanInstanceSizeOffset - 2;
SCAN.GoTo(ScanInstanceSizeOffset);
- SCAN.WriteShort( (uint16) ScanInstanceSize );
+ SCAN.WriteUShort(static_cast<uint16>(ScanInstanceSize));
SCAN.GoTo(ScanInstanceEnd);
// Write dependency list
@@ -47,7 +47,7 @@ bool CScanCooker::CookSCAN(CScan* pScan, IOutputStream& SCAN)
std::vector<CAssetID> Dependencies;
CAssetDependencyListBuilder Builder(pScan->Entry());
Builder.BuildDependencyList(Dependencies);
- SCAN.WriteLong(Dependencies.size());
+ SCAN.WriteULong(static_cast<uint32>(Dependencies.size()));
for (const CAssetID& kID : Dependencies)
{
