Commit Graph

10 Commits

Author SHA1 Message Date
Axel Dörfler 598a6d8517 * UTF8CountChars() was not 64-bit safe (and that in a hard to detect way).
* Automatic white space cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36968 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-28 18:37:36 +00:00
Stephan Aßmus ed3215ee21 Save one check in certain situations.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28080 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-14 13:16:44 +00:00
Michael Lotz 87df690150 * Replaced the UTF8ToCharCode function with one that handles invalid chars
correctly (or at all...)
* Use the common 0xfffd character as a substitute for invalid characters
* Corrected comment

This function is used by the app_server to convert the UTF8 strings to char
codes to feed FreeType. Using a non space substitute character at least for
now, as it makes it more obvious where invalid characters are present.
I tested this change with some UTF8 test files and it seems to work well.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24175 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-28 23:04:47 +00:00
Axel Dörfler d273d00822 * Fixed previous version of UTF8CountBytes() and put it in again: it was
breaking out of the loop too early, and would therefore miss the last
  character.
* Replaced UTF8CountChars() with a short and safe version as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24173 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-28 19:17:33 +00:00
Stephan Aßmus ccf6ad1d8b Reverted to the previous version. Axel, your change completely broke all kinds
of stuff. I think the trouble is that you keep decrementing charCount while
still inside the same UTF8 glyph. I cannot really tell, I am hoping you don't
mind me reverting to the old version, since the new one is only three lines,
so it should be easy to correct and re-commit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24172 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-28 15:56:31 +00:00
Axel Dörfler 326dce3ae0 * Simplified UTF8CountBytes() a bit, made it faster, and less error-prone
against malformed UTF-8.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24166 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-28 10:45:57 +00:00
Michael Lotz f3001f6a1d Corrected comments. It's a 0 byte, not a NULL pointer.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19625 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-12-25 22:02:01 +00:00
Michael Lotz 3379428150 * Made UTF8 functions overflow safe
* Unified UTF8CountChars and UTF8ToLength and removed the latter
* Rewrote UTF8CountBytes to use the more safe algorithm from UTF8CountChars
* Removed the unsafe count_utf8_bytes() function

This should fix bug #839. Marcus can you please review?

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19624 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-12-25 21:58:00 +00:00
Axel Dörfler e04ec8626e * UTF8ToCharCode() only skipped 3 bytes for a 4 byte character.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18702 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-08-29 22:20:18 +00:00
Axel Dörfler 93820f1ea7 Renamed moreUTF8.h to utf8_functions.h.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17239 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-04-26 10:16:19 +00:00