Fix a warning on compiling with clang (#5258)
This commit is contained in:
parent
88abae649c
commit
4cbff97c43
|
@ -95,7 +95,7 @@ inline const char * const *EnumNamesBaseType() {
|
|||
|
||||
inline const char *EnumNameBaseType(BaseType e) {
|
||||
if (e < None || e > Union) return "";
|
||||
const size_t index = static_cast<int>(e);
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesBaseType()[index];
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ inline const char * const *EnumNamesColor() {
|
|||
|
||||
inline const char *EnumNameColor(Color e) {
|
||||
if (e < Color_Red || e > Color_Blue) return "";
|
||||
const size_t index = static_cast<int>(e);
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesColor()[index];
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ inline const char * const *EnumNamesEquipment() {
|
|||
|
||||
inline const char *EnumNameEquipment(Equipment e) {
|
||||
if (e < Equipment_NONE || e > Equipment_Weapon) return "";
|
||||
const size_t index = static_cast<int>(e);
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesEquipment()[index];
|
||||
}
|
||||
|
||||
|
|
|
@ -1017,10 +1017,10 @@ class CppGenerator : public BaseGenerator {
|
|||
" || e > " + GetEnumValUse(enum_def, *enum_def.vals.vec.back()) +
|
||||
") return \"\";";
|
||||
|
||||
code_ += " const size_t index = static_cast<int>(e)\\";
|
||||
code_ += " const size_t index = static_cast<size_t>(e)\\";
|
||||
if (enum_def.vals.vec.front()->value) {
|
||||
auto vals = GetEnumValUse(enum_def, *enum_def.vals.vec.front());
|
||||
code_ += " - static_cast<int>(" + vals + ")\\";
|
||||
code_ += " - static_cast<size_t>(" + vals + ")\\";
|
||||
}
|
||||
code_ += ";";
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ inline const char * const *EnumNamesColor() {
|
|||
|
||||
inline const char *EnumNameColor(Color e) {
|
||||
if (e < Color_Red || e > Color_Blue) return "";
|
||||
const size_t index = static_cast<int>(e) - static_cast<int>(Color_Red);
|
||||
const size_t index = static_cast<size_t>(e) - static_cast<size_t>(Color_Red);
|
||||
return EnumNamesColor()[index];
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ inline const char * const *EnumNamesAny() {
|
|||
|
||||
inline const char *EnumNameAny(Any e) {
|
||||
if (e < Any_NONE || e > Any_MyGame_Example2_Monster) return "";
|
||||
const size_t index = static_cast<int>(e);
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesAny()[index];
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ inline const char * const *EnumNamesAnyUniqueAliases() {
|
|||
|
||||
inline const char *EnumNameAnyUniqueAliases(AnyUniqueAliases e) {
|
||||
if (e < AnyUniqueAliases_NONE || e > AnyUniqueAliases_M2) return "";
|
||||
const size_t index = static_cast<int>(e);
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesAnyUniqueAliases()[index];
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ inline const char * const *EnumNamesAnyAmbiguousAliases() {
|
|||
|
||||
inline const char *EnumNameAnyAmbiguousAliases(AnyAmbiguousAliases e) {
|
||||
if (e < AnyAmbiguousAliases_NONE || e > AnyAmbiguousAliases_M3) return "";
|
||||
const size_t index = static_cast<int>(e);
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesAnyAmbiguousAliases()[index];
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ inline const char * const *EnumNamesEnumInNestedNS() {
|
|||
|
||||
inline const char *EnumNameEnumInNestedNS(EnumInNestedNS e) {
|
||||
if (e < EnumInNestedNS_A || e > EnumInNestedNS_C) return "";
|
||||
const size_t index = static_cast<int>(e);
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesEnumInNestedNS()[index];
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ inline const char * const *EnumNamesCharacter() {
|
|||
|
||||
inline const char *EnumNameCharacter(Character e) {
|
||||
if (e < Character_NONE || e > Character_Unused) return "";
|
||||
const size_t index = static_cast<int>(e);
|
||||
const size_t index = static_cast<size_t>(e);
|
||||
return EnumNamesCharacter()[index];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue