- fixed warnings in common code.

This commit is contained in:
Christoph Oelckers 2021-10-08 19:07:56 +02:00
parent 29769dd673
commit 39319a9582
7 changed files with 20 additions and 18 deletions

View file

@ -532,7 +532,7 @@ public:
SmkPlayer* pId = (SmkPlayer*)userdata;
memcpy(buff, &pId->adata.samples[pId->adata.nRead], len);
pId->adata.nRead += len / 2;
if (pId->adata.nRead >= countof(pId->adata.samples)) pId->adata.nRead = 0;
if (pId->adata.nRead >= (int)countof(pId->adata.samples)) pId->adata.nRead = 0;
return true;
}
@ -541,7 +541,7 @@ public:
for (unsigned i = 0; i < count; i++)
{
adata.samples[adata.nWrite] = (audioBuffer[i] - 128) << 8;
if (++adata.nWrite >= countof(adata.samples)) adata.nWrite = 0;
if (++adata.nWrite >= (int)countof(adata.samples)) adata.nWrite = 0;
}
}
@ -551,7 +551,7 @@ public:
for (unsigned i = 0; i < count/2; i++)
{
adata.samples[adata.nWrite] = *ptr++;
if (++adata.nWrite >= countof(adata.samples)) adata.nWrite = 0;
if (++adata.nWrite >= (int)countof(adata.samples)) adata.nWrite = 0;
}
}
@ -789,7 +789,7 @@ DEFINE_ACTION_FUNCTION(_MoviePlayer, Create)
auto movie = OpenMovie(filename, *sndinf, frametime == -1? nullptr : frametimes, flags, error);
if (!movie)
{
Printf(TEXTCOLOR_YELLOW, "%s", error.GetChars());
Printf(TEXTCOLOR_YELLOW "%s", error.GetChars());
}
ACTION_RETURN_POINTER(movie);
}

View file

@ -97,7 +97,7 @@ static bool StreamCallbackFunc(SoundStream* stream, void* buff, int len, void* u
InterplayDecoder* pId = (InterplayDecoder*)userdata;
memcpy(buff, &pId->audio.samples[pId->audio.nRead], len);
pId->audio.nRead += len / 2;
if (pId->audio.nRead >= countof(pId->audio.samples)) pId->audio.nRead = 0;
if (pId->audio.nRead >= (int)countof(pId->audio.samples)) pId->audio.nRead = 0;
return true;
}
@ -364,7 +364,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
}
audio.samples[audio.nWrite++] = predictor[ch];
if (audio.nWrite >= countof(audio.samples)) audio.nWrite = 0;
if (audio.nWrite >= (int)countof(audio.samples)) audio.nWrite = 0;
}
int ch = 0;
@ -374,7 +374,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
predictor[ch] = clamp(predictor[ch], -32768, 32768);
audio.samples[audio.nWrite++] = predictor[ch];
if (audio.nWrite >= countof(audio.samples)) audio.nWrite = 0;
if (audio.nWrite >= (int)countof(audio.samples)) audio.nWrite = 0;
// toggle channel
ch ^= audio.nChannels - 1;
@ -442,7 +442,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
}
else
{
if (opcodeSize != decodeMap.nSize) {
if (opcodeSize != (int)decodeMap.nSize) {
delete[] decodeMap.pData;
decodeMap.pData = new uint8_t[opcodeSize];
decodeMap.nSize = opcodeSize;

View file

@ -266,7 +266,7 @@ bool FZipFile::Open(bool quiet, LumpFilterInfo* filter)
// at least one of the more common definition lumps must be present.
for (auto &p : filter->requiredPrefixes)
{
if (name.IndexOf(name0 + p) == 0 || name.LastIndexOf(p) == name.Len() - strlen(p))
if (name.IndexOf(name0 + p) == 0 || name.LastIndexOf(p) == ptrdiff_t(name.Len() - strlen(p)))
{
foundspeciallump = true;
break;

View file

@ -686,7 +686,7 @@ int FFont::GetColorTranslation (EColorRange range, PalEntry *color) const
{
// Single pic fonts do not set up their translation table and must always return 0.
if (Translations.Size() == 0) return 0;
assert(Translations.Size() == NumTextColors);
assert(Translations.Size() == (unsigned)NumTextColors);
if (noTranslate)
{

View file

@ -159,7 +159,7 @@ void FGLRenderer::DrawPresentTexture(const IntRect &box, bool applyGamma)
mPresentShader->Uniforms.SetData();
for (int n = 0; n < mPresentShader->Uniforms.mFields.size(); n++)
for (size_t n = 0; n < mPresentShader->Uniforms.mFields.size(); n++)
{
int index = -1;
UniformFieldDesc desc = mPresentShader->Uniforms.mFields[n];
@ -175,6 +175,8 @@ void FGLRenderer::DrawPresentTexture(const IntRect &box, bool applyGamma)
case UniformType::Vec2:
glUniform2fv(loc,1 , ((GLfloat*)(((char*)(&mPresentShader->Uniforms)) + desc.Offset)));
break;
default:
break;
}
}

View file

@ -116,13 +116,13 @@ bool FGLRenderState::ApplyShader()
addLights = (int(lightPtr[3]) - int(lightPtr[2])) / LIGHT_VEC4_NUM;
// Here we limit the number of lights, but dont' change the light data so priority has to be mod, sub then add
if (modLights > gles.maxlights)
if (modLights > (int)gles.maxlights)
modLights = gles.maxlights;
if (modLights + subLights > gles.maxlights)
if (modLights + subLights > (int)gles.maxlights)
subLights = gles.maxlights - modLights;
if (modLights + subLights + addLights > gles.maxlights)
if (modLights + subLights + addLights > (int)gles.maxlights)
addLights = gles.maxlights - modLights - subLights;
totalLights = modLights + subLights + addLights;
@ -332,7 +332,7 @@ bool FGLRenderState::ApplyShader()
// Calculate the total number of vec4s we need
int totalVectors = totalLights * LIGHT_VEC4_NUM;
if (totalVectors > gles.numlightvectors)
if (totalVectors > (int)gles.numlightvectors)
totalVectors = gles.numlightvectors;
glUniform4fv(activeShader->cur->lights_index, totalVectors, lightPtr);

View file

@ -272,7 +272,7 @@ void FPresentShaderBase::Init(const char * vtx_shader_name, const char * program
Uniforms.UniformLocation.resize(Uniforms.mFields.size());
for (int n = 0; n < Uniforms.mFields.size(); n++)
for (size_t n = 0; n < Uniforms.mFields.size(); n++)
{
int index = -1;
UniformFieldDesc desc = Uniforms.mFields[n];