From f0bbeb901dc7bb292f4517c936b65c1c1fa62bf9 Mon Sep 17 00:00:00 2001 From: Themaister Date: Fri, 8 Apr 2011 20:53:11 +0200 Subject: [PATCH] Fix some error handling for XVideo. --- gfx/gfx_common.c | 2 +- gfx/xvideo.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gfx/gfx_common.c b/gfx/gfx_common.c index d7a6a98536..62c2bfe1e8 100644 --- a/gfx/gfx_common.c +++ b/gfx/gfx_common.c @@ -35,7 +35,7 @@ bool gfx_window_title(char *buf, size_t size) if (frames == 0) { gettimeofday(&tv, NULL); - snprintf(buf, size, g_extern.title_buf); + snprintf(buf, size, "%s", g_extern.title_buf); ret = true; } diff --git a/gfx/xvideo.c b/gfx/xvideo.c index 461726f0cd..d287e836cd 100644 --- a/gfx/xvideo.c +++ b/gfx/xvideo.c @@ -77,7 +77,7 @@ static void xv_set_nonblock_state(void *data, bool state) { xv_t *xv = data; Atom atom = XInternAtom(xv->display, "XV_SYNC_TO_VBLANK", true); - if (atom != None && xv->port >= 0) + if (atom != None && xv->port) XvSetPortAttribute(xv->display, xv->port, atom, !state); else SSNES_WARN("Failed to set SYNC_TO_VBLANK attribute.\n"); @@ -315,7 +315,7 @@ static void* xv_init(video_info_t *video, const input_driver_t **input, void **i xv->keep_aspect = video->force_aspect; // Find an appropriate Xv port. - xv->port = -1; + xv->port = 0; XvAdaptorInfo *adaptor_info; unsigned adaptor_count = 0; XvQueryAdaptors(xv->display, DefaultRootWindow(xv->display), &adaptor_count, &adaptor_info); @@ -333,7 +333,7 @@ static void* xv_init(video_info_t *video, const input_driver_t **input, void **i } XvFreeAdaptorInfo(adaptor_info); - if (xv->port < 0) + if (xv->port == 0) { SSNES_ERR("XVideo: Failed to find valid XvPort.\n"); goto error;