FTCharToGlyphIndexMap::find no longer returns a pointer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
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);
}