CQL: accept relations "within", "encloses"
[yaz-moved-to-github.git] / src / ber_int.c
index ca3ea10..e9b23a2 100644 (file)
@@ -1,9 +1,9 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2010 Index Data
+ * Copyright (C) 1995-2013 Index Data
  * See the file LICENSE for details.
  */
 
-/** 
+/**
  * \file ber_int.c
  * \brief Implements BER INTEGER encoding and decoding.
  *
@@ -88,21 +88,20 @@ int ber_encinteger(ODR o, Odr_int val)
 int ber_decinteger(const unsigned char *buf, Odr_int *val, int max)
 {
     unsigned long long uval = 0;
-    int len;
-    size_t i;
+    int i, len;
     int res;
     const unsigned char *b = buf;
 
     if ((res = ber_declen(b, &len, max)) < 0)
         return -1;
     if (len+res > max || len < 0) /* out of bounds or indefinite encoding */
-        return -1;  
+        return -1;
     if (len > (int) sizeof(uval))  /* let's be reasonable, here */
         return -1;
     b += res;
 
     if (*b & 0x80)
-        for (i = 0; i < sizeof(uval) - len; i++)
+        for (i = 0; i < (int) sizeof(uval) - len; i++)
             uval = (uval << 8) + 0xFF;
     for (i = 0; i < len; i++)
         uval = (uval << 8) + b[i];