diff --git a/src/GUI/AirportList.hxx b/src/GUI/AirportList.hxx index 99d131f56..7a3cfaef8 100644 --- a/src/GUI/AirportList.hxx +++ b/src/GUI/AirportList.hxx @@ -1,10 +1,20 @@ // AirportList.hxx - scrolling list of airports. -#ifndef __AIRPORTLIST_HXX -#define __AIRPORTLIST_HXX +/* + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#pragma once #include + +// ensure we include this before puAux.h, so that +// #define _PU_H_ 1 has been done, and hence we don't +// include the un-modified system pu.h +#include "FlightGear_pu.h" + #include + #include "FGPUIDialog.hxx" class FGAirportList; @@ -23,4 +33,3 @@ private: std::string _filter; }; -#endif // __AIRPORTLIST_HXX diff --git a/src/GUI/FGPUIDialog.hxx b/src/GUI/FGPUIDialog.hxx index de342397d..30b274254 100644 --- a/src/GUI/FGPUIDialog.hxx +++ b/src/GUI/FGPUIDialog.hxx @@ -1,9 +1,18 @@ // FGPUIDialog.hxx - XML-configured dialog box. +/* + * SPDX-FileCopyrightText: 2012 (C) James Turner + * SPDX-License-Identifier: GPL-2.0-or-later + */ #pragma once #include "dialog.hxx" +// ensure we include this before puAux.h, so that +// #define _PU_H_ 1 has been done, and hence we don't +// include the un-modified system pu.h +#include "FlightGear_pu.h" + #include #include diff --git a/src/GUI/FlightGear_pu.h b/src/GUI/FlightGear_pu.h index 08a9e9bbd..35c3fc1c0 100644 --- a/src/GUI/FlightGear_pu.h +++ b/src/GUI/FlightGear_pu.h @@ -377,6 +377,10 @@ protected: int * getIntegerp ( void ) { return res_integer != NULL ? res_integer : &integer ; } float * getFloaterp ( void ) { return res_floater != NULL ? res_floater : &floater ; } char * getStringp ( void ) { return res_string != NULL ? res_string : string ; } + + // added by James to allow sprintf -> snprintf migration + int getStringLength() { return res_string != NULL ? res_string_sz : string_size ;} + bool * getBooleanp ( void ) { return res_bool != NULL ? res_bool : &boolean ; } void enableConversion ( void ) { convert = TRUE ; } @@ -468,7 +472,9 @@ public: if ( convert == TRUE ) { - *getFloaterp () = (float) i ; sprintf ( getStringp (), "%d", i ) ; *getBooleanp () = ( i != 0 ) ; + *getFloaterp () = (float) i ; + snprintf ( getStringp (), getStringLength(), "%d", i ) ; + *getBooleanp () = ( i != 0 ) ; } puPostRefresh () ; @@ -480,7 +486,9 @@ public: if ( convert == TRUE ) { - *getIntegerp () = (int) f ; sprintf ( getStringp (), "%g", f ) ; *getBooleanp () = ( f != 0.0 ) ; + *getIntegerp () = (int) f ; + snprintf ( getStringp (), getStringLength(), "%g", f ) ; + *getBooleanp () = ( f != 0.0 ) ; } puPostRefresh () ; @@ -494,7 +502,9 @@ public: if ( convert == TRUE ) { - *getIntegerp () = b ? 1 : 0 ; *getFloaterp () = b ? 1.0f : 0.0f ; sprintf ( getStringp (), "%s", b ? "1" : "0" ) ; + *getIntegerp () = b ? 1 : 0 ; + *getFloaterp () = b ? 1.0f : 0.0f ; + snprintf ( getStringp (), getStringLength(), "%s", b ? "1" : "0" ) ; } puPostRefresh () ; diff --git a/src/GUI/MapWidget.cxx b/src/GUI/MapWidget.cxx index 0472950e2..3b195c7ea 100644 --- a/src/GUI/MapWidget.cxx +++ b/src/GUI/MapWidget.cxx @@ -1,11 +1,20 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +/* + * SPDX-FileCopyrightText: (C) 2010 James Turner + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "config.h" #include "MapWidget.hxx" #include #include // for std::sort + +// ensure we include this before puAux.h, so that +// #define _PU_H_ 1 has been done, and hence we don't +// include the un-modified system pu.h +#include "FlightGear_pu.h" + #include #include diff --git a/src/GUI/MapWidget.hxx b/src/GUI/MapWidget.hxx index 03728c4e6..84764a513 100644 --- a/src/GUI/MapWidget.hxx +++ b/src/GUI/MapWidget.hxx @@ -1,5 +1,9 @@ -#ifndef GUI_MAPWIDGET_HXX -#define GUI_MAPWIDGET_HXX +/* + * SPDX-FileCopyrightText: (C) 2010 James Turner + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#pragma once #include #include @@ -158,5 +162,3 @@ private: double _gridSpacing; SGGeod _gridCenter; }; - -#endif // of GUI_MAPWIDGET_HXX diff --git a/src/GUI/new_gui.cxx b/src/GUI/new_gui.cxx index f1015a2aa..fb7724972 100644 --- a/src/GUI/new_gui.cxx +++ b/src/GUI/new_gui.cxx @@ -1,5 +1,9 @@ // new_gui.cxx: implementation of XML-configurable GUI support. +/* + * SPDX-License-Identifier: GPL-2.0-or-later + */ + #include #include "new_gui.hxx" @@ -35,6 +39,11 @@ #endif #if defined(HAVE_PUI) + // ensure we include this before puAux.h, so that + // #define _PU_H_ 1 has been done, and hence we don't + // include the un-modified system pu.h + #include "FlightGear_pu.h" + #include #endif diff --git a/src/GUI/property_list.hxx b/src/GUI/property_list.hxx index 8e1780fb2..0aa5cec35 100644 --- a/src/GUI/property_list.hxx +++ b/src/GUI/property_list.hxx @@ -25,6 +25,11 @@ #include +// ensure we include this before puAux.h, so that +// #define _PU_H_ 1 has been done, and hence we don't +// include the un-modified system pu.h +#include "FlightGear_pu.h" + #include #include #include "FGPUIDialog.hxx"