aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArvin Ignaci <arvin.ignaci@calanalytics.com>2018-07-09 14:45:19 +0000
committerArvin Ignaci <arvin.ignaci@calanalytics.com>2018-07-09 14:45:19 +0000
commitfad62a3e1c85ec5d709db59bbca173758a8beaf0 (patch)
treec69a1524711ccb98574623c698a01aa91152157c
parentffc8780893dd2c8a9ed2f7bd873ced576bc93cc1 (diff)
fix: handle 32 bit time_t (or smaller)
-rw-r--r--types/wlr_export_dmabuf_v1.c5
-rw-r--r--types/wlr_screencopy_v1.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/types/wlr_export_dmabuf_v1.c b/types/wlr_export_dmabuf_v1.c
index e68b0fef..060f4afa 100644
--- a/types/wlr_export_dmabuf_v1.c
+++ b/types/wlr_export_dmabuf_v1.c
@@ -46,8 +46,9 @@ static void frame_output_handle_swap_buffers(struct wl_listener *listener,
wl_list_remove(&frame->output_swap_buffers.link);
wl_list_init(&frame->output_swap_buffers.link);
- uint32_t tv_sec_hi = event->when->tv_sec >> 32;
- uint32_t tv_sec_lo = event->when->tv_sec & 0xFFFFFFFF;
+ time_t tv_sec = event->when->tv_sec;
+ uint32_t tv_sec_hi = (sizeof(tv_sec) > 4) ? tv_sec >> 32 : 0;
+ uint32_t tv_sec_lo = tv_sec & 0xFFFFFFFF;
zwlr_export_dmabuf_frame_v1_send_ready(frame->resource,
tv_sec_hi, tv_sec_lo, event->when->tv_nsec);
}
diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c
index 0760eaaf..f994d972 100644
--- a/types/wlr_screencopy_v1.c
+++ b/types/wlr_screencopy_v1.c
@@ -66,8 +66,9 @@ static void frame_handle_output_swap_buffers(struct wl_listener *listener,
zwlr_screencopy_frame_v1_send_flags(frame->resource, flags);
- uint32_t tv_sec_hi = event->when->tv_sec >> 32;
- uint32_t tv_sec_lo = event->when->tv_sec & 0xFFFFFFFF;
+ time_t tv_sec = event->when->tv_sec;
+ uint32_t tv_sec_hi = (sizeof(tv_sec) > 4) ? tv_sec >> 32 : 0;
+ uint32_t tv_sec_lo = tv_sec & 0xFFFFFFFF;
zwlr_screencopy_frame_v1_send_ready(frame->resource,
tv_sec_hi, tv_sec_lo, event->when->tv_nsec);