mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-26 05:51:30 +00:00
fixed potentially undefined behavior with bool parameters in direct native functions.
This commit is contained in:
parent
47a77fc8f1
commit
0bcfd5ca92
1 changed files with 3 additions and 3 deletions
|
@ -667,7 +667,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetBottomAlignOffset, GetBottomAlignOffset)
|
||||||
ACTION_RETURN_FLOAT(GetBottomAlignOffset(self, code));
|
ACTION_RETURN_FLOAT(GetBottomAlignOffset(self, code));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int StringWidth(FFont *font, const FString &str, bool localize)
|
static int StringWidth(FFont *font, const FString &str, int localize)
|
||||||
{
|
{
|
||||||
const char *txt = (localize && str[0] == '$') ? GStrings(&str[1]) : str.GetChars();
|
const char *txt = (localize && str[0] == '$') ? GStrings(&str[1]) : str.GetChars();
|
||||||
return font->StringWidth(txt);
|
return font->StringWidth(txt);
|
||||||
|
@ -681,7 +681,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, StringWidth, StringWidth)
|
||||||
ACTION_RETURN_INT(StringWidth(self, str, localize));
|
ACTION_RETURN_INT(StringWidth(self, str, localize));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GetMaxAscender(FFont* font, const FString& str, bool localize)
|
static int GetMaxAscender(FFont* font, const FString& str, int localize)
|
||||||
{
|
{
|
||||||
const char* txt = (localize && str[0] == '$') ? GStrings(&str[1]) : str.GetChars();
|
const char* txt = (localize && str[0] == '$') ? GStrings(&str[1]) : str.GetChars();
|
||||||
return font->GetMaxAscender(txt);
|
return font->GetMaxAscender(txt);
|
||||||
|
@ -695,7 +695,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetMaxAscender, GetMaxAscender)
|
||||||
ACTION_RETURN_INT(GetMaxAscender(self, str, localize));
|
ACTION_RETURN_INT(GetMaxAscender(self, str, localize));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CanPrint(FFont *font, const FString &str, bool localize)
|
static int CanPrint(FFont *font, const FString &str, int localize)
|
||||||
{
|
{
|
||||||
const char *txt = (localize && str[0] == '$') ? GStrings(&str[1]) : str.GetChars();
|
const char *txt = (localize && str[0] == '$') ? GStrings(&str[1]) : str.GetChars();
|
||||||
return font->CanPrint(txt);
|
return font->CanPrint(txt);
|
||||||
|
|
Loading…
Reference in a new issue