various small C++ warning fixes

This commit is contained in:
Noel Berry
2021-05-06 21:48:06 -07:00
parent fb91b77900
commit 04f6257b75
20 changed files with 87 additions and 89 deletions

View File

@ -156,13 +156,13 @@ namespace Blah
void rect_rounded_line(const Rect& rect, float radius, int steps, float t, Color color);
void rect_rounded_line(const Rect& rect, float rtl, int rtl_steps, float rtr, int rtr_steps, float rbr, int rbr_steps, float rbl, int rbl_steps, float t, Color color);
void semi_circle(Vec2 center, float start_radians, float end_radians, float radius, int steps, Color centerColor, Color edgeColor);
void semi_circle(Vec2 center, float start_radians, float end_radians, float radius, int steps, Color color);
void semi_circle_line(Vec2 center, float start_radians, float end_radians, float radius, int steps, float t, Color color);
void semi_circle(const Vec2& center, float start_radians, float end_radians, float radius, int steps, Color centerColor, Color edgeColor);
void semi_circle(const Vec2& center, float start_radians, float end_radians, float radius, int steps, Color color);
void semi_circle_line(const Vec2& center, float start_radians, float end_radians, float radius, int steps, float t, Color color);
void circle(const Vec2 center, float radius, int steps, Color color);
void circle(const Vec2 center, float radius, int steps, Color center_color, Color outer_color);
void circle_line(const Vec2 center, float raidus, float t, int steps, Color color);
void circle(const Vec2& center, float radius, int steps, Color color);
void circle(const Vec2& center, float radius, int steps, Color center_color, Color outer_color);
void circle_line(const Vec2& center, float radius, float t, int steps, Color color);
void quad(const Vec2& pos0, const Vec2& pos1, const Vec2& pos2, const Vec2& pos3, Color color);
void quad(const Vec2& pos0, const Vec2& pos1, const Vec2& pos2, const Vec2& pos3, Color col0, Color col1, Color col2, Color col3);

View File

@ -31,7 +31,7 @@ namespace Blah
static MaterialRef create(const ShaderRef& shader);
// Returns the Shader assigned to the Material.
const ShaderRef shader() const;
ShaderRef shader() const;
// Sets the texture
void set_texture(const char* name, const TextureRef& texture, int array_index = 0);

View File

@ -60,7 +60,7 @@ namespace Blah
bool save_jpg(Stream& stream, int quality) const;
// gets the pixels from the given source rectangle
void get_pixels(Color* dest, const Point& dest_pos, const Point& dest_size, RectI source_rect);
void get_pixels(Color* dest, const Point& dest_pos, const Point& dest_size, RectI source_rect) const;
// gets a sub image from this image
Image get_sub_image(const RectI& source_rect);

View File

@ -62,7 +62,7 @@ namespace Blah
Color operator*(float multiply) const;
// assignment from int
Color& operator= (const int rgb);
Color& operator= (int rgb);
// comparisons
bool operator ==(const Color& rhs) const;

View File

@ -19,7 +19,7 @@ namespace Blah
ElasticIn, ElasticOut, ElasticInOut,
BackIn, BackOut, BackInOut,
BounceIn, BounceOut, BounceInOut,
_Count
Count
};
namespace Ease
@ -285,7 +285,7 @@ namespace Blah
case Easers::BounceIn: return &bounce_in;
case Easers::BounceOut: return &bounce_out;
case Easers::BounceInOut: return &bounce_in_out;
case Easers::_Count:
case Easers::Count:
break;
}
@ -328,7 +328,7 @@ namespace Blah
case Easers::BounceIn: return "BounceIn";
case Easers::BounceOut: return "BounceOut";
case Easers::BounceInOut: return "BounceInOut";
case Easers::_Count:
case Easers::Count:
break;
}

View File

@ -13,17 +13,17 @@ namespace Blah
FileStream& operator=(FileStream&& fs) noexcept;
~FileStream();
virtual i64 length() const override;
virtual i64 position() const override;
virtual i64 seek(i64 seekTo) override;
virtual bool is_open() const override;
virtual bool is_readable() const override;
virtual bool is_writable() const override;
virtual void close() override;
i64 length() const override;
i64 position() const override;
i64 seek(i64 seekTo) override;
bool is_open() const override;
bool is_readable() const override;
bool is_writable() const override;
void close() override;
protected:
virtual i64 read_into(void* ptr, i64 length) override;
virtual i64 write_from(const void* ptr, i64 length) override;
i64 read_into(void* ptr, i64 length) override;
i64 write_from(const void* ptr, i64 length) override;
private:
FileMode m_mode;

View File

@ -10,22 +10,22 @@ namespace Blah
MemoryStream(char* data, i64 length);
MemoryStream(MemoryStream&& ms) noexcept;
MemoryStream& operator=(MemoryStream&& ms) noexcept;
~MemoryStream() { m_data = nullptr; m_length = m_position = 0; }
~MemoryStream() override { m_data = nullptr; m_length = m_position = 0; }
virtual i64 length() const override { return m_length; }
virtual i64 position() const override { return m_position; }
virtual i64 seek(i64 seekTo) override { return m_position = (seekTo < 0 ? 0 : (seekTo > m_length ? m_length : seekTo)); }
virtual bool is_open() const override { return m_data != nullptr; }
virtual bool is_readable() const override { return true; }
virtual bool is_writable() const override { return true; }
virtual void close() override { m_data = nullptr; m_length = m_position = 0; }
i64 length() const override { return m_length; }
i64 position() const override { return m_position; }
i64 seek(i64 seekTo) override { return m_position = (seekTo < 0 ? 0 : (seekTo > m_length ? m_length : seekTo)); }
bool is_open() const override { return m_data != nullptr; }
bool is_readable() const override { return true; }
bool is_writable() const override { return true; }
void close() override { m_data = nullptr; m_length = m_position = 0; }
char* data() { return m_data; }
const char* data() const { return m_data; }
protected:
virtual i64 read_into(void* ptr, i64 length) override;
virtual i64 write_from(const void* ptr, i64 length) override;
i64 read_into(void* ptr, i64 length) override;
i64 write_from(const void* ptr, i64 length) override;
private:
char* m_data;