History log of /haiku/headers/private/interface/utf8_functions.h
Revision Date Author Comments
# 647b5a29 08-Jan-2019 Murai Takashi <tmurai01@gmail.com>

utf8_functions.h: Fix PVS 359

Fix integer constant SIZE_MAX is converted to pointer.

Change-Id: Ifdff4e08a9b2c31e466580ba9a71f6ea7c0191d4
Reviewed-on: https://review.haiku-os.org/c/865
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# dd26f81c 06-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add an UTF8NextCharLen() version that takes a string length.

This one works with non-terminated strings that we may need to handle.
It also validates that the sequence is valid UTF-8 so it results in
the same behaviour as the version that is used when converting to
codes (syncing the enumeration and drawing behaviour).


# 598a6d85 28-May-2010 Axel Dörfler <axeld@pinc-software.de>

* 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


# ed3215ee 14-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

Save one check in certain situations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28080 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 87df6901 28-Feb-2008 Michael Lotz <mmlr@mlotz.ch>

* 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


# d273d008 28-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* 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


# ccf6ad1d 28-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

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


# 326dce3a 28-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* 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


# f3001f6a 25-Dec-2006 Michael Lotz <mmlr@mlotz.ch>

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


# 33794281 25-Dec-2006 Michael Lotz <mmlr@mlotz.ch>

* 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


# e04ec862 29-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* 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


# 93820f1e 26-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

Renamed moreUTF8.h to utf8_functions.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17239 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dd26f81c56b9eeeba267d9cdf50aa3b20d3b6d8a 06-Dec-2011 Michael Lotz <mmlr@mlotz.ch>

Add an UTF8NextCharLen() version that takes a string length.

This one works with non-terminated strings that we may need to handle.
It also validates that the sequence is valid UTF-8 so it results in
the same behaviour as the version that is used when converting to
codes (syncing the enumeration and drawing behaviour).


# 598a6d8517dedc2ad2a7769d5a53e8e036d3e3cc 28-May-2010 Axel Dörfler <axeld@pinc-software.de>

* 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


# ed3215ee2118d9b99fcb622b0361f2bd6e84a9da 14-Oct-2008 Stephan Aßmus <superstippi@gmx.de>

Save one check in certain situations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28080 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 87df690150e63445aecf90d63f23fb614ebf575e 28-Feb-2008 Michael Lotz <mmlr@mlotz.ch>

* 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


# d273d008229294ea3ce11517a74d3c525d847365 28-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* 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


# ccf6ad1d8be8ef6460257c95d577829add8a56d2 28-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

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


# 326dce3ae0e72bf8e35e6fe3e583c38dde1c716f 28-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

* 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


# f3001f6a1dc10579f9282253528c90345a53c5ca 25-Dec-2006 Michael Lotz <mmlr@mlotz.ch>

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


# 3379428150e443850c2700ce56548c14f4f5ee5c 25-Dec-2006 Michael Lotz <mmlr@mlotz.ch>

* 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


# e04ec8626e19b897081b6b50cc84da1f2c29909b 29-Aug-2006 Axel Dörfler <axeld@pinc-software.de>

* 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


# 93820f1ea7afb270758e286246c3757622fb0016 26-Apr-2006 Axel Dörfler <axeld@pinc-software.de>

Renamed moreUTF8.h to utf8_functions.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17239 a95241bf-73f2-0310-859d-f6bbb57e9c96