summaryrefslogtreecommitdiffstats
path: root/src/include/k5-utf8.h
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2009-05-14 16:16:32 +0000
committerGreg Hudson <ghudson@mit.edu>2009-05-14 16:16:32 +0000
commitee699ef91ba36719e50ce9dc5d54dd3896740917 (patch)
tree07979e330dc4412208e29eef89a02e6d7f515306 /src/include/k5-utf8.h
parentd8c1fcc9fc7690629d10536750e6a4f873c2cbc1 (diff)
downloadkrb5-ee699ef91ba36719e50ce9dc5d54dd3896740917.tar.gz
krb5-ee699ef91ba36719e50ce9dc5d54dd3896740917.tar.xz
krb5-ee699ef91ba36719e50ce9dc5d54dd3896740917.zip
UCS2 support doesn't handle upper half of BMP
Make krb5_ucs2 an unsigned type. Eliminate the need for distinguished values for ucs2 and ucs4 characters by changing the API of the single- character conversion routines. ticket: 6489 tags: pullup target_version: 1.7 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22350 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include/k5-utf8.h')
-rw-r--r--src/include/k5-utf8.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/include/k5-utf8.h b/src/include/k5-utf8.h
index b5a3945597..e3f134b565 100644
--- a/src/include/k5-utf8.h
+++ b/src/include/k5-utf8.h
@@ -84,9 +84,9 @@
#endif
#if INT_MAX == 0x7fff
-typedef int krb5_ucs2;
+typedef unsigned int krb5_ucs2;
#elif SHRT_MAX == 0x7fff
-typedef short krb5_ucs2;
+typedef unsigned short krb5_ucs2;
#else
#error undefined 16 bit type
#endif
@@ -101,15 +101,12 @@ typedef short krb5_ucs4;
#error: undefined 32 bit type
#endif
-#define KRB5_UCS2_INVALID ((krb5_ucs2)0x8000)
-#define KRB5_UCS4_INVALID ((krb5_ucs4)0x80000000)
-
#define KRB5_MAX_UTF8_LEN (sizeof(krb5_ucs2) * 3/2)
-krb5_ucs2 krb5int_utf8_to_ucs2(const char *p);
+int krb5int_utf8_to_ucs2(const char *p, krb5_ucs2 *out);
size_t krb5int_ucs2_to_utf8(krb5_ucs2 c, char *buf);
-krb5_ucs4 krb5int_utf8_to_ucs4(const char *p);
+int krb5int_utf8_to_ucs4(const char *p, krb5_ucs4 *out);
size_t krb5int_ucs4_to_utf8(krb5_ucs4 c, char *buf);
int