6989717: media native code compiler warnings
authorbae
Fri, 25 Mar 2011 12:50:59 +0300
changeset 8939 04615dca2a76
parent 8938 8e3cd84800e3
child 8940 7a0c1d4e2982
6989717: media native code compiler warnings Reviewed-by: jgodinez, prr
jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c
jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine.c	Fri Mar 25 12:50:59 2011 +0300
@@ -210,6 +210,8 @@
     t_ind = 4;
   else if (type == MLIB_DOUBLE)
     t_ind = 5;
+  else
+    return MLIB_FAILURE; /* unknown image type */
 
   if (colormap != NULL && filter != MLIB_NEAREST) {
     if (t_ind != 0 && t_ind != 1)
@@ -318,6 +320,10 @@
         }
 
         break;
+
+    default:
+      /* nothing to do for other edge types. */
+      break;
     }
 
     if (param_e->buff_malloc != NULL)
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageAffineEdge.c	Fri Mar 25 12:50:59 2011 +0300
@@ -616,6 +616,9 @@
         MLIB_PROCESS_EDGES_ZERO(mlib_d64);
         break;
       }
+  default:
+    /* Image type MLIB_BIT is not used in java, so we can ignore it. */
+    break;
   }
 }
 
@@ -643,6 +646,9 @@
     case MLIB_DOUBLE:
       MLIB_PROCESS_EDGES(MLIB_EDGE_NEAREST_LINE, mlib_d64);
       break;
+  default:
+    /* Image type MLIB_BIT is not used in java, so we can ignore it. */
+    break;
   }
 }
 
@@ -673,8 +679,11 @@
     if (ltype == MLIB_BYTE) {
       buff = mlib_malloc(channels * max_xsize);
     }
-    else {
+    else if (ltype == MLIB_SHORT) {
       buff = mlib_malloc(channels * max_xsize * sizeof(mlib_s16));
+    } else {
+      /* Unsupported type of lookup table. Report a failure */
+      return MLIB_FAILURE;
     }
 
     if (buff == NULL)
@@ -691,6 +700,9 @@
             srcStride >>= 1;
             MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_u8i, mlib_s16);
             break;
+        default:
+          /* Incompatible image type. Ignore it for now. */
+          break;
         }
 
         break;
@@ -705,9 +717,18 @@
             srcStride >>= 1;
             MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_s16i, mlib_s16);
             break;
+        default:
+          /* Incompatible image type. Ignore it for now. */
+          break;
         }
 
         break;
+    default:
+      /* Unsupported type of lookup table.
+       * Can not be here due to check on line 685,
+       * so just ignore it.
+       */
+      break;
     }
 
     mlib_free(buff);
@@ -744,6 +765,10 @@
       srcStride >>= 3;
       MLIB_PROCESS_EDGES(MLIB_EDGE_BL, mlib_d64);
       break;
+
+  default:
+    /* Image type MLIB_BIT is not supported, ignore it. */
+    break;
   }
 
   return MLIB_SUCCESS;
@@ -803,8 +828,11 @@
     if (ltype == MLIB_BYTE) {
       buff = mlib_malloc(channels * max_xsize);
     }
-    else {
+    else if (ltype == MLIB_SHORT) {
       buff = mlib_malloc(channels * max_xsize * sizeof(mlib_s16));
+    } else {
+      /* Unsupported type of lookup table. */
+      return MLIB_FAILURE;
     }
 
     if (buff == NULL)
@@ -821,6 +849,9 @@
             srcStride >>= 1;
             MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_u8i, mlib_s16);
             break;
+        default:
+          /* Ignore incomatible image type. */
+          break;
         }
 
         break;
@@ -835,9 +866,19 @@
             srcStride >>= 1;
             MLIB_PROCESS_EDGES(MLIB_EDGE_INDEX_s16i, mlib_s16);
             break;
+        default:
+          /* Ignore incomatible image type. */
+          break;
         }
 
         break;
+
+    default:
+      /* Unsupported type of lookup table.
+       * Can not be here due to check on line 836,
+       * so just ignore it.
+       */
+      break;
     }
 
     mlib_free(buff);
@@ -895,6 +936,10 @@
       }
 
       break;
+
+  default:
+    /* Ignore unsupported image type MLIB_BIT */
+    break;
   }
 
   return MLIB_SUCCESS;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageColorTrue2Index.c	Fri Mar 25 12:50:59 2011 +0300
