X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fber_int.c;h=13e07cb93821048ccc3772fa18fd9661814c8cf7;hp=fc89b0deb1c3b255fbd68fc07d77320e47b86da9;hb=4e3f7be8266559e07dc01ae5d6aba31d30b8bd44;hpb=825d22351b1d59c71e98357b4931bf7bb67daa3a diff --git a/src/ber_int.c b/src/ber_int.c index fc89b0d..13e07cb 100644 --- a/src/ber_int.c +++ b/src/ber_int.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2005, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2009 Index Data * See the file LICENSE for details. - * - * $Id: ber_int.c,v 1.4 2005-01-16 21:51:50 adam Exp $ */ /** @@ -25,7 +23,8 @@ #ifdef WIN32 #include -#else +#endif +#if HAVE_NETINET_IN_H #include #endif @@ -41,21 +40,21 @@ 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; + 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; + if ((res = ber_encinteger(o, *val)) < 0) + return 0; + return 1; case ODR_PRINT: - return 1; + return 1; default: - odr_seterror(o, OOTHER, 51); return 0; + odr_seterror(o, OOTHER, 51); return 0; } } @@ -77,9 +76,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; } @@ -111,8 +107,14 @@ 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 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +