Commit a4cb0d95d90a7ed76625dc5d60af66dca03733c5

Werner Lemberg 2008-08-23T19:54:06

* src/type/t1afm.c (compare_kern_pairs), src/pxaux/afmparse.c (afm_compare_kern_pairs): Fix comparison. This fixes Savannah bug #24119.

diff --git a/ChangeLog b/ChangeLog
index 617f8ec..a85224e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,16 @@
+2008-08-23  Werner Lemberg  <wl@gnu.org>
+
+	* src/type/t1afm.c (compare_kern_pairs), src/pxaux/afmparse.c
+	(afm_compare_kern_pairs): Fix comparison.  This fixes Savannah bug
+	#24119.
+
 2008-08-19  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
 
-	* src/base/ftobjs.c (FT_Stream_New): Initialize *astream
-	always, even if passed library or arguments are invalid.
-	This fixes a bug that uninitialized stream is freed when
-	an invalid library handle is passed. Originally proposed
-	by Mike Fabian, 2008/08/18 on freetype-devel.
+	* src/base/ftobjs.c (FT_Stream_New): Initialize *astream always,
+	even if passed library or arguments are invalid.  This fixes a bug
+	that an uninitialized stream is freed when an invalid library handle
+	is passed.  Originally proposed by Mike Fabian, 2008/08/18 on
+	freetype-devel.
 	(FT_Open_Face): Ditto (stream).
 	(load_face_in_embedded_rfork): Ditto (stream2).
 
diff --git a/src/gxvalid/gxvcommn.c b/src/gxvalid/gxvcommn.c
index 82fd6b3..46fc123 100644
--- a/src/gxvalid/gxvcommn.c
+++ b/src/gxvalid/gxvcommn.c
@@ -50,11 +50,11 @@
                              FT_UShort*  b )
   {
     if ( *a < *b )
-      return ( -1 );
+      return -1;
     else if ( *a > *b )
-      return ( 1 );
+      return 1;
     else
-      return ( 0 );
+      return 0;
   }
 
 
@@ -115,11 +115,11 @@
                             FT_ULong*  b )
   {
     if ( *a < *b )
-      return ( -1 );
+      return -1;
     else if ( *a > *b )
-      return ( 1 );
+      return 1;
     else
-      return ( 0 );
+      return 0;
   }
 
 
diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c
index 0528fe6..63a786e 100644
--- a/src/psaux/afmparse.c
+++ b/src/psaux/afmparse.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    AFM parser (body).                                                   */
 /*                                                                         */
-/*  Copyright 2006, 2007 by                                                */
+/*  Copyright 2006, 2007, 2008 by                                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -672,7 +672,12 @@
     FT_ULong  index2 = KERN_INDEX( kp2->index1, kp2->index2 );
 
 
-    return (int)( index1 - index2 );
+    if ( index1 > index2 )
+      return 1;
+    else if ( index1 < index2 )
+      return -1;
+    else
+      return 0;
   }
 
 
diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c
index 40a61b9..41942a9 100644
--- a/src/psnames/psmodule.c
+++ b/src/psnames/psmodule.c
@@ -174,9 +174,23 @@
 
     /* sort base glyphs before glyph variants */
     if ( unicode1 == unicode2 )
-      return map1->unicode - map2->unicode;
+    {
+      if ( map1->unicode > map2->unicode )
+        return 1;
+      else if ( map1->unicode < map2->unicode )
+        return -1;
+      else
+        return 0;
+    }
     else
-      return unicode1 - unicode2;
+    {
+      if ( unicode1 > unicode2 )
+        return 1;
+      else if ( unicode1 < unicode2 )
+        return -1;
+      else
+        return 0;
+    }
   }
 
 
diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c
index b81a8df..5aea588 100644
--- a/src/type1/t1afm.c
+++ b/src/type1/t1afm.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    AFM support for Type 1 fonts (body).                                 */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007 by             */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by       */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -88,7 +88,12 @@
     FT_ULong  index2 = KERN_INDEX( pair2->index1, pair2->index2 );
 
 
-    return (int)( index1 - index2 );
+    if ( index1 > index2 )
+      return 1;
+    else if ( index1 < index2 )
+      return -1;
+    else
+      return 0;
   }