Skip to content

Commit 2190b2d

Browse files
committed
Fix issues found with clang-17
1 parent e72945f commit 2190b2d

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ macro(lxgui_set_warning_level target)
136136
target_compile_options(${target} PRIVATE -Wno-missing-noreturn)
137137
target_compile_options(${target} PRIVATE -Wno-shadow-uncaptured-local)
138138
target_compile_options(${target} PRIVATE -Wno-undefined-func-template)
139+
target_compile_options(${target} PRIVATE -Wno-unsafe-buffer-usage)
139140
target_compile_options(${target} PRIVATE -fno-limit-debug-info)
140141

141142
if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")

impl/gui/gl/src/gui_gl_renderer_png.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ renderer::create_material_png_(const std::string& file_name, material::filter fi
3434
if (!file.good() || png_sig_cmp(signature, 0, pngsigsize) != 0) {
3535
throw gui::exception(
3636
"gui::gl::manager", file_name + "' is not a valid PNG image: '" +
37-
std::string(signature, signature + pngsigsize) + "'.");
37+
std::string(std::begin(signature), std::end(signature)) + "'.");
3838
}
3939

4040
png_structp read_struct = nullptr;
@@ -81,7 +81,7 @@ renderer::create_material_png_(const std::string& file_name, material::filter fi
8181
std::vector<png_bytep> rows(height);
8282

8383
for (std::size_t i = 0; i < height; ++i)
84-
rows[i] = reinterpret_cast<png_bytep>(data.data() + i * width);
84+
rows[i] = reinterpret_cast<png_bytep>(&data[i * width]);
8585

8686
png_read_image(read_struct, rows.data());
8787

impl/input/sdl/src/input_sdl_source.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ void source::on_sdl_event(const SDL_Event& event) {
320320
}
321321
break;
322322
}
323+
default: break;
323324
}
324325
}
325326

include/lxgui/gui_region.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ const ObjectType* down_cast(const region* self) {
857857
template<typename ObjectType>
858858
const ObjectType& down_cast(const region& self) {
859859
const ObjectType* object = dynamic_cast<const ObjectType*>(self);
860-
if (self && !object) {
860+
if (!object) {
861861
if (self.is_region_type(ObjectType::class_name)) {
862862
throw gui::exception(
863863
self.get_region_type(), "cannot use down_cast() to " +

include/lxgui/gui_vector2.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ struct vector2 {
6666

6767
vector2 get_scaled(const vector2& v) const noexcept {
6868
vector2 vec = *this;
69-
vec.scale(v);
69+
vec.x *= v.x;
70+
vec.y *= v.y;
7071
return vec;
7172
}
7273

0 commit comments

Comments
 (0)