(xvideo.c) Style nits

This commit is contained in:
twinaphex 2015-06-03 21:37:08 +02:00
parent 77ba9c650f
commit 5068e2ddbf
2 changed files with 34 additions and 32 deletions

View File

@ -408,21 +408,22 @@ static void *xv_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
unsigned i;
struct sigaction sa;
unsigned adaptor_count = 0;
int visualmatches = 0;
XSetWindowAttributes attributes = {0};
unsigned width = 0, height = 0;
char buf[128], buf_fps[128];
Atom atom = 0;
void *xinput = NULL;
XVisualInfo *visualinfo = NULL;
XVisualInfo visualtemplate = {0};
XvAdaptorInfo *adaptor_info = NULL;
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
struct sigaction sa = {{0}};
XSetWindowAttributes attributes = {0};
XVisualInfo visualtemplate = {0};
unsigned width = 0;
unsigned height = 0;
unsigned adaptor_count = 0;
int visualmatches = 0;
Atom atom = 0;
void *xinput = NULL;
XVisualInfo *visualinfo = NULL;
XvAdaptorInfo *adaptor_info = NULL;
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
const struct retro_game_geometry *geom = NULL;
struct retro_system_av_info *av_info = NULL;
struct retro_system_av_info *av_info = NULL;
xv_t *xv = (xv_t*)calloc(1, sizeof(*xv));
if (!xv)
return NULL;
@ -495,13 +496,13 @@ static void *xv_init(const video_info_t *video,
xv->colormap = XCreateColormap(xv->display,
DefaultRootWindow(xv->display), visualinfo->visual, AllocNone);
attributes.colormap = xv->colormap;
attributes.colormap = xv->colormap;
attributes.border_pixel = 0;
attributes.event_mask = StructureNotifyMask | KeyPressMask |
attributes.event_mask = StructureNotifyMask | KeyPressMask |
KeyReleaseMask | ButtonReleaseMask | ButtonPressMask | DestroyNotify | ClientMessage;
width = video->fullscreen ? ( (video->width == 0) ? geom->base_width : video->width) : video->width;
height = video->fullscreen ? ((video->height == 0) ? geom->base_height : video->height) : video->height;
width = video->fullscreen ? ( (video->width == 0) ? geom->base_width : video->width) : video->width;
height = video->fullscreen ? ((video->height == 0) ? geom->base_height : video->height) : video->height;
xv->window = XCreateWindow(xv->display, DefaultRootWindow(xv->display),
0, 0, width, height,
0, xv->depth, InputOutput, visualinfo->visual,
@ -541,12 +542,13 @@ static void *xv_init(const video_info_t *video,
RARCH_ERR("XVideo: XShmCreateImage failed.\n");
goto error;
}
xv->width = xv->image->width;
xv->height = xv->image->height;
xv->shminfo.shmid = shmget(IPC_PRIVATE, xv->image->data_size, IPC_CREAT | 0777);
xv->shminfo.shmaddr = xv->image->data = (char*)shmat(xv->shminfo.shmid, NULL, 0);
xv->width = xv->image->width;
xv->height = xv->image->height;
xv->shminfo.shmid = shmget(IPC_PRIVATE, xv->image->data_size, IPC_CREAT | 0777);
xv->shminfo.shmaddr = xv->image->data = (char*)shmat(xv->shminfo.shmid, NULL, 0);
xv->shminfo.readOnly = false;
if (!XShmAttach(xv->display, &xv->shminfo))
{
RARCH_ERR("XVideo: XShmAttach failed.\n");
@ -560,7 +562,7 @@ static void *xv_init(const video_info_t *video,
XSetWMProtocols(xv->display, xv->window, &xv->quit_atom, 1);
sa.sa_handler = xvideo_sighandler;
sa.sa_flags = SA_RESTART;
sa.sa_flags = SA_RESTART;
sigemptyset(&sa.sa_mask);
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
@ -608,7 +610,7 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
/* We render @ 2x scale to combat chroma downsampling. */
if (xv->width != (width << 1) || xv->height != (height << 1))
{
xv->width = width << 1;
xv->width = width << 1;
xv->height = height << 1;
XShmDetach(xv->display, &xv->shminfo);
@ -624,7 +626,7 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
return false;
}
xv->width = xv->image->width;
xv->width = xv->image->width;
xv->height = xv->image->height;
xv->shminfo.shmid = shmget(IPC_PRIVATE, xv->image->data_size, IPC_CREAT | 0777);
@ -634,7 +636,7 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
return false;
}
xv->shminfo.shmaddr = xv->image->data = (char*)shmat(xv->shminfo.shmid, NULL, 0);
xv->shminfo.shmaddr = xv->image->data = (char*)shmat(xv->shminfo.shmid, NULL, 0);
xv->shminfo.readOnly = false;
if (!XShmAttach(xv->display, &xv->shminfo))
@ -801,7 +803,7 @@ void x_input_poll_wheel(void *data, XButtonEvent *event, bool latch);
static bool xv_alive(void *data)
{
XEvent event;
xv_t *xv = (xv_t*)data;
xv_t *xv = (xv_t*)data;
driver_t *driver = driver_get_ptr();
while (XPending(xv->display))

View File

@ -53,12 +53,12 @@ cothread_t co_create(unsigned int size, void (*coentry)(void))
if(thread)
{
struct sigaction handler;
struct sigaction old_handler;
stack_t stack;
stack_t old_stack;
struct sigaction handler = {{0}};
struct sigaction old_handler = {{0}};
thread->coentry = thread->stack = 0;
stack.ss_flags = 0;
@ -68,7 +68,7 @@ cothread_t co_create(unsigned int size, void (*coentry)(void))
if(stack.ss_sp && !sigaltstack(&stack, &old_stack))
{
handler.sa_handler = springboard;
handler.sa_flags = SA_ONSTACK;
handler.sa_flags = SA_ONSTACK;
sigemptyset(&handler.sa_mask);
creating = thread;
@ -93,7 +93,7 @@ cothread_t co_create(unsigned int size, void (*coentry)(void))
void co_delete(cothread_t cothread)
{
if(cothread)
if (cothread)
{
if(((cothread_struct*)cothread)->stack)
free(((cothread_struct*)cothread)->stack);
@ -103,7 +103,7 @@ void co_delete(cothread_t cothread)
void co_switch(cothread_t cothread)
{
if(!sigsetjmp(co_running->context, 0))
if (!sigsetjmp(co_running->context, 0))
{
co_running = (cothread_struct*)cothread;
siglongjmp(co_running->context, 1);