]> git.mxchange.org Git - flightgear.git/commitdiff
IRIX/MipsPro 7.2 doesn't have strndup. Work around it.
authorehofman <ehofman>
Fri, 28 Nov 2003 10:25:33 +0000 (10:25 +0000)
committerehofman <ehofman>
Fri, 28 Nov 2003 10:25:33 +0000 (10:25 +0000)
src/GUI/AirportList.cxx

index 43cee70ab522fd361d336f6c78c54a2e5dbdc6a4..3f97342dee4707a1b554b425d8770b8b0af161dc 100644 (file)
@@ -18,7 +18,9 @@ AirportList::AirportList (int x, int y, int width, int height)
         snprintf(buf, 1023, "%s  %s\n",
                  airport->id.c_str(),
                  airport->name.c_str());
-        _content[i] = strndup(buf, 1023);
+        int str_len = strlen(buf);
+        _content[i] = new char[(str_len > 1023) ? 1024 : str_len];
+        strncpy(_content[i], buf, 1023);
     }
     _content[_nAirports] = 0;
     newList(_content);