Update source headers for 2008. Omit CVS ID keyword subst.
[yaz-moved-to-github.git] / src / ber_int.c
index ef1a0e0..f0680fb 100644 (file)
@@ -1,8 +1,6 @@
-/*
- * Copyright (c) 1995-2004, Index Data
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2008 Index Data
  * See the file LICENSE for details.
- *
- * $Id: ber_int.c,v 1.2 2004-10-15 00:18:59 adam Exp $
  */
 
 /** 
 
 #include <string.h>
 
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
 #ifdef WIN32
 #include <winsock.h>
 #else
-#include <sys/types.h>
 #include <netinet/in.h>
 #endif
 
@@ -37,20 +38,22 @@ int ber_integer(ODR o, int *val)
 
     switch (o->direction)
     {
-        case ODR_DECODE:
-            if ((res = ber_decinteger(o->bp, val, odr_max(o))) <= 0)
-            {
-                odr_seterror(o, OPROTO, 50);
-                return 0;
-            }
-            o->bp += res;
-            return 1;
-        case ODR_ENCODE:
-            if ((res = ber_encinteger(o, *val)) < 0)
-                return 0;
-            return 1;
-        case ODR_PRINT: return 1;
-        default: odr_seterror(o, OOTHER, 51);  return 0;
+    case ODR_DECODE:
+        if ((res = ber_decinteger(o->bp, val, odr_max(o))) <= 0)
+        {
+            odr_seterror(o, OPROTO, 50);
+            return 0;
+        }
+        o->bp += res;
+        return 1;
+    case ODR_ENCODE:
+        if ((res = ber_encinteger(o, *val)) < 0)
+            return 0;
+        return 1;
+    case ODR_PRINT:
+        return 1;
+    default:
+        odr_seterror(o, OOTHER, 51);  return 0;
     }
 }
 
@@ -72,9 +75,6 @@ int ber_encinteger(ODR o, int val)
         return -1;
     if (odr_write(o, (unsigned char*) tmp.c + a, len) < 0)
         return -1;
-#ifdef ODR_DEBUG
-    fprintf(stderr, "[val=%d]", val);
-#endif
     return 0;
 }
 
@@ -106,8 +106,13 @@ int ber_decinteger(const unsigned char *buf, int *val, int max)
     *val = ntohl(tmp.i);
 
     b += len;
-#ifdef ODR_DEBUG
-    fprintf(stderr, "[val=%d]", *val);
-#endif
     return b - buf;
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+