Changed include/yaz/diagbib1.h and added include/yaz/diagsrw.h with
[yaz-moved-to-github.git] / src / ber_int.c
index 7b1aba8..fc89b0d 100644 (file)
@@ -1,20 +1,31 @@
 /*
- * Copyright (c) 1995-2003, Index Data
+ * Copyright (C) 1995-2005, Index Data ApS
  * See the file LICENSE for details.
- * Sebastian Hammer, Adam Dickmeiss
  *
- * $Id: ber_int.c,v 1.1 2003-10-27 12:21:30 adam Exp $
+ * $Id: ber_int.c,v 1.4 2005-01-16 21:51:50 adam Exp $
  */
+
+/** 
+ * \file ber_int.c
+ * \brief Implements BER INTEGER encoding and decoding.
+ *
+ * This source file implements BER encoding and decoding of
+ * the INTEGER type.
+ */
+
 #if HAVE_CONFIG_H
 #include <config.h>
 #endif
 
 #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
 
@@ -29,20 +40,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;
     }
 }