/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2013 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
switch (o->direction)
{
case ODR_DECODE:
- if ((res = ber_decinteger(o->bp, val, odr_max(o))) <= 0)
+ if ((res = ber_decinteger(o->op->bp, val, odr_max(o))) <= 0)
{
odr_seterror(o, OPROTO, 50);
return 0;
}
- o->bp += res;
+ o->op->bp += res;
return 1;
case ODR_ENCODE:
if ((res = ber_encinteger(o, *val)) < 0)
size_t i;
for (i = sizeof(uval); i > 0; )
{
- tmp[--i] = uval;
+ tmp[--i] = (unsigned char ) uval; /* only want lower 8 bits */
uval >>= 8;
}
for (i = 0; i < sizeof(uval)-1; i++)
len = sizeof(uval) - i;
if (ber_enclen(o, len, 1, 1) != 1)
return -1;
- if (odr_write2(o, (const char *) tmp + i, len) < 0)
+ if (odr_write(o, (const char *) tmp + i, len) < 0)
return -1;
return 0;
}