Mercurial > sdl-ios-xcode
diff test/testime.c @ 5153:1435f8a6425c
Nobody is currently maintaining the QNX code, so removing it for now.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 01 Feb 2011 21:40:03 -0800 |
parents | 518d1679d2d0 |
children | 762e40fb8e28 |
line wrap: on
line diff
--- a/test/testime.c Tue Feb 01 21:23:43 2011 -0800 +++ b/test/testime.c Tue Feb 01 21:40:03 2011 -0800 @@ -10,11 +10,7 @@ #endif #define DEFAULT_PTSIZE 30 -#ifdef __QNXNTO__ - #define DEFAULT_FONT "/usr/photon/font_repository/tt0003m_.ttf" -#else - #define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" -#endif +#define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" #define MAX_TEXT_LENGTH 256 SDL_Surface *screen; @@ -28,36 +24,36 @@ char text[MAX_TEXT_LENGTH], markedText[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; int cursor = 0; -size_t utf8_length(unsigned char c) -{ - c = (unsigned char)(0xff & c); - if (c < 0x80) - return 1; - else if ((c >> 5) ==0x6) - return 2; - else if ((c >> 4) == 0xe) - return 3; - else if ((c >> 3) == 0x1e) - return 4; - else - return 0; -} - -char *utf8_next(char *p) -{ - size_t len = utf8_length(*p); - size_t i = 0; - if (!len) - return 0; - - for (; i < len; ++i) - { - ++p; - if (!*p) - return 0; - } - return p; -} +size_t utf8_length(unsigned char c) +{ + c = (unsigned char)(0xff & c); + if (c < 0x80) + return 1; + else if ((c >> 5) ==0x6) + return 2; + else if ((c >> 4) == 0xe) + return 3; + else if ((c >> 3) == 0x1e) + return 4; + else + return 0; +} + +char *utf8_next(char *p) +{ + size_t len = utf8_length(*p); + size_t i = 0; + if (!len) + return 0; + + for (; i < len; ++i) + { + ++p; + if (!*p) + return 0; + } + return p; +} char *utf8_advance(char *p, size_t distance) {