changeset 3469:f986ebd9c080

[xemacs-hg @ 2006-06-23 15:44:59 by stephent] Quiet GCC 4 signedness warnings. <87zmg399dw.fsf@tleepslib.sk.tsukuba.ac.jp> <87veqr996l.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Fri, 23 Jun 2006 15:45:03 +0000
parents 4572e331d1cf
children 09127fab1a6e
files src/ChangeLog src/font-mgr.c src/objects-x.c
diffstat 3 files changed, 57 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Jun 22 21:51:18 2006 +0000
+++ b/src/ChangeLog	Fri Jun 23 15:45:03 2006 +0000
@@ -1,3 +1,24 @@
+2006-06-23  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* font-mgr.c (extract_fcapi_string):
+	(fc_intern):
+	(Ffc_name_parse):
+	(Ffc_name_unparse):
+	(Ffc_pattern_add):
+	(Ffc_pattern_del):
+	(Ffc_pattern_get):
+	(string_list_to_fcobjectset):
+	fc_intern and extract_fcapi_string should return
+	[const] Extbyte *.  Make it so, update callers.
+
+2006-05-26  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* objects-x.c (x_initialize_font_instance):
+	(x_font_instance_truename):
+	(charset_table):
+	(x_find_charset_font):
+	Pander to GCC4 signed character paranoia.
+
 2006-06-19  Jerry James  <james@xemacs.org>
 
 	* device-x.c (x_IO_error_handler): Do not dereference d if it is
--- a/src/font-mgr.c	Thu Jun 22 21:51:18 2006 +0000
+++ b/src/font-mgr.c	Fri Jun 23 15:45:03 2006 +0000
@@ -120,7 +120,7 @@
    is a Lisp string.
 */
 #define extract_fcapi_string(str) \
-  ((FcChar8 *) NEW_LISP_STRING_TO_EXTERNAL ((str), Qfc_font_name_encoding))
+  (NEW_LISP_STRING_TO_EXTERNAL ((str), Qfc_font_name_encoding))
 
 /* #### This homebrew lashup should be replaced with FcConstants.
 
@@ -158,20 +158,20 @@
 /* #### Maybe fc_intern should be exposed to LISP?  The idea is that
    fc-pattern-add could warn or error if the property isn't interned. */
 
-static FcChar8 *
+static const Extbyte *
 fc_intern (Lisp_Object property)
 {
   const void *dummy;
-  FcChar8 *prop = extract_fcapi_string (property);
+  const Extbyte *prop = extract_fcapi_string (property);
   const void *val = gethash (prop, fc_property_name_hash_table, &dummy);
 
   /* extract_fcapi_string returns something alloca'd
      so we can just drop the old value of prop on the floor */
   if (val)
-    prop = (FcChar8 *) val;
+    prop = (const Extbyte *) val;
   else
     {
-      prop = FcStrCopy (prop);
+      prop = (const Extbyte *) FcStrCopy ((FcChar8 *) prop);
       puthash (prop, NULL, fc_property_name_hash_table);
     }
   return prop;
@@ -207,7 +207,7 @@
 
   CHECK_STRING(name);		/* #### MEMORY LEAK!!  maybe not ... */
 
-  fcpat->fcpatPtr = FcNameParse (extract_fcapi_string (name));
+  fcpat->fcpatPtr = FcNameParse ((FcChar8 *) extract_fcapi_string (name));
   return wrap_fcpattern(fcpat);
 }
 
@@ -220,10 +220,10 @@
 {
   CHECK_FCPATTERN(pattern);
   {
-  FcChar8 *temp = FcNameUnparse(XFCPATTERN_PTR(pattern));
-  Lisp_Object res = build_ext_string (temp, Qfc_font_name_encoding);
-  free (temp);
-  return res;
+    Extbyte *temp = (Extbyte *) FcNameUnparse(XFCPATTERN_PTR(pattern));
+    Lisp_Object res = build_ext_string (temp, Qfc_font_name_encoding);
+    free (temp);
+    return res;
   }
 }
 