@@ -2623,9 +2623,10 @@
                   return MLIB_FAILURE;
               }
             }
+        default:
+          /* Unsupported type of destination image */
+          return MLIB_FAILURE;
         }
-
-        break;
       }
 
     case MLIB_SHORT:
@@ -2678,18 +2679,15 @@
                   return MLIB_FAILURE;
               }
             }
+        default:
+          /* Unsupported type of destination image */
+          return MLIB_FAILURE;
         }
-
-        break;
       }
 
     default:
       return MLIB_FAILURE;
   }
-
-  /* we need to return something to make Microsoft VC happy.
-     Return FAILURE because on success we likely to return earlier. */
-  return MLIB_FAILURE;
 }
 
 /***************************************************************/
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConvMxN.c	Fri Mar 25 12:50:59 2011 +0300
@@ -211,6 +211,13 @@
         case MLIB_DOUBLE:
           ret = mlib_convMxNnw_d64(dst_i, src_i, kernel, m, n, dm, dn, cmask);
           break;
+
+      default:
+        /* For some reasons, there is no convolution routine for type MLIB_BIT.
+         * For now, we silently ignore it (because this image type is not used by java),
+         * but probably we have to report an error.
+         */
+        break;
       }
     }
 
@@ -221,6 +228,11 @@
       case MLIB_EDGE_DST_COPY_SRC:
         mlib_ImageConvCopyEdge(dst_e, src_e, dx_l, dx_r, dy_t, dy_b, cmask);
         break;
