8074829: Resolve disabled warnings for libawt_headless
Reviewed-by: prr, erikj, serb
--- a/jdk/make/lib/Awt2dLibraries.gmk Thu Jun 02 15:36:15 2016 +0300
+++ b/jdk/make/lib/Awt2dLibraries.gmk Fri Jun 03 11:37:45 2016 +0530
@@ -578,9 +578,7 @@
$(X_CFLAGS) \
$(LIBAWT_HEADLESS_CFLAGS), \
DISABLED_WARNINGS_xlc := 1506-356, \
- DISABLED_WARNINGS_gcc := maybe-uninitialized int-to-pointer-cast, \
- DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
- E_EMPTY_TRANSLATION_UNIT, \
+ DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/src/java.desktop/unix/native/common/awt/CUPSfuncs.c Thu Jun 02 15:36:15 2016 +0300
+++ b/jdk/src/java.desktop/unix/native/common/awt/CUPSfuncs.c Fri Jun 03 11:37:45 2016 +0530
@@ -371,6 +371,10 @@
ppd_option_t *option;
ppd_choice_t *choice;
ppd_size_t *size;
+ const char *filename = NULL;
+ int i;
+ jobjectArray sizeArray = NULL;
+ jfloat *dims;
const char *name = (*env)->GetStringUTFChars(env, printer, NULL);
if (name == NULL) {
@@ -378,10 +382,6 @@
JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
return NULL;
}
- const char *filename;
- int i;
- jobjectArray sizeArray = NULL;
- jfloat *dims;
// NOTE: cupsGetPPD returns a pointer to a filename of a temporary file.
// unlink() must be called to remove the file after using it.
@@ -470,6 +470,8 @@
jclass intCls, cls;
jmethodID intCtr, arrListAddMID;
int i;
+ const char *name = NULL;
+ const char *filename = NULL;
intCls = (*env)->FindClass(env, "java/lang/Integer");
CHECK_NULL(intCls);
@@ -481,13 +483,13 @@
(*env)->GetMethodID(env, cls, "add", "(Ljava/lang/Object;)Z");
CHECK_NULL(arrListAddMID);
- const char *name = (*env)->GetStringUTFChars(env, printer, NULL);
+ name = (*env)->GetStringUTFChars(env, printer, NULL);
if (name == NULL) {
(*env)->ExceptionClear(env);
JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
return;
}
- const char *filename;
+
// NOTE: cupsGetPPD returns a pointer to a filename of a temporary file.
// unlink() must be called to remove the file after using it.
--- a/jdk/src/java.desktop/unix/native/common/awt/fontpath.c Thu Jun 02 15:36:15 2016 +0300
+++ b/jdk/src/java.desktop/unix/native/common/awt/fontpath.c Fri Jun 03 11:37:45 2016 +0530
@@ -1012,17 +1012,20 @@
jfieldID familyNameID, styleNameID, fullNameID, fontFileID;
jmethodID fcFontCons;
char* debugMinGlyphsStr = getenv("J2D_DEBUG_MIN_GLYPHS");
+ jclass fcInfoClass;
+ jclass fcCompFontClass;
+ jclass fcFontClass;
CHECK_NULL(fcInfoObj);
CHECK_NULL(fcCompFontArray);
- jclass fcInfoClass =
+ fcInfoClass =
(*env)->FindClass(env, "sun/font/FontConfigManager$FontConfigInfo");
CHECK_NULL(fcInfoClass);
- jclass fcCompFontClass =
+ fcCompFontClass =
(*env)->FindClass(env, "sun/font/FontConfigManager$FcCompFont");
CHECK_NULL(fcCompFontClass);
- jclass fcFontClass =
+ fcFontClass =
(*env)->FindClass(env, "sun/font/FontConfigManager$FontConfigFont");
CHECK_NULL(fcFontClass);
@@ -1146,7 +1149,8 @@
int fn, j, fontCount, nfonts;
unsigned int minGlyphs;
FcChar8 **family, **styleStr, **fullname, **file;
- jarray fcFontArr;
+ jarray fcFontArr = NULL;
+ FcCharSet *unionCharset = NULL;
fcCompFontObj = (*env)->GetObjectArrayElement(env, fcCompFontArray, i);
fcNameStr =
@@ -1218,7 +1222,7 @@
minGlyphs = val;
}
}
- FcCharSet *unionCharset = NULL;
+
for (j=0; j<nfonts; j++) {
FcPattern *fontPattern = fontset->fonts[j];
FcChar8 *fontformat;