Fix some error handling for XVideo.

This commit is contained in:
Themaister 2011-04-08 20:53:11 +02:00
parent 8027a25016
commit f0bbeb901d
2 changed files with 4 additions and 4 deletions

View File

@ -35,7 +35,7 @@ bool gfx_window_title(char *buf, size_t size)
if (frames == 0) if (frames == 0)
{ {
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
snprintf(buf, size, g_extern.title_buf); snprintf(buf, size, "%s", g_extern.title_buf);
ret = true; ret = true;
} }

View File

@ -77,7 +77,7 @@ static void xv_set_nonblock_state(void *data, bool state)
{ {
xv_t *xv = data; xv_t *xv = data;
Atom atom = XInternAtom(xv->display, "XV_SYNC_TO_VBLANK", true); 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); XvSetPortAttribute(xv->display, xv->port, atom, !state);
else else
SSNES_WARN("Failed to set SYNC_TO_VBLANK attribute.\n"); 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; xv->keep_aspect = video->force_aspect;
// Find an appropriate Xv port. // Find an appropriate Xv port.
xv->port = -1; xv->port = 0;
XvAdaptorInfo *adaptor_info; XvAdaptorInfo *adaptor_info;
unsigned adaptor_count = 0; unsigned adaptor_count = 0;
XvQueryAdaptors(xv->display, DefaultRootWindow(xv->display), &adaptor_count, &adaptor_info); 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); XvFreeAdaptorInfo(adaptor_info);
if (xv->port < 0) if (xv->port == 0)
{ {
SSNES_ERR("XVideo: Failed to find valid XvPort.\n"); SSNES_ERR("XVideo: Failed to find valid XvPort.\n");
goto error; goto error;