X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzgdu.c;h=8c8222e6b9587b59b79343821a04fcab1868721f;hp=19865896749ca954f0e6f65f54a5ba4f47d24db9;hb=b06636208651777c08e2456bf3b5953fc3c0f2c2;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0 diff --git a/src/zgdu.c b/src/zgdu.c index 1986589..8c8222e 100644 --- a/src/zgdu.c +++ b/src/zgdu.c @@ -1,32 +1,35 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ - /** * \file zgdu.c * \brief Implements HTTP and Z39.50 encoding and decoding. */ +#if HAVE_CONFIG_H +#include +#endif #include -#include +#include "odr-priv.h" #include -int z_GDU (ODR o, Z_GDU **p, int opt, const char *name) +int z_GDU(ODR o, Z_GDU **p, int opt, const char *name) { + const char *buf = o->op->buf; if (o->direction == ODR_DECODE) { *p = (Z_GDU *) odr_malloc(o, sizeof(**p)); - if (o->size > 10 && !memcmp(o->buf, "HTTP/", 5)) + if (o->op->size > 10 && !memcmp(buf, "HTTP/", 5)) { (*p)->which = Z_GDU_HTTP_Response; return yaz_decode_http_response(o, &(*p)->u.HTTP_Response); } - else if (o->size > 5 && - o->buf[0] >= 0x20 && o->buf[0] < 0x7f - && o->buf[1] >= 0x20 && o->buf[1] < 0x7f - && o->buf[2] >= 0x20 && o->buf[2] < 0x7f - && o->buf[3] >= 0x20 && o->buf[3] < 0x7f) + else if (o->op->size > 5 && + buf[0] >= 0x20 && buf[0] < 0x7f + && buf[1] >= 0x20 && buf[1] < 0x7f + && buf[2] >= 0x20 && buf[2] < 0x7f + && buf[3] >= 0x20 && buf[3] < 0x7f) { (*p)->which = Z_GDU_HTTP_Request; return yaz_decode_http_request(o, &(*p)->u.HTTP_Request); @@ -55,6 +58,7 @@ int z_GDU (ODR o, Z_GDU **p, int opt, const char *name) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab