Expanded tabs in all source files. Added vim/emacs local variables
[yaz-moved-to-github.git] / src / ber_null.c
1 /*
2  * Copyright (C) 1995-2005, Index Data ApS
3  * See the file LICENSE for details.
4  *
5  * $Id: ber_null.c,v 1.4 2005-06-25 15:46:03 adam Exp $
6  */
7
8 /** 
9  * \file ber_null.c
10  * \brief Implements ber_null
11  *
12  * This source file implements BER encoding and decoding of
13  * the NULL type.
14  */
15 #if HAVE_CONFIG_H
16 #include <config.h>
17 #endif
18
19 #include "odr-priv.h"
20
21 /** 
22  * ber_null: BER-en/decoder for NULL type.
23  */
24 int ber_null(ODR o)
25 {
26     switch (o->direction)
27     {
28     case ODR_ENCODE:
29         if (odr_putc(o, 0X00) < 0)
30             return 0;
31 #ifdef ODR_DEBUG
32         fprintf(stderr, "[NULL]\n");
33 #endif
34         return 1;
35     case ODR_DECODE:
36         if (odr_max(o) < 1)
37         {
38             odr_seterror(o, OPROTO, 39);
39             return 0;
40         }
41         if (*(o->bp++) != 0X00)
42         {
43             odr_seterror(o, OPROTO, 12);
44             return 0;
45         }
46 #ifdef ODR_DEBUG
47         fprintf(stderr, "[NULL]\n");
48 #endif
49         return 1;
50     case ODR_PRINT:
51         return 1;
52     default:
53         odr_seterror(o, OOTHER, 13);
54         return 0;
55     }
56 }
57 /*
58  * Local variables:
59  * c-basic-offset: 4
60  * indent-tabs-mode: nil
61  * End:
62  * vim: shiftwidth=4 tabstop=8 expandtab
63  */
64