Fix gcc-4.9 build of similar/main/net_udp.cpp

gcc-4.9 std::array::size() is `constexpr`, but gcc-4.9 refuses to
initialize a local `constexpr std::size_t` from the result of calling
`size()` on a `std::array`.  Later gcc permit this.  gcc-8 generates the
same code whether the variable is `constexpr std::size_t` or `const
std::size_t`, and the latter allows gcc-4.9 to build, so remove
`constexpr` and use plain `const`.

Reported-by: joolswills <https://github.com/dxx-rebirth/dxx-rebirth/issues/411>
Fixes: 91d6285751 ("Factor out shortening game/mission names")
This commit is contained in:
Kp 2018-10-20 17:25:59 +00:00
parent ea5020a773
commit 7e9ec36018

View file

@ -1049,7 +1049,7 @@ static void copy_truncate_string(const grs_font &cv_font, const font_x_scaled_fl
size_t k = 0, x = 0;
char thold[2];
thold[1] = 0;
constexpr std::size_t outsize = out.size();
const std::size_t outsize = out.size();
range_for (const char c, in)
{
if (unlikely(c == '\t'))
@ -1061,7 +1061,7 @@ static void copy_truncate_string(const grs_font &cv_font, const font_x_scaled_fl
gr_get_string_size(cv_font, thold, &tx, nullptr, nullptr);
if ((x += tx) >= strbound)
{
constexpr std::size_t outbound = outsize - 4;
const std::size_t outbound = outsize - 4;
if (k > outbound)
k = outbound;
out[k] = out[k + 1] = out[k + 2] = '.';