diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-06-18 19:09:36 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-06-18 19:09:36 +0000 |
| commit | ae3bc8673d79edecb8fcb918d83db011535b0955 (patch) | |
| tree | 3218d825b0856692ff4c795edf734a27a9dcb5dd /lib/gdi/font.cpp | |
| parent | f44dfc20f4ed708d67603f767a976c1168393627 (diff) | |
| download | enigma2-ae3bc8673d79edecb8fcb918d83db011535b0955.tar.gz enigma2-ae3bc8673d79edecb8fcb918d83db011535b0955.zip | |
hopefully fix frequently segfaults
Diffstat (limited to 'lib/gdi/font.cpp')
| -rw-r--r-- | lib/gdi/font.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index 2ff5fbf7..f7c1bca5 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -443,7 +443,7 @@ void eTextPara::setFont(Font *fnt, Font *replacement) void shape (std::vector<unsigned long> &string, const std::vector<unsigned long> &text); -int eTextPara::renderString(const std::string &string, int rflags) +int eTextPara::renderString(const char *string, int rflags) { singleLock s(ftlock); @@ -467,11 +467,12 @@ int eTextPara::renderString(const std::string &string, int rflags) } std::vector<unsigned long> uc_string, uc_visual; - uc_string.reserve(string.length()); + if (string) + uc_string.reserve(strlen(string)); - std::string::const_iterator p(string.begin()); + const char *p = string; - while(p != string.end()) + while(p) { unsigned int unicode=(unsigned char)*p++; @@ -481,28 +482,28 @@ int eTextPara::renderString(const std::string &string, int rflags) { unicode&=0x1F; unicode<<=6; - if (p != string.end()) + if (p) unicode|=(*p++)&0x3F; } else if ((unicode & 0xF0)==0xE0) // three bytes { unicode&=0x0F; unicode<<=6; - if (p != string.end()) + if (p) unicode|=(*p++)&0x3F; unicode<<=6; - if (p != string.end()) + if (p) unicode|=(*p++)&0x3F; } else if ((unicode & 0xF8)==0xF0) // four bytes { unicode&=0x07; unicode<<=6; - if (p != string.end()) + if (p) unicode|=(*p++)&0x3F; unicode<<=6; - if (p != string.end()) + if (p) unicode|=(*p++)&0x3F; unicode<<=6; - if (p != string.end()) + if (p) unicode|=(*p++)&0x3F; } } |
