From c754c31d6fe32b6806ea4c88a0969ae7f7796d1b Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Fri, 10 May 2019 20:47:05 +1000 Subject: w32_common: avoid unnecessary sprintfs These were unnecessary for a couple of reasons, but it seems like the old code went through a lot of effort to avoid duplicating the code to print a RECT, even though the windowrc gets printed anyway at the end of the function. Avoid printing the same windowrc twice by only printing it when it gets changed (in the w32->current_fs branch.) --- video/out/w32_common.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 92b6650c09..4436bf030e 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -842,19 +842,16 @@ static bool update_fullscreen_state(struct vo_w32_state *w32) w32->current_fs = new_fs; if (toggle_fs) { - RECT rc; - char msg[50]; if (w32->current_fs) { // Save window rect when switching to fullscreen. - rc = w32->prev_windowrc = w32->windowrc; - sprintf(msg, "save window bounds"); + w32->prev_windowrc = w32->windowrc; + MP_VERBOSE(w32, "save window bounds: %d:%d:%d:%d\n", + (int)w32->windowrc.left, (int)w32->windowrc.top, + (int)rect_w(w32->windowrc), (int)rect_h(w32->windowrc)); } else { // Restore window rect when switching from fullscreen. - rc = w32->windowrc = w32->prev_windowrc; - sprintf(msg, "restore window bounds"); + w32->windowrc = w32->prev_windowrc; } - MP_VERBOSE(w32, "%s: %d:%d:%d:%d\n", msg, - (int)rc.left, (int)rc.top, (int)rect_w(rc), (int)rect_h(rc)); } if (w32->current_fs) -- cgit v1.2.3