Fix long-to-int warnings

This commit is contained in:
Iliyas Jorio 2022-11-22 20:38:24 +01:00
parent 15d3606631
commit 084842445d
5 changed files with 16 additions and 16 deletions

View File

@ -246,7 +246,7 @@ OSErr ResolveAlias(const FSSpec* spec, AliasHandle alias, FSSpec* target, Boolea
{
*wasChanged = false;
int aliasSize = GetHandleSize(alias);
Size aliasSize = GetHandleSize(alias);
// the target FN is at offset 50, and the target FN is a Str63, so 50+64
if (aliasSize < 50 + 64)
@ -400,4 +400,4 @@ OSErr SetFPos(short refNum, short posMode, long filePos)
FSSpec Pomme::Files::HostPathToFSSpec(const fs::path& fullPath)
{
return dynamic_cast<HostVolume*>(volumes[0].get())->ToFSSpec(fullPath);
}
}

View File

@ -63,7 +63,7 @@ short FSpOpenResFile(const FSSpec* spec, char permission)
}
auto f = Pomme::BigEndianIStream(Pomme::Files::GetStream(slot));
auto resForkOff = f.Tell();
std::streamoff resForkOff = f.Tell();
// ----------------
// Load resource fork
@ -75,8 +75,8 @@ short FSpOpenResFile(const FSSpec* spec, char permission)
// -------------------
// Resource Header
UInt32 dataSectionOff = f.Read<UInt32>() + resForkOff;
UInt32 mapSectionOff = f.Read<UInt32>() + resForkOff;
std::streamoff dataSectionOff = f.Read<UInt32>() + resForkOff;
std::streamoff mapSectionOff = f.Read<UInt32>() + resForkOff;
f.Skip(4); // UInt32 dataSectionLen
f.Skip(4); // UInt32 mapSectionLen
f.Skip(112 + 128); // system- (112) and app- (128) reserved data
@ -88,8 +88,8 @@ short FSpOpenResFile(const FSSpec* spec, char permission)
// map header
f.Skip(16 + 4 + 2); // junk
f.Skip(2); // UInt16 fileAttr
UInt32 typeListOff = f.Read<UInt16>() + mapSectionOff;
UInt32 resNameListOff = f.Read<UInt16>() + mapSectionOff;
std::streamoff typeListOff = f.Read<UInt16>() + mapSectionOff;
std::streamoff resNameListOff = f.Read<UInt16>() + mapSectionOff;
// all resource types
int nResTypes = 1 + f.Read<UInt16>();
@ -97,7 +97,7 @@ short FSpOpenResFile(const FSSpec* spec, char permission)
{
OSType resType = f.Read<OSType>();
int resCount = f.Read<UInt16>() + 1;
UInt32 resRefListOff = f.Read<UInt16>() + typeListOff;
std::streamoff resRefListOff = f.Read<UInt16>() + typeListOff;
// The guard will rewind the file cursor to the pos in the next iteration
auto guard1 = f.GuardPos();
@ -116,7 +116,7 @@ short FSpOpenResFile(const FSSpec* spec, char permission)
// unpack attributes
Byte resFlags = (resPackedAttr & 0xFF000000) >> 24;
UInt32 resDataOff = (resPackedAttr & 0x00FFFFFF) + dataSectionOff;
std::streamoff resDataOff = (resPackedAttr & 0x00FFFFFF) + dataSectionOff;
// Check compressed flag
ResourceAssert(!(resFlags & 1), "FSpOpenResFile: Compressed resources not supported yet");

View File

@ -97,7 +97,7 @@ Handle NewHandle(Size size)
if (size > 0x7FFFFFFF)
throw std::invalid_argument("trying to alloc massive handle");
BlockDescriptor* block = BlockDescriptor::Allocate(size);
BlockDescriptor* block = BlockDescriptor::Allocate((UInt32) size);
return &block->ptrToData;
}
@ -175,7 +175,7 @@ Ptr NewPtr(Size byteCount)
#if !POMME_PTR_TRACKING
return new char[byteCount];
#else
BlockDescriptor* bd = BlockDescriptor::Allocate(byteCount);
BlockDescriptor* bd = BlockDescriptor::Allocate((UInt32) byteCount);
return bd->ptrToData;
#endif
}

View File

@ -15,7 +15,7 @@ namespace Pomme::Files
SInt16 id;
Byte flags;
SInt32 size;
UInt32 dataOffset;
std::streamoff dataOffset;
std::string name;
};

View File

@ -163,7 +163,7 @@ void Mixer::SetMasterGain(double newGain)
{
if (newGain < 0)
newGain = 0;
gain = FX_FROM_FLOAT(newGain);
gain = (int) FX_FROM_FLOAT(newGain);
}
void Mixer::Process(int16_t* dst, int len)
@ -398,8 +398,8 @@ void Source::RecalcGains()
{
double l = this->gain * (pan <= 0. ? 1. : 1. - pan);
double r = this->gain * (pan >= 0. ? 1. : 1. + pan);
this->lgain = FX_FROM_FLOAT(l);
this->rgain = FX_FROM_FLOAT(r);
this->lgain = (int) FX_FROM_FLOAT(l);
this->rgain = (int) FX_FROM_FLOAT(r);
}
void Source::SetGain(double newGain)
@ -425,7 +425,7 @@ void Source::SetPitch(double newPitch)
{
newRate = 0.001;
}
rate = FX_FROM_FLOAT(newRate);
rate = (int) FX_FROM_FLOAT(newRate);
}
void Source::SetLoop(bool newLoop)