Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang werror #386

Merged
merged 9 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Audio/include/Audio/DSP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class TapeStopDSP : public DSP
uint32 m_length = 0;
Vector<float> m_sampleBuffer;
float m_sampleIdx = 0.0f;
uint32 m_lastSample = 0;
uint32 m_currentSample = 0;
};

Expand All @@ -140,7 +139,6 @@ class RetriggerDSP : public DSP
uint32 m_gateLength = 0;
uint32 m_resetDuration = 0;
Vector<float> m_sampleBuffer;
uint32 m_loops = 0;
uint32 m_currentSample = 0;
bool m_bufferReserved = false;
};
Expand Down
2 changes: 0 additions & 2 deletions Audio/src/AudioStreamMa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ class AudioStreamMa : public AudioStreamBase
Buffer m_Internaldata;
float* m_pcm = nullptr;
int64 m_playbackPointer = 0;
uint64 m_dataPosition = 0;
const int sample_rate = 48000;
ma_decoder m_decoder = { };
int m_byteRate;
protected:
bool Init(Audio* audio, const String& path, bool preload) override;
int32 GetStreamPosition_Internal() override;
Expand Down
1 change: 0 additions & 1 deletion Audio/src/AudioStreamMp3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class AudioStreamMp3 : public AudioStreamBase
uint8* m_dataSource = 0;

Map<int32, size_t> m_frameIndices;
uint32 m_largetsFrameIndex;
Vector<float> m_pcm;
int64 m_playPos;

Expand Down
14 changes: 7 additions & 7 deletions Audio/src/Sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,31 +91,31 @@ class Sample_Impl : public SampleRes
}
m_lock.unlock();
}
const Buffer& GetData() const
const Buffer& GetData() const override
{
return m_data;
}
uint32 GetBitsPerSample() const
uint32 GetBitsPerSample() const override
{
return 32;
}
uint32 GetNumChannels() const
uint32 GetNumChannels() const override
{
return 2;
}
int32 GetPosition() const
int32 GetPosition() const override
{
return m_playbackPointer;
}
float* GetPCM()
float* GetPCM() override
{
return nullptr;
}
uint32 GetSampleRate() const
uint32 GetSampleRate() const override
{
return g_audio->GetSampleRate();
}
bool IsPlaying() const
bool IsPlaying() const override
{
return m_playing;
}
Expand Down
30 changes: 15 additions & 15 deletions Graphics/include/Graphics/ParticleParameter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ namespace Graphics
};

// Macro for implementing the Duplicate() function
#define IMPLEMENT_DUPLICATE(__type, __self) IParticleParameter<__type>* Duplicate() const { return new __self(*this); }
#define IMPLEMENT_DUPLICATE(__type, __self) IParticleParameter<__type>* Duplicate() const override { return new __self(*this); }

