display: Fix warnings, make warnings as errors

Change-Id: I61f22765b04112be48e62135db930c415c9c7d37
diff --git a/common.mk b/common.mk
index e5cc394..99dfbdf 100644
--- a/common.mk
+++ b/common.mk
@@ -15,6 +15,8 @@
 
 #Common C flags
 common_flags := -DDEBUG_CALC_FPS -Wno-missing-field-initializers
+common_flags += -Werror
+
 ifeq ($(ARCH_ARM_HAVE_NEON),true)
     common_flags += -D__ARM_HAVE_NEON
 endif
diff --git a/libcopybit/copybit.cpp b/libcopybit/copybit.cpp
index b8118a0..977a3ab 100644
--- a/libcopybit/copybit.cpp
+++ b/libcopybit/copybit.cpp
@@ -229,10 +229,10 @@
 #if DEBUG_MDP_ERRORS
         struct mdp_blit_req_list const* l =
             (struct mdp_blit_req_list const*)list;
-        for (int i=0 ; i<l->count ; i++) {
+        for (unsigned int i=0 ; i<l->count ; i++) {
             ALOGE("%d: src={w=%d, h=%d, f=%d, rect={%d,%d,%d,%d}}\n"
                   "    dst={w=%d, h=%d, f=%d, rect={%d,%d,%d,%d}}\n"
-                  "    flags=%08lx"
+                  "    flags=%08x"
                   ,
                   i,
                   l->req[i].src.width,
@@ -391,8 +391,8 @@
             }
         }
 
-        if (src_rect->l < 0 || src_rect->r > src->w ||
-            src_rect->t < 0 || src_rect->b > src->h) {
+        if (src_rect->l < 0 || src_rect->r > (int)src->w ||
+            src_rect->t < 0 || src_rect->b > (int)src->h) {
             // this is always invalid
             ALOGE ("%s : Invalid source rectangle : src_rect l %d t %d r %d b %d",\
                    __FUNCTION__, src_rect->l, src_rect->t, src_rect->r, src_rect->b);
diff --git a/libcopybit/copybit_c2d.cpp b/libcopybit/copybit_c2d.cpp
index 1fa08ec..29bf61e 100644
--- a/libcopybit/copybit_c2d.cpp
+++ b/libcopybit/copybit_c2d.cpp
@@ -445,7 +445,7 @@
         info.height = rhs->h;
         info.format = rhs->format;
 
-        yuvPlaneInfo yuvInfo;
+        yuvPlaneInfo yuvInfo = {0};
         status = calculate_yuv_offset_and_stride(info, yuvInfo);
         if(status != COPYBIT_SUCCESS) {
             ALOGE("%s: calculate_yuv_offset_and_stride error", __FUNCTION__);
@@ -700,7 +700,7 @@
 /** copy the bits */
 static int msm_copybit(struct copybit_context_t *dev, blitlist *list, uint32 target)
 {
-    int objects;
+    unsigned int objects;
 
     for(objects = 0; objects < list->count; objects++) {
         list->blitObjects[objects].next = &(list->blitObjects[objects+1]);
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index 2ba0d6a..97255ba 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -152,7 +152,7 @@
 
 IMemAlloc* IonController::getAllocator(int flags)
 {
-    IMemAlloc* memalloc;
+    IMemAlloc* memalloc = NULL;
     if (flags & private_handle_t::PRIV_FLAGS_USES_ION) {
         memalloc = mIonAlloc;
     } else {