summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-04-28 14:08:58 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-04-28 14:15:03 +0200
commit10377ace8675ea244702fb12068fbadeb5b40432 (patch)
treee69f59e49e0ccd2eee32b49434d4b929626f4505
parent13fc5ad29e2fac4437f11fd2eeb648e41569bc90 (diff)
Fix warnings
-rw-r--r--src/wfdevent.c13
-rw-r--r--src/wfdport.c19
2 files changed, 17 insertions, 15 deletions
diff --git a/src/wfdevent.c b/src/wfdevent.c
index e7cb165..3d98b61 100644
--- a/src/wfdevent.c
+++ b/src/wfdevent.c
@@ -250,6 +250,7 @@ page_flip_handler(int fd, unsigned int frame,
struct wfd_pipeline *pipeline = data;
struct bind_event bind;
+ wf_list_init(&bind.link);
bind.pipeline_id = wfd_pipeline_get_id(pipeline);
bind.time = (sec * 1000 + usec / 1000) -
global_event->start_time_msec;
@@ -270,8 +271,10 @@ page_flip_handler(int fd, unsigned int frame,
wf_list_push_tail(&global_event->bind_event_queue,
queue_entry, link);
- write(global_event->source_bind_event_queue_fd,
- &add, sizeof add);
+ if (write(global_event->source_bind_event_queue_fd,
+ &add, sizeof add) < 0) {
+ printf("overflow\n");
+ }
}
}
}
@@ -324,7 +327,11 @@ wfd_event_wait(struct wfd_device *device,
int64_t id;
struct bind_event *queue_entry;
- read(event->source_bind_event_queue_fd, &id, sizeof id);
+ if (read(event->source_bind_event_queue_fd, &id,
+ sizeof id) < 0) {
+ fprintf(stderr, "error reading from event queue\n");
+ return WFD_EVENT_NONE;
+ }
wf_list_pop_head(&event->bind_event_queue,
queue_entry, link);
diff --git a/src/wfdport.c b/src/wfdport.c
index d95dbcb..a9856fe 100644
--- a/src/wfdport.c
+++ b/src/wfdport.c
@@ -726,6 +726,7 @@ wfd_port_commit(struct wfd_device *device,
int fd = wfd_device_get_fd(device);
int ret;
int dest_rect[4];
+ uint64_t power_mode;
wfd_pipeline_commit(device, port->pipeline);
@@ -752,7 +753,6 @@ wfd_port_commit(struct wfd_device *device,
return ret;
}
- uint64_t power_mode;
switch (port->power_mode) {
case WFD_POWER_MODE_ON:
power_mode = DRM_MODE_DPMS_ON;
@@ -766,6 +766,9 @@ wfd_port_commit(struct wfd_device *device,
case WFD_POWER_MODE_OFF:
power_mode = DRM_MODE_DPMS_OFF;
break;
+ default:
+ power_mode = WFD_POWER_MODE_ON;
+ break;
}
ret = drmModeConnectorSetProperty(fd, port->connector->connector_id,
@@ -791,15 +794,6 @@ wfd_port_bind_pipeline(struct wfd_device *device,
return 0;
}
-static inline void
-pointer_swap(void **p1, void **p2)
-{
- void *tmp = *p1;
-
- *p1 = *p2;
- *p2 = tmp;
-}
-
struct id_search {
uint32_t connector_id;
void *object;
@@ -855,8 +849,9 @@ wfd_ports_find_attach_detach(struct wfd_device *device,
*port_id = connector->connector_id;
event_type = WFD_EVENT_PORT_ATTACH_DETACH;
- pointer_swap((void **) &port->connector,
- (void **) &connector);
+ drmModeConnectorPtr tmp = port->connector;
+ port->connector = connector;
+ connector = tmp;
}
drmModeFreeConnector(connector);