summaryrefslogtreecommitdiff
path: root/src/fl_utf.c
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2009-09-17 20:00:33 +0000
committerMatthias Melcher <fltk@matthiasm.com>2009-09-17 20:00:33 +0000
commit9ba790be3bfc78060a54ddc6038b887a8033a800 (patch)
treed59103a1ef29957c33f27606d097717b84bbe5c2 /src/fl_utf.c
parentd631c334a2418df38f9f8520f7a2ad3f952f1f1b (diff)
Added the counterpart for FL_COMMAND (F_CONTROL). Added GTK Boxtype to the Forms test. Made utf function more fail-safe. Testing SCM on Xcode (wish me luck)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6876 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_utf.c')
-rw-r--r--src/fl_utf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/fl_utf.c b/src/fl_utf.c
index 1362ef755..cc2059ce5 100644
--- a/src/fl_utf.c
+++ b/src/fl_utf.c
@@ -138,11 +138,11 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
{
unsigned char c = *(unsigned char*)p;
if (c < 0x80) {
- *len = 1;
+ if (len) *len = 1;
return c;
#if ERRORS_TO_CP1252
} else if (c < 0xa0) {
- *len = 1;
+ if (len) *len = 1;
return cp1252[c-0x80];
#endif
} else if (c < 0xc2) {
@@ -150,7 +150,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
}
if (p+1 >= end || (p[1]&0xc0) != 0x80) goto FAIL;
if (c < 0xe0) {
- *len = 2;
+ if (len) *len = 2;
return
((p[0] & 0x1f) << 6) +
((p[1] & 0x3f));
@@ -171,7 +171,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
} else if (c < 0xf0) {
UTF8_3:
if (p+2 >= end || (p[2]&0xc0) != 0x80) goto FAIL;
- *len = 3;
+ if (len) *len = 3;
return
((p[0] & 0x0f) << 12) +
((p[1] & 0x3f) << 6) +
@@ -182,7 +182,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
} else if (c < 0xf4) {
UTF8_4:
if (p+3 >= end || (p[2]&0xc0) != 0x80 || (p[3]&0xc0) != 0x80) goto FAIL;
- *len = 4;
+ if (len) *len = 4;
#if STRICT_RFC3629
/* RFC 3629 says all codes ending in fffe or ffff are illegal: */
if ((p[1]&0xf)==0xf &&
@@ -199,7 +199,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
goto UTF8_4;
} else {
FAIL:
- *len = 1;
+ if (len) *len = 1;
#if ERRORS_TO_ISO8859_1
return c;
#else