8035287: gcc warnings compiling various libraries files
authormikael
Tue, 18 Feb 2014 17:55:04 -0800
changeset 23304 bb48872f9326
parent 23303 a88030d506db
child 23305 e7d0093bfc6c
8035287: gcc warnings compiling various libraries files Reviewed-by: prr
jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp
jdk/src/share/native/sun/java2d/opengl/OGLContext.c
jdk/src/solaris/native/sun/awt/awt_Font.c
jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c
jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
jdk/src/solaris/native/sun/xawt/XToolkit.c
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp	Tue Feb 18 16:34:58 2014 +0400
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/bands.cpp	Tue Feb 18 17:55:04 2014 -0800
@@ -288,7 +288,7 @@
   { e_##name,  #name, /*debug only*/ \
     cspec, ix }
 
-const band_init all_band_inits[] = {
+const band_init all_band_inits[BAND_LIMIT+1] = {
 //BAND_INIT(archive_magic, BYTE1_spec, 0),
 //BAND_INIT(archive_header, UNSIGNED5_spec, 0),
 //BAND_INIT(band_headers, BYTE1_spec, 0),
@@ -448,14 +448,8 @@
   BAND_INIT(file_modtime, DELTA5_spec, 0),
   BAND_INIT(file_options, UNSIGNED5_spec, 0),
 //BAND_INIT(file_bits, BYTE1_spec, 0),
-#ifndef PRODUCT
-  { 0, 0, 0, 0 }
-#else
-  { 0, 0 }
-#endif
+  { 0, NULL, 0, 0 }
 };
-#define NUM_BAND_INITS \
-        (sizeof(all_band_inits)/sizeof(all_band_inits[0]))
 
 band* band::makeBands(unpacker* u) {
   band* tmp_all_bands = U_NEW(band, BAND_LIMIT);
--- a/jdk/src/share/native/sun/java2d/opengl/OGLContext.c	Tue Feb 18 16:34:58 2014 +0400
+++ b/jdk/src/share/native/sun/java2d/opengl/OGLContext.c	Tue Feb 18 17:55:04 2014 -0800
@@ -38,6 +38,8 @@
 #include "GraphicsPrimitiveMgr.h"
 #include "Region.h"
 
+#include "jvm.h"
+
 /**
  * The following methods are implemented in the windowing system (i.e. GLX
  * and WGL) source files.
--- a/jdk/src/solaris/native/sun/awt/awt_Font.c	Tue Feb 18 16:34:58 2014 +0400
+++ b/jdk/src/solaris/native/sun/awt/awt_Font.c	Tue Feb 18 17:55:04 2014 -0800
@@ -452,6 +452,7 @@
         int32_t i, size;
         char *fontsetname = NULL;
         char *nativename = NULL;
+        Boolean doFree = FALSE;
         jobjectArray componentFonts = NULL;
         jobject peer = NULL;
         jobject fontDescriptor = NULL;
@@ -491,8 +492,10 @@
 
             if (!JNU_IsNull(env, fontDescriptorName)) {
                 nativename = (char *) JNU_GetStringPlatformChars(env, fontDescriptorName, NULL);
+                doFree = TRUE;
             } else {
                 nativename = "";
+                doFree = FALSE;
             }
 
             fdata->flist[i].xlfd = malloc(strlen(nativename)
@@ -500,7 +503,7 @@
             jio_snprintf(fdata->flist[i].xlfd, strlen(nativename) + 10,
                          nativename, size * 10);
 
-            if (nativename != NULL && nativename != "")
+            if (nativename != NULL && doFree)
                 JNU_ReleaseStringPlatformChars(env, fontDescriptorName, (const char *) nativename);
 
             /*
--- a/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	Tue Feb 18 16:34:58 2014 +0400
+++ b/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	Tue Feb 18 17:55:04 2014 -0800
@@ -227,7 +227,7 @@
 
 
 #define REFLECT_VOID_FUNCTION(name, arglist, paramlist)                 \
-typedef name##_type arglist;                                            \
+typedef void name##_type arglist;                                       \
 void name arglist                                                       \
 {                                                                       \
     static name##_type *name##_ptr = NULL;                              \
--- a/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Tue Feb 18 16:34:58 2014 +0400
+++ b/jdk/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Tue Feb 18 17:55:04 2014 -0800
@@ -510,7 +510,7 @@
     xsdo->cData = xsdo->configData->color_data;
 
     XShared_initSurface(env, xsdo, depth, width, height, drawable);
-    xsdo->xrPic = NULL;
+    xsdo->xrPic = None;
 #endif /* !HEADLESS */
 }
 
--- a/jdk/src/solaris/native/sun/xawt/XToolkit.c	Tue Feb 18 16:34:58 2014 +0400
+++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c	Tue Feb 18 17:55:04 2014 -0800
@@ -699,7 +699,7 @@
     if (pollFds[0].revents) {
         // Events in X pipe
         update_poll_timeout(TIMEOUT_EVENTS);
-        PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %ld \n", curPollTimeout);
+        PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %d \n", curPollTimeout);
     }
     return;