From: jmt Date: Tue, 23 Feb 2010 00:17:53 +0000 (+0000) Subject: waypointList: stop using GNU extension / C99 features. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f0e72608a744d8b7cdebb6a65ba2db8ed5ac073b;p=flightgear.git waypointList: stop using GNU extension / C99 features. --- diff --git a/src/GUI/WaypointList.cxx b/src/GUI/WaypointList.cxx index 0ad02a30d..5498076e5 100644 --- a/src/GUI/WaypointList.cxx +++ b/src/GUI/WaypointList.cxx @@ -108,15 +108,14 @@ static void drawClippedString(puFont& font, const char* s, int x, int y, int max return; } - int len = strlen(s); - char buf[len]; - memcpy(buf, s, len); + std::string buf(s); + int len = buf.size(); do { - buf[--len] = 0; - fullWidth = font.getStringWidth(buf); + buf.resize(--len); + fullWidth = font.getStringWidth(buf.c_str()); } while (fullWidth > maxWidth); - font.drawString(buf, x, y); + font.drawString(buf.c_str(), x, y); } //////////////////////////////////////////////////////////////////////////////