d/v4l2: Type safety fixes and realloc porting

This commit is contained in:
Ryan Pavlik authored and Jakob Bornecrantz committed 2019-12-07 18:24:56 +00:00
1 parent b47428b451
commit 2d86dfd560
1 file changed
+5 -6
+5 -6
View File
@@ -439,12 +439,11 @@ static struct v4l2_source_descriptor *
v4l2_add_descriptor(struct v4l2_fs *vid)
{
uint32_t index = vid->num_descriptors++;
size_t new_size =
vid->num_descriptors * sizeof(struct v4l2_source_descriptor);
vid->descriptors = realloc(vid->descriptors, new_size);
U_ARRAY_REALLOC_OR_FREE(vid->descriptors, struct v4l2_source_descriptor,
vid->num_descriptors);
struct v4l2_source_descriptor *desc = &vid->descriptors[index];
memset(desc, 0, sizeof(*desc));
U_ZERO(desc);
return desc;
}
@@ -499,7 +498,7 @@ v4l2_list_modes_size(struct v4l2_fs *vid,
return;
}
enum xrt_format format = 0;
enum xrt_format format = (enum xrt_format)0;
switch (interval.pixel_format) {
case V4L2_PIX_FMT_YUYV: format = XRT_FORMAT_YUV422; break;
case V4L2_PIX_FMT_MJPEG: format = XRT_FORMAT_MJPEG; break;
@@ -921,7 +920,7 @@ v4l2_fs_stream_run(void *ptr)
struct xrt_frame *xf = NULL;
xrt_frame_reference(&xf, &vf->base);
uint8_t *data = vf->mem;
uint8_t *data = (uint8_t *)vf->mem;
//! @todo Sequence number and timestamp.
xf->width = desc->base.width;