From 6281a9abbb800afed44ed0810c6cdaabed29528c Mon Sep 17 00:00:00 2001
From: Dmitry Kovalev <dkovalev@google.com>
Date: Mon, 10 Mar 2014 14:53:30 -0700
Subject: [PATCH] Adding type casts to remove C++ compiler errors.

Change-Id: I224e49955ad6c833d204feb8efc4056e37d206be
---
 vp9/common/vp9_alloccommon.c   | 24 ++++++++++++++----------
 vp9/common/vp9_frame_buffers.c |  5 +++--
 vpx/src/vpx_encoder.c          |  2 +-
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/vp9/common/vp9_alloccommon.c b/vp9/common/vp9_alloccommon.c
index a72821b343..cddac0178e 100644
--- a/vp9/common/vp9_alloccommon.c
+++ b/vp9/common/vp9_alloccommon.c
@@ -101,22 +101,24 @@ int vp9_resize_frame_buffers(VP9_COMMON *cm, int width, int height) {
   mi_size = cm->mode_info_stride * (cm->mi_rows + MI_BLOCK_SIZE);
 
   vpx_free(cm->mip);
-  cm->mip = vpx_calloc(mi_size, sizeof(MODE_INFO));
+  cm->mip = (MODE_INFO *)vpx_calloc(mi_size, sizeof(MODE_INFO));
   if (!cm->mip)
     goto fail;
 
   vpx_free(cm->prev_mip);
-  cm->prev_mip = vpx_calloc(mi_size, sizeof(MODE_INFO));
+  cm->prev_mip = (MODE_INFO *)vpx_calloc(mi_size, sizeof(MODE_INFO));
   if (!cm->prev_mip)
     goto fail;
 
   vpx_free(cm->mi_grid_base);
-  cm->mi_grid_base = vpx_calloc(mi_size, sizeof(*cm->mi_grid_base));
+  cm->mi_grid_base =
+      (MODE_INFO **)vpx_calloc(mi_size, sizeof(*cm->mi_grid_base));
   if (!cm->mi_grid_base)
     goto fail;
 
   vpx_free(cm->prev_mi_grid_base);
-  cm->prev_mi_grid_base = vpx_calloc(mi_size, sizeof(*cm->prev_mi_grid_base));
+  cm->prev_mi_grid_base =
+      (MODE_INFO **)vpx_calloc(mi_size, sizeof(*cm->prev_mi_grid_base));
   if (!cm->prev_mi_grid_base)
     goto fail;
 
@@ -124,7 +126,7 @@ int vp9_resize_frame_buffers(VP9_COMMON *cm, int width, int height) {
 
   // Create the segmentation map structure and set to 0.
   vpx_free(cm->last_frame_seg_map);
-  cm->last_frame_seg_map = vpx_calloc(cm->mi_rows * cm->mi_cols, 1);
+  cm->last_frame_seg_map = (uint8_t *)vpx_calloc(cm->mi_rows * cm->mi_cols, 1);
   if (!cm->last_frame_seg_map)
     goto fail;
 
@@ -170,26 +172,28 @@ int vp9_alloc_frame_buffers(VP9_COMMON *cm, int width, int height) {
   // Allocation
   mi_size = cm->mode_info_stride * (cm->mi_rows + MI_BLOCK_SIZE);
 
-  cm->mip = vpx_calloc(mi_size, sizeof(MODE_INFO));
+  cm->mip = (MODE_INFO *)vpx_calloc(mi_size, sizeof(MODE_INFO));
   if (!cm->mip)
     goto fail;
 
-  cm->prev_mip = vpx_calloc(mi_size, sizeof(MODE_INFO));
+  cm->prev_mip = (MODE_INFO *)vpx_calloc(mi_size, sizeof(MODE_INFO));
   if (!cm->prev_mip)
     goto fail;
 
-  cm->mi_grid_base = vpx_calloc(mi_size, sizeof(*cm->mi_grid_base));
+  cm->mi_grid_base =
+      (MODE_INFO **)vpx_calloc(mi_size, sizeof(*cm->mi_grid_base));
   if (!cm->mi_grid_base)
     goto fail;
 
-  cm->prev_mi_grid_base = vpx_calloc(mi_size, sizeof(*cm->prev_mi_grid_base));
+  cm->prev_mi_grid_base =
+      (MODE_INFO **)vpx_calloc(mi_size, sizeof(*cm->prev_mi_grid_base));
   if (!cm->prev_mi_grid_base)
     goto fail;
 
   setup_mi(cm);
 
   // Create the segmentation map structure and set to 0.
-  cm->last_frame_seg_map = vpx_calloc(cm->mi_rows * cm->mi_cols, 1);
+  cm->last_frame_seg_map = (uint8_t *)vpx_calloc(cm->mi_rows * cm->mi_cols, 1);
   if (!cm->last_frame_seg_map)
     goto fail;
 
diff --git a/vp9/common/vp9_frame_buffers.c b/vp9/common/vp9_frame_buffers.c
index dffeb8a228..a0b1e039ca 100644
--- a/vp9/common/vp9_frame_buffers.c
+++ b/vp9/common/vp9_frame_buffers.c
@@ -19,8 +19,9 @@ int vp9_alloc_internal_frame_buffers(InternalFrameBufferList *list) {
 
   list->num_internal_frame_buffers =
       VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
-  list->int_fb = vpx_calloc(list->num_internal_frame_buffers,
-                            sizeof(*list->int_fb));
+  list->int_fb =
+      (InternalFrameBuffer *)vpx_calloc(list->num_internal_frame_buffers,
+                                        sizeof(*list->int_fb));
   return (list->int_fb == NULL);
 }
 
diff --git a/vpx/src/vpx_encoder.c b/vpx/src/vpx_encoder.c
index e69d96efb6..ece2d0b646 100644
--- a/vpx/src/vpx_encoder.c
+++ b/vpx/src/vpx_encoder.c
@@ -394,7 +394,7 @@ const vpx_codec_cx_pkt_t *vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list
     *iter = list->pkts;
   }
 
-  pkt = (const void *) * iter;
+  pkt = (const vpx_codec_cx_pkt_t *)*iter;
 
   if ((size_t)(pkt - list->pkts) < list->cnt)
     *iter = pkt + 1;
-- 
GitLab