Rangi42 / tilemap-studio

A tilemap editor for Game Boy, Color, Advance, DS, and SNES projects. Written in C++ with FLTK.
https://hax.iimarckus.org/topic/7691/
Other
381 stars 30 forks source link

Avoid a compiler warning from `gcc` #64

Closed Rangi42 closed 2 years ago

Rangi42 commented 2 years ago

In tilemap-format.cpp:

-bytes.reserve(n * 2 + NDS_HEADER_SIZE);
+bytes.reserve(std::max(n * 2 + NDS_HEADER_SIZE, (size_t)NDS_HEADER_SIZE));

This will ensure it has at least NDS_HEADER_SIZE bytes despite overflow, so the subsequent insert will work.