@@ -250,7 +250,7 @@
       (pattern, property, value))
 {
   Bool res = 0;
-  Extbyte *obj;
+  const Extbyte *obj;
   FcPattern *fcpat;
 
   CHECK_FCPATTERN(pattern);
@@ -291,8 +291,7 @@
   CHECK_FCPATTERN(pattern);
   CHECK_STRING(property);
 
-  res = FcPatternDel(XFCPATTERN_PTR(pattern), 
-		     extract_fcapi_string (property));
+  res = FcPatternDel(XFCPATTERN_PTR(pattern), extract_fcapi_string (property));
   return res ? Qt : Qnil;
 }
 
@@ -375,7 +374,7 @@
 Xft v.2:  encoding, charwidth, charheight, core, and render. */
       (pattern, property, id, type))
 {
-  FcChar8 *fc_property;		/* UExtbyte * */
+  Extbyte *fc_property;
   FcResult fc_result;
   FcValue fc_value;
 
@@ -390,7 +389,7 @@
 #endif
   if (STRINGP (property))
     {
-      fc_property = (FcChar8 *) extract_fcapi_string (property);
+      fc_property = extract_fcapi_string (property);
     }
   else
     {
@@ -427,7 +426,8 @@
 	case FcTypeString:
 	  return ((!NILP (type) && !EQ (type, Qstring))
 		  ? Qfc_result_type_mismatch
-		  : build_ext_string (fc_value.u.s, Qfc_font_name_encoding));
+		  : build_ext_string ((Extbyte *) fc_value.u.s,
+				      Qfc_font_name_encoding));
 	case FcTypeBool:
 	  return ((!NILP (type) && !EQ (type, Qboolean))
 		  ? Qfc_result_type_mismatch : fc_value.u.b ? Qt : Qnil);
@@ -700,7 +700,7 @@
 {
   EXTERNAL_LIST_LOOP_2 (elt, list)
     {
-      FcChar8 *s;
+      const Extbyte *s;
 
       CHECK_STRING (elt);
       s = fc_intern (elt);
--- a/src/objects-x.c	Thu Jun 22 21:51:18 2006 +0000
+++ b/src/objects-x.c	Fri Jun 23 15:45:03 2006 +0000
@@ -253,7 +253,7 @@
 #define PRINT_XFT_PATTERN(level,format,pattern)			\
   do {								\
     DECLARE_EISTRING (eistrpxft_name);				\
-    FcChar8 *name = FcNameUnparse (pattern);			\
+    Extbyte *name = (Extbyte *) FcNameUnparse (pattern);	\
 								\
     eicpy_ext(eistrpxft_name, name, Qfc_font_name_encoding);	\
     DEBUG_XFT1 (level, format, eidata(eistrpxft_name));		\
@@ -267,7 +267,7 @@
 #define CHECKING_LANG(level,font,lang)					\
   do {									\
     DECLARE_EISTRING (eistrcl_name);					\
-    eicpy_ext(eistrcl_name, font, Qfc_font_name_encoding);		\
+    eicpy_ext(eistrcl_name, (Extbyte *) font, Qfc_font_name_encoding);	\
     DEBUG_XFT2 (level, "checking if %s handles %s\n",			\
 			eidata(eistrcl_name), lang);			\
   } while (0)
@@ -347,7 +347,7 @@
 	   cell size for estimating window dimensions.  The test_string8
 	   is an  ASCII string whose characters should approximate the
 	   distribution of widths expected in real text.  */
-	static const char test_string8[] = "Mmneei";
+	static const FcChar8 test_string8[] = "Mmneei";
 	static const int len = sizeof (test_string8) - 1;
 	XGlyphInfo glyphinfo;
 
@@ -814,7 +814,7 @@
       if (res)
 	{
 	  FONT_INSTANCE_TRUENAME (f) = 
-	    build_ext_string (res, Qfc_font_name_encoding); 
+	    build_ext_string ((Extbyte *) res, Qfc_font_name_encoding); 
 	  free (res);
 	  return FONT_INSTANCE_TRUENAME (f);
 	}
@@ -1120,7 +1120,8 @@
   Lisp_Object *charset;
   /* This is a debug facility, require ASCII. */
   Extbyte *language;		/* ASCII, please */
-  FcChar8 *rfc3066;		/* ASCII, please */
+  /* Technically this is FcChar8, but fsckin' GCC 4 bitches. */
+  Extbyte *rfc3066;		/* ASCII, please */
 };
 
 static struct charset_reporter charset_table[] =
@@ -1218,7 +1219,7 @@
       FcPattern *fontxft;	/* long-lived, freed at end of this block */
       FcResult fcresult;
       FcConfig *fcc;
-      FcChar8 *lang = "en";	/* #### fix this bogus hack! */
+      FcChar8 *lang = (FcChar8 *) "en";	/* #### fix this bogus hack! */
       FcCharSet *fccs = NULL;
       DECLARE_EISTRING (eistr_shortname); /* user-friendly nickname */
       DECLARE_EISTRING (eistr_longname);  /* omit FC_LANG and FC_CHARSET */
@@ -1230,7 +1231,7 @@
       /* parse the name, do the substitutions, and match the font */
 
       {
-	FcPattern *p = FcNameParse (patternext);
+	FcPattern *p = FcNameParse ((FcChar8 *) patternext);
 	PRINT_XFT_PATTERN (3, "FcNameParse'ed name is %s\n", p);
 	/* #### Next two return FcBool, but what does the return mean? */
 	/* The order is correct according the fontconfig docs. */
@@ -1257,7 +1258,7 @@
 
 	/* full name, including language coverage and repertoire */
 	name = FcNameUnparse (p);
-	eicpy_ext (eistr_fullname, name, Qfc_font_name_encoding);
+	eicpy_ext (eistr_fullname, (Extbyte *) name, Qfc_font_name_encoding);
 	free (name);
 
 	/* long name, omitting coverage and repertoire, plus a number
@@ -1274,7 +1275,7 @@
 	FcPatternDel (p, FC_SCALE);
 	FcPatternDel (p, FC_FONTVERSION);
 	name = FcNameUnparse (p);
-	eicpy_ext (eistr_longname, name, Qfc_font_name_encoding);
+	eicpy_ext (eistr_longname, (Extbyte *) name, Qfc_font_name_encoding);
 	free (name);
 
 	/* nickname, just family and size, but
@@ -1288,7 +1289,7 @@
 	FcPatternDel (p, FC_SCALABLE);
 	FcPatternDel (p, FC_DPI);
 	name = FcNameUnparse (p);
-	eicpy_ext (eistr_shortname, name, Qfc_font_name_encoding);
+	eicpy_ext (eistr_shortname, (Extbyte *) name, Qfc_font_name_encoding);
 	free (name);
 
 	FcPatternDestroy (p);
@@ -1316,14 +1317,15 @@
 	  {
 	    DECLARE_DEBUG_FONTNAME (name);
 	    CHECKING_LANG (0, eidata(name), cr->language);
-	    lang = cr->rfc3066;
+	    lang = (FcChar8 *) cr->rfc3066;
 	  }
 	else if (cr->charset)
 	  {
 	    /* what the hey, build 'em on the fly */
 	    /* #### in the case of error this could return NULL! */
 	    fccs = mule_to_fc_charset (charset);
-	    lang = XSTRING_DATA (XSYMBOL (XCHARSET_NAME (charset))-> name);
+	    lang = (FcChar8 *) XSTRING_DATA (XSYMBOL
+					     (XCHARSET_NAME (charset))-> name);
 	  }
 	else
 	  {
@@ -1331,14 +1333,14 @@
 	    warn_when_safe_lispobj (intern ("xft"), intern ("alert"),
 				    list2 (build_string ("unchecked charset"),
 					   charset));
+	    /* default to "en"
+	       #### THIS IS WRONG, WRONG, WRONG!!
+	       It is why we never fall through to XLFD-checking. */
 	  }
-	  /* default to "en"
-	     #### THIS IS WRONG, WRONG, WRONG!!
-	     It is why we never fall through to XLFD-checking. */
+
+	ASSERT_ASCTEXT_ASCII((Extbyte *) lang);
       }
 
-      ASSERT_ASCTEXT_ASCII(lang);
-
       if (fccs)
 	{
 	  /* check for character set coverage */