Check for float conversion issues on build

Useful to catch any errors left over from the migration of times from
double to int64_t
This commit is contained in:
Kovid Goyal
2019-09-27 19:47:25 +05:30
parent 2e71dde780
commit 0d68b7078c
12 changed files with 36 additions and 31 deletions

4
glfw/wl_init.c vendored
View File

@@ -285,8 +285,8 @@ static void pointerHandleButton(void* data UNUSED,
{
xdg_toplevel_show_window_menu(window->wl.xdg.toplevel,
_glfw.wl.seat, serial,
window->wl.cursorPosX,
window->wl.cursorPosY);
(int32_t)window->wl.cursorPosX,
(int32_t)window->wl.cursorPosY);
return;
}
}

4
glfw/wl_window.c vendored
View File

@@ -546,9 +546,9 @@ static void xdgToplevelHandleConfigure(void* data,
aspectRatio = (float)width / (float)height;
targetRatio = (float)window->numer / (float)window->denom;
if (aspectRatio < targetRatio)
height = width / targetRatio;
height = (int32_t)((float)width / targetRatio);
else if (aspectRatio > targetRatio)
width = height * targetRatio;
width = (int32_t)((float)height * targetRatio);
}
}
}

2
glfw/x11_init.c vendored
View File

@@ -468,7 +468,7 @@ void _glfwGetSystemContentScaleX11(float* xscale, float* yscale, bool bypass_cac
if (XrmGetResource(db, "Xft.dpi", "Xft.Dpi", &type, &value))
{
if (type && strcmp(type, "String") == 0)
xdpi = ydpi = atof(value.addr);
xdpi = ydpi = (float)atof(value.addr);
}
XrmDestroyDatabase(db);

4
glfw/x11_window.c vendored
View File

@@ -509,8 +509,8 @@ static bool createNativeWindow(_GLFWwindow* window,
if (wndconfig->scaleToMonitor)
{
width *= _glfw.x11.contentScaleX;
height *= _glfw.x11.contentScaleY;
width *= (int)_glfw.x11.contentScaleX;
height *= (int)_glfw.x11.contentScaleY;
}
// Create a colormap based on the visual used by the current context