/* A constant value at all times */
template<typename T>
class PPConstant : public IParticleParameter<T>
{
public:
PPConstant(const T& val) : val(val) {};
virtual T Sample(float in) override
T Sample(float in) override
{
return val;
}
virtual T GetMax()
T GetMax() override
{
return val;
}
Expand All @@ -51,15 +51,15 @@ namespace Graphics
{
public:
PPRandomRange(const T& min, const T& max) : min(min), max(max) { delta = max - min; };
virtual T Init(float systemTime) override
T Init(float systemTime) override
{
return Sample(Random::Float());
}
virtual T Sample(float in) override
T Sample(float in) override
{
return (max - min) * in + min;
}
virtual T GetMax()
T GetMax() override
{
return Math::Max(max, min);
}
Expand All @@ -75,11 +75,11 @@ namespace Graphics
{
public:
PPRange(const T& min, const T& max) : min(min), max(max) { delta = max - min; };
virtual T Sample(float in) override
T Sample(float in) override
{
return (max - min) * in + min;
}
virtual T GetMax()
T GetMax() override
{
return Math::Max(max, min);
}
Expand All @@ -99,7 +99,7 @@ namespace Graphics
delta = max - min;
rangeOut = 1.0f - fadeIn;
};
virtual T Sample(float in) override
T Sample(float in) override
{
if(in < fadeIn)
{
Expand All @@ -110,7 +110,7 @@ namespace Graphics
return (in - fadeIn) / rangeOut * (max - min) + min;
}
}
virtual T GetMax()
T GetMax() override
{
return Math::Max(max, min);
}
Expand All @@ -129,11 +129,11 @@ namespace Graphics
PPSphere(float radius) : radius(radius)
{
}
virtual Vector3 Sample(float in) override
Vector3 Sample(float in) override
{
return Vector3(Random::FloatRange(-1.0f, 1.0f), Random::FloatRange(-1.0f, 1.0f), Random::FloatRange(-1.0f, 1.0f)) * radius;
}
virtual Vector3 GetMax()
Vector3 GetMax() override
{
return Vector3(radius);
}
Expand All @@ -149,15 +149,15 @@ namespace Graphics
PPBox(Vector3 size) : size(size)
{
}
virtual Vector3 Sample(float in) override
Vector3 Sample(float in) override
{
Vector3 offset = -size * 0.5f;
offset.x += Random::Float() * size.x;
offset.y += Random::Float() * size.y;
offset.z += Random::Float() * size.z;
return offset;
}
virtual Vector3 GetMax()
Vector3 GetMax() override
{
return size;
}
Expand Down Expand Up @@ -210,7 +210,7 @@ namespace Graphics
v *= length;
return v;
}
virtual Vector3 GetMax()
Vector3 GetMax() override
{
return Vector3(0, 0, lengthMax);
}
Expand Down
2 changes: 1 addition & 1 deletion Graphics/src/Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ namespace Graphics
bool FontRes::InitLibrary()
{
ProfilerScope $("Font library initialization");
if(!FT_Init_FreeType(&library) == FT_Err_Ok)
if(FT_Init_FreeType(&library) != FT_Err_Ok)
return false;

if(!LoadFallbackFont())
Expand Down
2 changes: 1 addition & 1 deletion Graphics/src/ImageLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace Graphics
bool Load(ImageRes* pImage, Buffer& b)
{
// Check for PNG based on first 4 bytes
if (*(uint32*)b.data() == (uint32&)"\x89PNG")
if (std::memcmp(b.data(), "\x89PNG", 4) == 0)
return LoadPNG(pImage, b);
else // jay-PEG ?
return LoadJPEG(pImage, b);
Expand Down
6 changes: 3 additions & 3 deletions Graphics/src/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace Graphics
glDeleteProgramPipelines(1, &m_pipeline);
#endif
}
void AssignShader(ShaderType t, Shader shader)
void AssignShader(ShaderType t, Shader shader) override
{
m_shaders[(size_t)t] = shader;

Expand Down Expand Up @@ -241,7 +241,7 @@ namespace Graphics
}

// Bind only parameters
virtual void BindParameters(const MaterialParameterSet& params, const Transform& worldTransform)
void BindParameters(const MaterialParameterSet& params, const Transform& worldTransform) override
{
BindAll(SV_World, worldTransform);
for(auto p : params)
Expand Down Expand Up @@ -300,7 +300,7 @@ namespace Graphics
}
}

virtual void BindToContext()
void BindToContext() override
{
// Bind pipeline to context
#ifdef EMBEDDED
Expand Down
12 changes: 6 additions & 6 deletions Graphics/src/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace Graphics
return m_buffer != 0 && m_vao != 0;
}

virtual void SetData(const void* pData, size_t vertexCount, const VertexFormatList& desc)
void SetData(const void* pData, size_t vertexCount, const VertexFormatList& desc) override
{
glBindVertexArray(m_vao);
glBindBuffer(GL_ARRAY_BUFFER, m_buffer);
Expand Down Expand Up @@ -86,31 +86,31 @@ namespace Graphics
}

#ifdef EMBEDDED
virtual void Draw()
void Draw() override
{
glBindVertexArray(m_vao);
glDrawArrays(m_glType, 0, (int)m_vertexCount);
glBindVertexArray(0);
}
virtual void Redraw()
void Redraw() override
{
glBindVertexArray(m_vao);
glDrawArrays(m_glType, 0, (int)m_vertexCount);
glBindVertexArray(0);
}
#else
virtual void Draw()
void Draw() override
{
glBindVertexArray(m_vao);
glDrawArrays(m_glType, 0, (int)m_vertexCount);
}
virtual void Redraw()
void Redraw() override
{
glDrawArrays(m_glType, 0, (int)m_vertexCount);
}
#endif

virtual void SetPrimitiveType(PrimitiveType pt)
void SetPrimitiveType(PrimitiveType pt) override
{
m_type = pt;
m_glType = primitiveTypeMap[(size_t)pt];
Expand Down
4 changes: 2 additions & 2 deletions Graphics/src/ParticleSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ namespace Graphics
it++;
}
}
virtual Ref<ParticleEmitter> AddEmitter() override
Ref<ParticleEmitter> AddEmitter() override
{
Ref<ParticleEmitter> newEmitter = Utility::MakeRef<ParticleEmitter>(new ParticleEmitter(this));
m_emitters.Add(newEmitter);
return newEmitter;
}
virtual void Reset()
void Reset() override
{
for(auto em : m_emitters)
{
Expand Down
10 changes: 5 additions & 5 deletions Graphics/src/Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ namespace Graphics

#endif

bool UpdateHotReload()
bool UpdateHotReload() override
{
#ifdef _WIN32
if(m_changeNotification != INVALID_HANDLE_VALUE)
Expand Down Expand Up @@ -201,19 +201,19 @@ namespace Graphics
return LoadProgram(m_prog);
}
#ifndef EMBEDDED
virtual void Bind()
void Bind() override
{
if(m_gl->m_activeShaders[(size_t)m_type] != this)
{
glUseProgramStages(m_gl->m_mainProgramPipeline, shaderStageMap[(size_t)m_type], m_prog);
m_gl->m_activeShaders[(size_t)m_type] = this;
}
}
virtual bool IsBound() const
bool IsBound() const override
{
return m_gl->m_activeShaders[(size_t)m_type] == this;
}
virtual uint32 GetLocation(const String& name) const
uint32 GetLocation(const String& name) const override
{
return glGetUniformLocation(m_prog, name.c_str());
}
Expand Down Expand Up @@ -271,7 +271,7 @@ namespace Graphics
return m_prog;
}

String GetOriginalName() const
String GetOriginalName() const override
{
return m_sourcePath;
}
Expand Down
10 changes: 5 additions & 5 deletions Graphics/src/SpriteMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace Graphics
{
Clear();
}
virtual void Clear()
void Clear() override
{
for(auto s : m_segments)
{
Expand Down Expand Up @@ -133,7 +133,7 @@ namespace Graphics

return *dstCat;
}
virtual uint32 AddSegment(Image image)
uint32 AddSegment(Image image) override
{
// Create a new segment
uint32 nI = (uint32)m_segments.size();
Expand Down Expand Up @@ -174,16 +174,16 @@ namespace Graphics
pDst += (nDstPitch - srcSize.x);
}
}
virtual Recti GetCoords(uint32 nIndex)
Recti GetCoords(uint32 nIndex) override
{
assert(nIndex < m_segments.size());
return m_segments[nIndex]->coords;
}
virtual Ref<ImageRes> GetImage() override
Ref<ImageRes> GetImage() override
{
return m_image;
}
virtual Texture GenerateTexture(OpenGL* gl)
Texture GenerateTexture(OpenGL* gl) override
{
Texture tex = TextureRes::Create(gl, m_image);
tex->SetWrap(TextureWrap::Clamp, TextureWrap::Clamp);
Expand Down
Loading