+    default:
+      /* Other edge conditions do not need additional handling.
+       *  Note also that they are not exposed in public Java API
+       */
+      break;
     }
   }
   else {                                    /* MLIB_EDGE_SRC_EXTEND */
@@ -279,6 +291,12 @@
       case MLIB_DOUBLE:
         mlib_convMxNext_d64(dst_e, src_e, kernel, m, n, dx_l, dx_r, dy_t, dy_b, cmask);
         break;
+    default:
+      /* For some reasons, there is no convolution routine for type MLIB_BIT.
+       * For now, we silently ignore it (because this image type is not used by java),
+       * but probably we have to report an error.
+       */
+      break;
     }
   }
 
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16ext.c	Fri Mar 25 12:50:59 2011 +0300
@@ -1869,8 +1869,8 @@
 /***************************************************************/
 mlib_status CONV_FUNC_MxN
 {
-  DTYPE    *adr_src, *sl, *sp;
-  DTYPE    *adr_dst, *dl, *dp;
+  DTYPE    *adr_src, *sl, *sp = NULL;
+  DTYPE    *adr_dst, *dl, *dp = NULL;
   FTYPE    buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
   FTYPE    **buffs = buffs_arr, *buffd;
   FTYPE    akernel[256], *k = akernel, fscale = DSCALE;
@@ -2332,8 +2332,8 @@
 
 mlib_status CONV_FUNC_MxN_I
 {
-  DTYPE    *adr_src, *sl, *sp;
-  DTYPE    *adr_dst, *dl, *dp;
+  DTYPE    *adr_src, *sl, *sp = NULL;
+  DTYPE    *adr_dst, *dl, *dp = NULL;
   mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
   mlib_s32 *pbuff = buff;
   mlib_s32 **buffs = buffs_arr, *buffd;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_16nw.c	Fri Mar 25 12:50:59 2011 +0300
@@ -148,8 +148,8 @@
 
 /***************************************************************/
 #define DEF_VARS(type)                                          \
-  type     *adr_src, *sl, *sp;                                  \
-  type     *adr_dst, *dl, *dp;                                  \
+  type     *adr_src, *sl, *sp = NULL;                           \
+  type     *adr_dst, *dl, *dp = NULL;                           \
   FTYPE    *pbuff = buff;                                       \
   mlib_s32 wid, hgt, sll, dll;                                  \
   mlib_s32 nchannel, chan1;                                     \
@@ -2060,8 +2060,8 @@
   mlib_s32 d0, d1, shift1, shift2;
   mlib_s32 k0, k1, k2, k3, k4, k5, k6;
   mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7;
-  DTYPE    *adr_src, *sl, *sp;
-  DTYPE    *adr_dst, *dl, *dp;
+  DTYPE    *adr_src, *sl, *sp = NULL;
+  DTYPE    *adr_dst, *dl, *dp = NULL;
   mlib_s32 wid, hgt, sll, dll;
   mlib_s32 nchannel, chan1;
   mlib_s32 i, j, c;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_32nw.c	Fri Mar 25 12:50:59 2011 +0300
@@ -78,7 +78,7 @@
 /***************************************************************/
 #define DEF_VARS_MxN(type)                                      \
   GET_SRC_DST_PARAMETERS(type);                                 \
-  type     *sl, *sp, *dl, *dp;                                  \
+  type     *sl, *sp = NULL, *dl, *dp = NULL;                    \
   mlib_d64 *pbuff = buff;                                       \
   mlib_s32 i, j, c
 
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8ext.c	Fri Mar 25 12:50:59 2011 +0300
@@ -1869,8 +1869,8 @@
 /***************************************************************/
 mlib_status CONV_FUNC_MxN
 {
-  DTYPE    *adr_src, *sl, *sp;
-  DTYPE    *adr_dst, *dl, *dp;
+  DTYPE    *adr_src, *sl, *sp = NULL;
+  DTYPE    *adr_dst, *dl, *dp = NULL;
   FTYPE    buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
   FTYPE    **buffs = buffs_arr, *buffd;
   FTYPE    akernel[256], *k = akernel, fscale = DSCALE;
@@ -2332,8 +2332,8 @@
 
 mlib_status CONV_FUNC_MxN_I
 {
-  DTYPE    *adr_src, *sl, *sp;
-  DTYPE    *adr_dst, *dl, *dp;
+  DTYPE    *adr_src, *sl, *sp = NULL;
+  DTYPE    *adr_dst, *dl, *dp = NULL;
   mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
   mlib_s32 *pbuff = buff;
   mlib_s32 **buffs = buffs_arr, *buffd;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_8nw.c	Fri Mar 25 12:50:59 2011 +0300
@@ -149,8 +149,8 @@
 
 /***************************************************************/
 #define DEF_VARS(type)                                          \
-  type     *adr_src, *sl, *sp;                                  \
-  type     *adr_dst, *dl, *dp;                                  \
+  type     *adr_src, *sl, *sp = NULL;                           \
+  type     *adr_dst, *dl, *dp = NULL;                           \
   FTYPE    *pbuff = buff;                                       \
   mlib_s32 wid, hgt, sll, dll;                                  \
   mlib_s32 nchannel, chan1;                                     \
@@ -2061,8 +2061,8 @@
   mlib_s32 d0, d1, shift1, shift2;
   mlib_s32 k0, k1, k2, k3, k4, k5, k6;
   mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7;
-  DTYPE    *adr_src, *sl, *sp;
-  DTYPE    *adr_dst, *dl, *dp;
+  DTYPE    *adr_src, *sl, *sp = NULL;
+  DTYPE    *adr_dst, *dl, *dp = NULL;
   mlib_s32 wid, hgt, sll, dll;
   mlib_s32 nchannel, chan1;
   mlib_s32 i, j, c;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_D64nw.c	Fri Mar 25 12:50:59 2011 +0300
@@ -71,8 +71,8 @@
 #define DEF_VARS(type)                                          \
   GET_SRC_DST_PARAMETERS(type);                                 \
   type     *sl;                                                 \
-  type     *dl, *dp;                                            \
-  mlib_s32 i, j, c
+  type     *dl, *dp = NULL;                                     \
+  mlib_s32 i = 0, j, c
 
 /***************************************************************/
 #undef  KSIZE
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_F32nw.c	Fri Mar 25 12:50:59 2011 +0300
@@ -71,7 +71,7 @@
 #define DEF_VARS(type)                                          \
   GET_SRC_DST_PARAMETERS(type);                                 \
   type     *sl;                                                 \
-  type     *dl, *dp;                                            \
+  type     *dl, *dp = NULL;                                     \
   mlib_s32 i, j, c
 
 /***************************************************************/
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16ext.c	Fri Mar 25 12:50:59 2011 +0300
@@ -1869,8 +1869,8 @@
 /***************************************************************/
 mlib_status CONV_FUNC_MxN
 {
-  DTYPE    *adr_src, *sl, *sp;
-  DTYPE    *adr_dst, *dl, *dp;
+  DTYPE    *adr_src, *sl, *sp = NULL;
+  DTYPE    *adr_dst, *dl, *dp = NULL;
   FTYPE    buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
   FTYPE    **buffs = buffs_arr, *buffd;
   FTYPE    akernel[256], *k = akernel, fscale = DSCALE;
@@ -2332,8 +2332,8 @@
 
 mlib_status CONV_FUNC_MxN_I
 {
-  DTYPE    *adr_src, *sl, *sp;
-  DTYPE    *adr_dst, *dl, *dp;
+  DTYPE    *adr_src, *sl, *sp = NULL;
+  DTYPE    *adr_dst, *dl, *dp = NULL;
   mlib_s32 buff[BUFF_SIZE], *buffs_arr[2*(MAX_N + 1)];
   mlib_s32 *pbuff = buff;
   mlib_s32 **buffs = buffs_arr, *buffd;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageConv_u16nw.c	Fri Mar 25 12:50:59 2011 +0300
@@ -148,8 +148,8 @@
 
 /***************************************************************/
 #define DEF_VARS(type)                                          \
-  type     *adr_src, *sl, *sp;                                  \
-  type     *adr_dst, *dl, *dp;                                  \
+  type     *adr_src, *sl, *sp = NULL;                           \
+  type     *adr_dst, *dl, *dp = NULL;                           \
   FTYPE    *pbuff = buff;                                       \
   mlib_s32 wid, hgt, sll, dll;                                  \
   mlib_s32 nchannel, chan1;                                     \
@@ -2060,8 +2060,8 @@
   mlib_s32 d0, d1, shift1, shift2;
   mlib_s32 k0, k1, k2, k3, k4, k5, k6;
   mlib_s32 p0, p1, p2, p3, p4, p5, p6, p7;
-  DTYPE    *adr_src, *sl, *sp;
-  DTYPE    *adr_dst, *dl, *dp;
+  DTYPE    *adr_src, *sl, *sp = NULL;
+  DTYPE    *adr_dst, *dl, *dp = NULL;
   mlib_s32 wid, hgt, sll, dll;
   mlib_s32 nchannel, chan1;
   mlib_s32 i, j, c;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCopy_Bit.c	Fri Mar 25 12:50:59 2011 +0300
@@ -204,9 +204,9 @@
   mlib_u64 *dp;          /* 8-byte aligned start points in dst */
   mlib_u64 *sp;          /* 8-byte aligned start point in src */
   mlib_s32 j;            /* offset of address in dst */
-  mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFF;
+  mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFFULL;
   mlib_u64 dmask;
-  mlib_u64 lsrc, lsrc0, lsrc1, ldst;
+  mlib_u64 lsrc, lsrc0, lsrc1 = 0ULL, ldst;
   mlib_s32 ls_offset, ld_offset, shift;
 
   if (size <= 0) return;
@@ -427,9 +427,9 @@
   mlib_u64 *dp;          /* 8-byte aligned start points in dst */
   mlib_u64 *sp;          /* 8-byte aligned start point in src */
   mlib_s32 j;            /* offset of address in dst */
-  mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFF;
+  mlib_u64 lmask0 = 0xFFFFFFFFFFFFFFFFULL;
   mlib_u64 dmask;
-  mlib_u64 lsrc, lsrc0, lsrc1, ldst;
+  mlib_u64 lsrc, lsrc0, lsrc1 = 0ULL, ldst;
   mlib_s32 ls_offset, ld_offset, shift;
 
   if (size <= 0) return;
--- a/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c	Tue Mar 22 12:28:03 2011 +0300
+++ b/jdk/src/share/native/sun/awt/medialib/mlib_ImageCreate.c	Fri Mar 25 12:50:59 2011 +0300
@@ -334,7 +334,7 @@
   mlib_s32       width;                 /* for parent image */
   mlib_s32       height;                /* for parent image */
   mlib_s32       stride;
-  mlib_s32       bitoffset;
+  mlib_s32       bitoffset = 0;
   void           *data;
 
 /* sanity check */
@@ -423,7 +423,7 @@
   mlib_s32   channels = src -> channels;
   mlib_s32   stride   = src -> stride;
   mlib_u8    *data    = src -> data;
-  mlib_s32   bitoffset;
+  mlib_s32   bitoffset = 0;
 
   data += y * stride;