krb5 commit: Make krb5_ucs2 and krb5_ucs4 unsigned

Greg Hudson ghudson at mit.edu
Fri Dec 11 17:48:49 EST 2015


https://github.com/krb5/krb5/commit/b3722b5b4546e338d1d3dd9f359b1a15742b8508
commit b3722b5b4546e338d1d3dd9f359b1a15742b8508
Author: Greg Hudson <ghudson at mit.edu>
Date:   Fri Dec 11 14:48:41 2015 -0500

    Make krb5_ucs2 and krb5_ucs4 unsigned
    
    krb5 contains some Unicode code adapted from OpenLDAP.  OpenLDAP uses
    unsigned types for UCS-2 and UCS-4 code points, but the adapted code
    uses signed types, which creates pointer-sign warnings when we call
    uccompatdecomp() and similar functions.  To match the OpenLDAP code,
    use unsigned types.

 src/include/k5-utf8.h |   33 +++------------------------------
 1 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/src/include/k5-utf8.h b/src/include/k5-utf8.h
index a4b6375..22f433c 100644
--- a/src/include/k5-utf8.h
+++ b/src/include/k5-utf8.h
@@ -68,37 +68,10 @@
 #ifndef K5_UTF8_H
 #define K5_UTF8_H
 
-#include "autoconf.h"
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#if INT_MAX == 0x7fff
-typedef unsigned int    krb5_ucs2;
-#elif SHRT_MAX == 0x7fff
-typedef unsigned short  krb5_ucs2;
-#else
-#error undefined 16 bit type
-#endif
-
-#if INT_MAX == 0x7fffffffL
-typedef int     krb5_ucs4;
-#elif LONG_MAX == 0x7fffffffL
-typedef long    krb5_ucs4;
-#elif SHRT_MAX == 0x7fffffffL
-typedef short   krb5_ucs4;
-#else
-#error: undefined 32 bit type
-#endif
+#include "k5-platform.h"
+
+typedef uint16_t krb5_ucs2;
+typedef uint32_t krb5_ucs4;
 
 #define KRB5_MAX_UTF8_LEN   (sizeof(krb5_ucs2) * 3/2)
 


More information about the cvs-krb5 mailing list