mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
fixed bad parameter types in direct native functions.
bool can cause undefined behavior here, these should be int.
This commit is contained in:
parent
fb6e4becaa
commit
d5e9783324
3 changed files with 4 additions and 6 deletions
|
@ -1,5 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
** serializer.cpp
|
||||
** Savegame wrapper around RapidJSON
|
||||
**
|
||||
|
|
|
@ -668,7 +668,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);
|
||||
|
@ -682,7 +682,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);
|
||||
|
@ -696,7 +696,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);
|
||||
|
|
|
@ -150,7 +150,7 @@ inline double InterceptLineSegments(double v2x, double v2y, double v2dx, double
|
|||
den = 1 / den;
|
||||
|
||||
double factor1 = ((v2x - v1x) * v2dy + (v1y - v2y) * v2dx) * -den;
|
||||
if (factor1 < 0 || factor1 > 1) return -FLT_MAX; // no intersection
|
||||
if (factor1 < 0 || factor1 >= 1) return -FLT_MAX; // no intersection
|
||||
if (pfactor1) *pfactor1 = factor1;
|
||||
|
||||
return ((v1x - v2x) * v1dy + (v2y - v1y) * v1dx) * den; // this one's for the line segment where we want to get the intercept factor for so it needs to be last.
|
||||
|
@ -232,4 +232,3 @@ inline bool BoxInRange(const DVector2& boxtl, const DVector2& boxbr, const DVect
|
|||
boxtl.Y < max(start.Y, end.Y) &&
|
||||
boxbr.Y > min(start.Y, end.Y);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue