6989724: font warnings in the build, native code
authorjgodinez
Wed, 20 Apr 2011 09:10:36 -0700
changeset 9460 2957bb8932db
parent 9197 cf8aa53be4b2
child 9461 4fd9dcb3a5d0
6989724: font warnings in the build, native code Reviewed-by: bae, igor
jdk/src/share/native/sun/awt/giflib/dgif_lib.c
jdk/src/share/native/sun/font/fontscalerdefs.h
jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp
jdk/src/share/native/sun/font/layout/MPreFixups.cpp
jdk/src/solaris/native/sun/awt/fontpath.c
jdk/src/windows/native/sun/font/fontpath.c
--- a/jdk/src/share/native/sun/awt/giflib/dgif_lib.c	Sat Apr 16 23:23:31 2011 -0700
+++ b/jdk/src/share/native/sun/awt/giflib/dgif_lib.c	Wed Apr 20 09:10:36 2011 -0700
@@ -70,7 +70,7 @@
 /* avoid extra function call in case we use fread (TVT) */
 #define READ(_gif,_buf,_len)                                     \
   (((GifFilePrivateType*)_gif->Private)->Read ?                   \
-    ((GifFilePrivateType*)_gif->Private)->Read(_gif,_buf,_len) : \
+    (size_t)((GifFilePrivateType*)_gif->Private)->Read(_gif,_buf,_len) : \
     fread(_buf,1,_len,((GifFilePrivateType*)_gif->Private)->File))
 
 static int DGifGetWord(GifFileType *GifFile, int *Word);
--- a/jdk/src/share/native/sun/font/fontscalerdefs.h	Sat Apr 16 23:23:31 2011 -0700
+++ b/jdk/src/share/native/sun/font/fontscalerdefs.h	Wed Apr 20 09:10:36 2011 -0700
@@ -55,13 +55,15 @@
 typedef Int32                   hsFract;
 typedef UInt32                  Bool32;
 
+#ifndef  __cplusplus
 #ifndef false
-        #define false           0
+         #define false           0
 #endif
 
 #ifndef true
         #define true            1
 #endif
+#endif
 
 #define kPosInfinity32          (0x7fffffff)
 #define kNegInfinity32          (0x80000000)
--- a/jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp	Sat Apr 16 23:23:31 2011 -0700
+++ b/jdk/src/share/native/sun/font/layout/HangulLayoutEngine.cpp	Wed Apr 20 09:10:36 2011 -0700
@@ -162,7 +162,7 @@
         return 0;
     }
 
-    lead  = LJMO_FIRST + (sIndex / HSYL_LVCNT);
+    lead  = (LEUnicode)(LJMO_FIRST + (sIndex / HSYL_LVCNT));
     vowel = VJMO_FIRST + (sIndex % HSYL_LVCNT) / TJMO_COUNT;
     trail = TJMO_FIRST + (sIndex % TJMO_COUNT);
 
--- a/jdk/src/share/native/sun/font/layout/MPreFixups.cpp	Sat Apr 16 23:23:31 2011 -0700
+++ b/jdk/src/share/native/sun/font/layout/MPreFixups.cpp	Wed Apr 20 09:10:36 2011 -0700
@@ -65,9 +65,9 @@
     }
 }
 
-void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& success)
+void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& leSuccess)
 {
-    if (LE_FAILURE(success)) {
+    if (LE_FAILURE(leSuccess)) {
         return;
     }
 
--- a/jdk/src/solaris/native/sun/awt/fontpath.c	Sat Apr 16 23:23:31 2011 -0700
+++ b/jdk/src/solaris/native/sun/awt/fontpath.c	Wed Apr 20 09:10:36 2011 -0700
@@ -1107,7 +1107,8 @@
     arrlen = (*env)->GetArrayLength(env, fcCompFontArray);
     for (i=0; i<arrlen; i++) {
         FcFontSet* fontset;
-        int fn, j, fontCount, nfonts, minGlyphs;
+        int fn, j, fontCount, nfonts;
+        unsigned int minGlyphs;
         FcChar8 **family, **styleStr, **fullname, **file;
         jarray fcFontArr;
 
--- a/jdk/src/windows/native/sun/font/fontpath.c	Sat Apr 16 23:23:31 2011 -0700
+++ b/jdk/src/windows/native/sun/font/fontpath.c	Wed Apr 20 09:10:36 2011 -0700
@@ -235,7 +235,7 @@
     }
 
     fullname = (*env)->NewString(env, lpelfe->elfFullName,
-                                 wcslen((LPWSTR)lpelfe->elfFullName));
+                                 (jsize)wcslen((LPWSTR)lpelfe->elfFullName));
     fullnameLC = (*env)->CallObjectMethod(env, fullname,
                                           fmi->toLowerCaseMID, fmi->locale);
     (*env)->CallBooleanMethod(env, fmi->list, fmi->addMID, fullname);
@@ -314,7 +314,7 @@
     GdiFontMapInfo *fmi = (GdiFontMapInfo*)lParam;
     JNIEnv *env = fmi->env;
     jstring familyLC;
-    int slen;
+    size_t slen;
     LOGFONTW lfw;
 
     /* Both Vista and XP return DEVICE_FONTTYPE for OTF fonts */
@@ -336,7 +336,7 @@
             return 1;
     }
     slen = wcslen(lpelfe->elfLogFont.lfFaceName);
-    fmi->family = (*env)->NewString(env,lpelfe->elfLogFont.lfFaceName, slen);
+    fmi->family = (*env)->NewString(env,lpelfe->elfLogFont.lfFaceName, (jsize)slen);
     familyLC = (*env)->CallObjectMethod(env, fmi->family,
                                         fmi->toLowerCaseMID, fmi->locale);
     /* check if already seen this family with a different charset */
@@ -386,10 +386,10 @@
 static BOOL RegistryToBaseTTNameA(LPSTR name) {
     static const char TTSUFFIX[] = " (TrueType)";
     static const char OTSUFFIX[] = " (OpenType)";
-    int TTSLEN = strlen(TTSUFFIX);
+    size_t TTSLEN = strlen(TTSUFFIX);
     char *suffix;
 
-    int len = strlen(name);
+    size_t len = strlen(name);
     if (len == 0) {
         return FALSE;
     }
@@ -412,10 +412,10 @@
 static BOOL RegistryToBaseTTNameW(LPWSTR name) {
     static const wchar_t TTSUFFIX[] = L" (TrueType)";
     static const wchar_t OTSUFFIX[] = L" (OpenType)";
-    int TTSLEN = wcslen(TTSUFFIX);
+    size_t TTSLEN = wcslen(TTSUFFIX);
     wchar_t *suffix;
 
-    int len = wcslen(name);
+    size_t len = wcslen(name);
     if (len == 0) {
         return FALSE;
     }
@@ -439,7 +439,7 @@
     LPSTR ptr1, ptr2;
     jstring fontStr;
     JNIEnv *env = fmi->env;
-    int dslen = strlen(data);
+    size_t dslen = strlen(data);
     jstring fileStr = JNU_NewStringPlatform(env, data);
 
     /* TTC or ttc means it may be a collection. Need to parse out
@@ -488,8 +488,8 @@
     wchar_t *ptr1, *ptr2;
     jstring fontStr;
     JNIEnv *env = fmi->env;
-    int dslen = wcslen(data);
-    jstring fileStr = (*env)->NewString(env, data, dslen);
+    size_t dslen = wcslen(data);
+    jstring fileStr = (*env)->NewString(env, data, (jsize)dslen);
 
     /* TTC or ttc means it may be a collection. Need to parse out
      * multiple font face names separated by " & "
@@ -510,7 +510,7 @@
             while ((ptr2 = wcsstr(ptr1, L" & ")) != NULL) {
                 ptr1 = ptr2+3;
             }
-            fontStr = (*env)->NewString(env, ptr1, wcslen(ptr1));
+            fontStr = (*env)->NewString(env, ptr1, (jsize)wcslen(ptr1));
             fontStr = (*env)->CallObjectMethod(env, fontStr,
                                                fmi->toLowerCaseMID,
                                                fmi->locale);
@@ -524,7 +524,7 @@
             }
         }
     } else {
-        fontStr = (*env)->NewString(env, name, wcslen(name));
+        fontStr = (*env)->NewString(env, name, (jsize)wcslen(name));
         fontStr = (*env)->CallObjectMethod(env, fontStr,
                                            fmi->toLowerCaseMID, fmi->locale);
         (*env)->CallObjectMethod(env, fontToFileMap, fmi->putMID,