Esempio n. 1
0
static int cs_complete_auto_x(const char *buf, int len, int head_only)
{
    if (len > 5 && buf[0] >= 0x20 && buf[0] < 0x7f
                && buf[1] >= 0x20 && buf[1] < 0x7f
                && buf[2] >= 0x20 && buf[2] < 0x7f)
    {
        int r = cs_complete_http(buf, len, head_only);
        return r;
    }
    return completeBER(buf, len);
}
Esempio n. 2
0
File: ber_any.c Progetto: nla/yaz
int ber_any(ODR o, Odr_any **p)
{
    int res;

    switch (o->direction)
    {
    case ODR_DECODE:
        if ((res = completeBER(o->bp, odr_max(o))) <= 0)        /* FIX THIS */
        {
            odr_seterror(o, OPROTO, 2);
            return 0;
        }
        (*p)->buf = (unsigned char *)odr_malloc(o, res);
        memcpy((*p)->buf, o->bp, res);
        (*p)->len = (*p)->size = res;
        o->bp += res;
        return 1;
    case ODR_ENCODE:
        if (odr_write(o, (*p)->buf, (*p)->len) < 0)
            return 0;
        return 1;
    default: odr_seterror(o, OOTHER, 3); return 0;
    }
}