* util_token.c: Include limits.h.
authorKen Raeburn <raeburn@mit.edu>
Fri, 31 Mar 2006 01:34:38 +0000 (01:34 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 31 Mar 2006 01:34:38 +0000 (01:34 +0000)
(der_length_size, der_write_length): Test INT_MAX instead of SIZEOF_INT.
(der_read_length): Test sizeof(int) instead of SIZEOF_INT.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17812 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/generic/ChangeLog
src/lib/gssapi/generic/util_token.c

index d4a3a66f98ee8a50de18701118f40ddf51fdac4c..803ae6c527ae4cdf1d08d2327097ad5c2cd95ddb 100644 (file)
@@ -1,3 +1,10 @@
+2006-03-30  Ken Raeburn  <raeburn@mit.edu>
+
+       * util_token.c: Include limits.h.
+       (der_length_size, der_write_length): Test INT_MAX instead of
+       SIZEOF_INT.
+       (der_read_length): Test sizeof(int) instead of SIZEOF_INT.
+
 2006-03-27  Ken Raeburn  <raeburn@mit.edu>
 
        * Makefile.in (include_xom): Define as "rem" instead of empty on
index 97a788c09edcef740404a439293e344445979785..6277e942a2d69a4de46097cd40e1adedca61ce14 100644 (file)
@@ -24,6 +24,7 @@
 #ifdef HAVE_MEMORY_H
 #include <memory.h>
 #endif
+#include <limits.h>
 
 /*
  * $Id$
@@ -65,7 +66,7 @@ static unsigned int der_length_size(length)
       return(1);
    else if (length < (1<<8))
       return(2);
-#if (SIZEOF_INT == 2)
+#if INT_MAX == 0x7fff
    else
        return(3);
 #else
@@ -86,7 +87,7 @@ static void der_write_length(buf, length)
       *(*buf)++ = (unsigned char) length;
    } else {
       *(*buf)++ = (unsigned char) (der_length_size(length)+127);
-#if (SIZEOF_INT > 2)
+#if INT_MAX > 0x7fff
       if (length >= (1<<24))
         *(*buf)++ = (unsigned char) (length>>24);
       if (length >= (1<<16))
@@ -115,7 +116,7 @@ static int der_read_length(buf, bufsize)
    if (sf & 0x80) {
       if ((sf &= 0x7f) > ((*bufsize)-1))
         return(-1);
-      if (sf > SIZEOF_INT)
+      if (sf > sizeof(int))
          return (-1);
       ret = 0;
       for (; sf; sf--) {