Bug 1707943 - Fix warnings and apply suggestions form static analysis, r=stransky

Some more small cleanups to stop the review bot from complaining in
patches touching these files.

Differential Revision: https://phabricator.services.mozilla.com/D113721
This commit is contained in:
Robert Mader 2021-04-29 10:43:17 +00:00
Родитель 6d793a8c93
Коммит 10d2da5900
3 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -413,7 +413,7 @@ gfxImageFormat gfxPlatformGtk::GetOffscreenFormat() {
void gfxPlatformGtk::FontsPrefsChanged(const char* aPref) { void gfxPlatformGtk::FontsPrefsChanged(const char* aPref) {
// only checking for generic substitions, pass other changes up // only checking for generic substitions, pass other changes up
if (strcmp(GFX_PREF_MAX_GENERIC_SUBSTITUTIONS, aPref)) { if (strcmp(GFX_PREF_MAX_GENERIC_SUBSTITUTIONS, aPref) != 0) {
gfxPlatform::FontsPrefsChanged(aPref); gfxPlatform::FontsPrefsChanged(aPref);
return; return;
} }
@ -519,7 +519,7 @@ nsTArray<uint8_t> gfxPlatformGtk::GetPlatformCMSOutputProfileData() {
} }
// Format documented in "VESA E-EDID Implementation Guide" // Format documented in "VESA E-EDID Implementation Guide"
float gamma = (100 + retProperty[0x17]) / 100.0f; float gamma = (100 + (float)retProperty[0x17]) / 100.0f;
qcms_CIE_xyY whitePoint; qcms_CIE_xyY whitePoint;
whitePoint.x = whitePoint.x =
@ -739,7 +739,7 @@ class GtkVsyncSource final : public VsyncSource {
// until the parity of the counter value changes. // until the parity of the counter value changes.
unsigned int nextSync = syncCounter + 1; unsigned int nextSync = syncCounter + 1;
int status; int status;
if ((status = gl::sGLXLibrary.fWaitVideoSync(2, nextSync % 2, if ((status = gl::sGLXLibrary.fWaitVideoSync(2, (int)nextSync % 2,
&syncCounter)) != 0) { &syncCounter)) != 0) {
gfxWarningOnce() << "glXWaitVideoSync returned " << status; gfxWarningOnce() << "glXWaitVideoSync returned " << status;
useSoftware = true; useSoftware = true;
@ -755,7 +755,7 @@ class GtkVsyncSource final : public VsyncSource {
double remaining = double remaining =
(1000.f / 60.f) - (TimeStamp::Now() - lastVsync).ToMilliseconds(); (1000.f / 60.f) - (TimeStamp::Now() - lastVsync).ToMilliseconds();
if (remaining > 0) { if (remaining > 0) {
PlatformThread::Sleep(remaining); PlatformThread::Sleep((int)remaining);
} }
} }

Просмотреть файл

@ -231,7 +231,7 @@ void GfxInfo::GetData() {
// only useful for Linux kernel version check for FGLRX driver. // only useful for Linux kernel version check for FGLRX driver.
// assumes X client == X server, which is sad. // assumes X client == X server, which is sad.
struct utsname unameobj; struct utsname unameobj {};
if (uname(&unameobj) >= 0) { if (uname(&unameobj) >= 0) {
mOS.Assign(unameobj.sysname); mOS.Assign(unameobj.sysname);
mOSRelease.Assign(unameobj.release); mOSRelease.Assign(unameobj.release);
@ -338,7 +338,7 @@ void GfxInfo::GetData() {
while (loc != kNotFound) { while (loc != kNotFound) {
int isDefault = 0; int isDefault = 0;
nsCString line(screenInfo.get() + start, loc - start); nsCString line(screenInfo.get() + start, loc - start);
ScreenInfo info; ScreenInfo info{};
if (sscanf(line.get(), "%ux%u:%u", &info.mWidth, &info.mHeight, if (sscanf(line.get(), "%ux%u:%u", &info.mWidth, &info.mHeight,
&isDefault) == 3) { &isDefault) == 3) {
info.mIsDefault = isDefault != 0; info.mIsDefault = isDefault != 0;

Просмотреть файл

@ -569,8 +569,8 @@ struct wl_egl_window* moz_container_wayland_get_egl_window(
if (!wl_container->eglwindow) { if (!wl_container->eglwindow) {
GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(container)); GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(container));
wl_container->eglwindow = wl_egl_window_create( wl_container->eglwindow = wl_egl_window_create(
wl_container->surface, round(gdk_window_get_width(window) * scale), wl_container->surface, (int)round(gdk_window_get_width(window) * scale),
round(gdk_window_get_height(window) * scale)); (int)round(gdk_window_get_height(window) * scale));
LOGWAYLAND(("%s [%p] created eglwindow %p\n", __FUNCTION__, LOGWAYLAND(("%s [%p] created eglwindow %p\n", __FUNCTION__,
(void*)container, (void*)wl_container->eglwindow)); (void*)container, (void*)wl_container->eglwindow));
@ -579,7 +579,7 @@ struct wl_egl_window* moz_container_wayland_get_egl_window(
} }
gboolean moz_container_wayland_has_egl_window(MozContainer* container) { gboolean moz_container_wayland_has_egl_window(MozContainer* container) {
return container->wl_container.eglwindow ? true : false; return container->wl_container.eglwindow != nullptr;
} }
gboolean moz_container_wayland_surface_needs_clear(MozContainer* container) { gboolean moz_container_wayland_surface_needs_clear(MozContainer* container) {