X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fodr_oct.c;h=8d3cc059119e210fda21e9b9cb4c258f1897c303;hb=60a702f390f7e2addfdab79f2328db3ba2897c8b;hp=f8e2682081edb41467969c4fc3648f57813ddf81;hpb=c6e47cbbff56f39f6d81b079ebaeac41d793d4d9;p=yaz-moved-to-github.git diff --git a/src/odr_oct.c b/src/odr_oct.c index f8e2682..8d3cc05 100644 --- a/src/odr_oct.c +++ b/src/odr_oct.c @@ -1,15 +1,17 @@ /* - * Copyright (c) 1995-2003, Index Data + * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. - * Sebastian Hammer, Adam Dickmeiss * - * $Id: odr_oct.c,v 1.1 2003-10-27 12:21:33 adam Exp $ + * $Id: odr_oct.c,v 1.8 2005-01-15 19:47:14 adam Exp $ + */ +/** + * \file odr_oct.c + * \brief Implements ODR OCTET codec */ #if HAVE_CONFIG_H #include #endif -#include #include "odr-priv.h" /* @@ -33,19 +35,12 @@ int odr_octetstring(ODR o, Odr_oct **p, int opt, const char *name) return odr_missing(o, opt, name); if (o->direction == ODR_PRINT) { - int i; odr_prname(o, name); - fprintf(o->print, "OCTETSTRING(len=%d)", (*p)->len); - for (i = 0; i<(*p)->len; i++) - { - if (i < 5 || i > ((*p)->len - 4)) - { - fprintf (o->print, " %02X", (*p)->buf[i]); - } - else if (i == 5) - fprintf (o->print, " .. "); - } - fprintf(o->print, "\n"); + odr_printf(o, "OCTETSTRING(len=%d) ", (*p)->len); + + o->op->stream_write(o, o->print, ODR_OCTETSTRING, + (char*) (*p)->buf, (*p)->len); + odr_printf(o, "\n"); return 1; } if (o->direction == ODR_DECODE) @@ -83,7 +78,7 @@ int odr_cstring(ODR o, char **p, int opt, const char *name) if (o->direction == ODR_PRINT) { odr_prname(o, name); - fprintf(o->print, "'%s'\n", *p); + odr_printf(o, "'%s'\n", *p); return 1; } t = (Odr_oct *)odr_malloc(o, sizeof(Odr_oct)); /* wrapper for octstring */ @@ -130,7 +125,7 @@ int odr_iconv_string(ODR o, char **p, int opt, const char *name) if (o->direction == ODR_PRINT) { odr_prname(o, name); - fprintf(o->print, "'%s'\n", *p); + odr_printf(o, "'%s'\n", *p); return 1; } t = (Odr_oct *)odr_malloc(o, sizeof(Odr_oct)); /* wrapper for octstring */