diff --git a/src/libs/portability/portability.h b/src/libs/portability/portability.h index a735fec19..d2ef5306d 100644 --- a/src/libs/portability/portability.h +++ b/src/libs/portability/portability.h @@ -114,6 +114,21 @@ PORTABILITY_API char *strtok_r(char *str, const char *delim, char **nextp); #endif #if _MSC_VER < 1800 #define copysign _copysign + +#include + +namespace std +{ + inline string to_string(size_t value) + { + return to_string(static_cast(value)); + } + + inline string to_string(int value) + { + return to_string(static_cast(value)); + } +} #endif #include diff --git a/src/modules/userinterface/legacymenu/racescreens/carsetupmenu.cpp b/src/modules/userinterface/legacymenu/racescreens/carsetupmenu.cpp index c6cbfb7a1..28726b99d 100644 --- a/src/modules/userinterface/legacymenu/racescreens/carsetupmenu.cpp +++ b/src/modules/userinterface/legacymenu/racescreens/carsetupmenu.cpp @@ -30,6 +30,7 @@ This file deals with car setup #include #include #include +#include #include "carsetupmenu.h" @@ -394,7 +395,7 @@ void CarSetupMenu::loadSettings() } attribute &att = items[page][index]; - std::string strIndex(std::to_string(static_cast(index))); + std::string strIndex(std::to_string(index)); att.labelId = getDynamicControlId(std::string("Label" + strIndex).c_str()); att.editId = getDynamicControlId(std::string("Edit" + strIndex).c_str()); @@ -468,7 +469,7 @@ void CarSetupMenu::loadSettings() for (size_t index = 0; index < ITEMS_PER_PAGE; ++index) { attribute &att = items[page][index]; - std::string strIndex(std::to_string(static_cast(index))); + std::string strIndex(std::to_string(index)); if (!att.labelId) att.labelId = getDynamicControlId(std::string("Label" + strIndex).c_str()); @@ -600,7 +601,7 @@ bool CarSetupMenu::initialize(void *pPrevMenu, const GfRace *pRace, const GfDriv // Create items. for (size_t index = 0; index < ITEMS_PER_PAGE; ++index) { - std::string strIndex(std::to_string(static_cast(index))); + std::string strIndex(std::to_string(index)); createLabelControl(std::string("Label" + strIndex).c_str()); createEditControl(std::string("Edit" + strIndex).c_str(), this, NULL, NULL); createComboboxControl(std::string("Combo" + strIndex).c_str(), &comboCallbackData[index], onComboCallback); diff --git a/src/tools/trackgen/util.cpp b/src/tools/trackgen/util.cpp index 9ec5ac361..a319b8349 100644 --- a/src/tools/trackgen/util.cpp +++ b/src/tools/trackgen/util.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include "trackgen.h" #include "util.h" @@ -411,7 +412,7 @@ std::ostream &operator << (std::ostream &out, tSegType type) out << (type == TR_RGT ? "TR_RGT" : type == TR_LFT ? "TR_LFT" : type == TR_STR ? "TR_STR" : - std::to_string(static_cast(type))); + std::to_string(type)); return out; } @@ -423,7 +424,7 @@ std::ostream &operator << (std::ostream &out, tSegType2 type2) type2 == TR_RSIDE ? "TR_RSIDE" : type2 == TR_LBORDER ? "TR_LBORDER" : type2 == TR_RBORDER ? "TR_RBORDER" : - std::to_string(static_cast(type2))); + std::to_string(type2)); return out; } @@ -435,7 +436,7 @@ std::ostream &operator << (std::ostream &out, tSegStyle style) style == TR_WALL ? "TR_WALL" : style == TR_FENCE ? "TR_FENCE" : style == TR_PITBUILDING ? "TR_PITBUILDING" : - std::to_string(static_cast(style))); + std::to_string(style)); return out; } @@ -491,7 +492,7 @@ void dumpSeg(std::ofstream &ofs,const tTrackSeg *seg, const std::string & indent ofs << indent << "vertex[2] " << seg->vertex[2] << std::endl; ofs << indent << "vertex[3] " << seg->vertex[3] << std::endl; ofs << indent << "angle "; - for (int i = 0; i < 7; ++i) + for (size_t i = 0; i < 7; ++i) ofs << seg->angle[i] << " "; ofs << std::endl; ofs << indent << "sin " << seg->sin << std::endl;