Commit 4a42ba2ea13c795a40ac82a62abc0a5fef25ef6f

henry 2003-10-11T03:41:25

FTCharToGlyphIndexMap::find no longer returns a pointer

diff --git a/include/FTCharToGlyphIndexMap.h b/include/FTCharToGlyphIndexMap.h
index bd31c67..6e40d3c 100644
--- a/include/FTCharToGlyphIndexMap.h
+++ b/include/FTCharToGlyphIndexMap.h
@@ -71,7 +71,7 @@ class FTGL_EXPORT FTCharToGlyphIndexMap
             }
         }
 
-        const GlyphIndex* find( CharacterCode c)
+        const GlyphIndex find( CharacterCode c)
         {
             if( !this->Indices)
             {
@@ -92,7 +92,7 @@ class FTGL_EXPORT FTCharToGlyphIndexMap
                 return 0;
             }
         
-            return ptr;
+            return *ptr;
         }
 
         void insert( CharacterCode c, GlyphIndex g)
diff --git a/src/FTCharmap.cpp b/src/FTCharmap.cpp
index 1875d6f..31f6aa3 100644
--- a/src/FTCharmap.cpp
+++ b/src/FTCharmap.cpp
@@ -46,15 +46,7 @@ bool FTCharmap::CharMap( FT_Encoding encoding)
 
 unsigned int FTCharmap::CharIndex( unsigned int characterCode )
 {
-    const CharacterMap::GlyphIndex *result = charMap.find( characterCode);
-    if( !result)
-    {
-        return 0;
-    }
-    else
-    {
-        return *result;
-    }
+    return charMap.find( characterCode);
 }
 
 
diff --git a/test/FTFTCharToGlyphIndexMap-Test.cpp b/test/FTFTCharToGlyphIndexMap-Test.cpp
index ad03999..9635c39 100755
--- a/test/FTFTCharToGlyphIndexMap-Test.cpp
+++ b/test/FTFTCharToGlyphIndexMap-Test.cpp
@@ -24,8 +24,8 @@ class FTCharToGlyphIndexMapTest : public CppUnit::TestCase
         {
             FTCharToGlyphIndexMap testMap;
             
-            CPPUNIT_ASSERT( testMap.find( 2) == NULL);
-            CPPUNIT_ASSERT( testMap.find( 5) == NULL);
+            CPPUNIT_ASSERT( testMap.find( 2) == 0);
+            CPPUNIT_ASSERT( testMap.find( 5) == 0);
         }
         
         void testInsert()
@@ -34,8 +34,8 @@ class FTCharToGlyphIndexMapTest : public CppUnit::TestCase
             
             testMap.insert( 2, 37);
             
-            CPPUNIT_ASSERT( *(testMap.find( 2)) == 37);
-            CPPUNIT_ASSERT( testMap.find( 5) == NULL);
+            CPPUNIT_ASSERT( testMap.find( 2) == 37);
+            CPPUNIT_ASSERT( testMap.find( 5) == 0);
         }
         
         void testClear()
@@ -45,8 +45,8 @@ class FTCharToGlyphIndexMapTest : public CppUnit::TestCase
             testMap.insert( 2, 37);
             testMap.clear();
             
-            CPPUNIT_ASSERT( testMap.find( 2) == NULL);
-            CPPUNIT_ASSERT( testMap.find( 5) == NULL);
+            CPPUNIT_ASSERT( testMap.find( 2) == 0);
+            CPPUNIT_ASSERT( testMap.find( 5) == 0);
         }