Skip to content

Commit

Permalink
fixed potentially undefined behavior with bool parameters in direct n…
Browse files Browse the repository at this point in the history
…ative functions.
  • Loading branch information
coelckers committed Nov 6, 2023
1 parent 47a77fc commit 0bcfd5c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/common/scripting/interface/vmnatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetBottomAlignOffset, GetBottomAlignOffset)
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();
return font->StringWidth(txt);
Expand All @@ -681,7 +681,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, StringWidth, StringWidth)
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();
return font->GetMaxAscender(txt);
Expand All @@ -695,7 +695,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetMaxAscender, GetMaxAscender)
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();
return font->CanPrint(txt);
Expand Down

0 comments on commit 0bcfd5c

Please sign in to comment.