YAZ  5.23.1
odr_any.c
Go to the documentation of this file.
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) Index Data
3  * See the file LICENSE for details.
4  */
5 
11 #if HAVE_CONFIG_H
12 #include <config.h>
13 #endif
14 
15 #include "odr-priv.h"
16 
23 int odr_any(ODR o, Odr_any **p, int opt, const char *name)
24 {
25  if (o->error)
26  return 0;
27  if (o->direction == ODR_PRINT)
28  {
29  odr_prname(o, name);
30  odr_printf(o, "ANY (len=%d)\n", (*p)->len);
31  return 1;
32  }
33  if (o->direction == ODR_DECODE)
34  *p = (Odr_oct *)odr_malloc(o, sizeof(**p));
35  if (ber_any(o, p))
36  return 1;
37  *p = 0;
38  return odr_missing(o, opt, name);
39 }
40 /*
41  * Local variables:
42  * c-basic-offset: 4
43  * c-file-style: "Stroustrup"
44  * indent-tabs-mode: nil
45  * End:
46  * vim: shiftwidth=4 tabstop=8 expandtab
47  */
48 
#define ODR_PRINT
Definition: odr.h:97
int error
Definition: odr.h:128
char * name
Definition: initopt.c:18
void * odr_malloc(ODR o, size_t size)
Definition: odr_mem.c:31
void odr_prname(ODR o, const char *name)
Definition: odr_util.c:18
int odr_any(ODR o, Odr_any **p, int opt, const char *name)
Definition: odr_any.c:23
Internal ODR definitions.
int direction
Definition: odr.h:126
Definition: odr.h:99
int odr_missing(ODR o, int opt, const char *name)
Definition: odr_util.c:82
Definition: odr.h:124
int opt
Definition: initopt.c:19
int ber_any(ODR o, Odr_any **p)
Definition: ber_any.c:21
void odr_printf(ODR o, const char *fmt,...)
Definition: odr.c:290
#define ODR_DECODE
Definition: odr.h:95