projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 4.2.34
[yaz-moved-to-github.git]
/
src
/
odr.c
diff --git
a/src/odr.c
b/src/odr.c
index
2b69471
..
1d2c744
100644
(file)
--- a/
src/odr.c
+++ b/
src/odr.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2009 Index Data
+ * Copyright (C) 1995-2012 Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
@@
-22,12
+22,12
@@
#include <yaz/snprintf.h>
#include "odr-priv.h"
#include <yaz/snprintf.h>
#include "odr-priv.h"
-static int log_level=0;
-static int log_level_initialized=0;
+static int log_level = 0;
+static int log_level_initialized = 0;
Odr_null *ODR_NULLVAL = (Odr_null *) "NULL"; /* the presence of a null value */
Odr_null *ODR_NULLVAL = (Odr_null *) "NULL"; /* the presence of a null value */
-Odr_null *odr_nullval (void)
+Odr_null *odr_nullval(void)
{
return ODR_NULLVAL;
}
{
return ODR_NULLVAL;
}
@@
-144,7
+144,7
@@
void odr_FILE_write(ODR o, void *handle, int type,
fputs("\n", (FILE*) handle);
}
#endif
fputs("\n", (FILE*) handle);
}
#endif
- for (i = 0; i<len; i++)
+ for (i = 0; i < len; i++)
{
unsigned c = ((const unsigned char *) buf)[i];
if (i == 2000 && len > 3100)
{
unsigned c = ((const unsigned char *) buf)[i];
if (i == 2000 && len > 3100)
@@
-175,6
+175,7
@@
void odr_setprint(ODR o, FILE *file)
odr_set_stream(o, file, odr_FILE_write, odr_FILE_close);
}
odr_set_stream(o, file, odr_FILE_write, odr_FILE_close);
}
+
void odr_set_stream(ODR o, void *handle,
void (*stream_write)(ODR o,
void *handle, int type,
void odr_set_stream(ODR o, void *handle,
void (*stream_write)(ODR o,
void *handle, int type,
@@
-193,7
+194,7
@@
int odr_set_charset(ODR o, const char *to, const char *from)
o->op->iconv_handle = 0;
if (to && from)
{
o->op->iconv_handle = 0;
if (to && from)
{
- o->op->iconv_handle = yaz_iconv_open (to, from);
+ o->op->iconv_handle = yaz_iconv_open(to, from);
if (o->op->iconv_handle == 0)
return -1;
}
if (o->op->iconv_handle == 0)
return -1;
}
@@
-206,13
+207,13
@@
ODR odr_createmem(int direction)
ODR o;
if (!log_level_initialized)
{
ODR o;
if (!log_level_initialized)
{
- log_level=yaz_log_module_level("odr");
- log_level_initialized=1;
+ log_level = yaz_log_module_level("odr");
+ log_level_initialized = 1;
}
}
- if (!(o = (ODR)xmalloc(sizeof(*o))))
+ if (!(o = (ODR) xmalloc(sizeof(*o))))
return 0;
return 0;
- o->op = (struct Odr_private *) xmalloc (sizeof(*o->op));
+ o->op = (struct Odr_private *) xmalloc(sizeof(*o->op));
o->direction = direction;
o->buf = 0;
o->size = o->pos = o->top = 0;
o->direction = direction;
o->buf = 0;
o->size = o->pos = o->top = 0;
@@
-223,7
+224,7
@@
ODR odr_createmem(int direction)
o->op->iconv_handle = 0;
odr_setprint(o, stderr);
odr_reset(o);
o->op->iconv_handle = 0;
odr_setprint(o, stderr);
odr_reset(o);
- yaz_log (log_level, "odr_createmem dir=%d o=%p", direction, o);
+ yaz_log(log_level, "odr_createmem dir=%d o=%p", direction, o);
return o;
}
return o;
}
@@
-231,8
+232,8
@@
void odr_reset(ODR o)
{
if (!log_level_initialized)
{
{
if (!log_level_initialized)
{
- log_level=yaz_log_module_level("odr");
- log_level_initialized=1;
+ log_level = yaz_log_module_level("odr");
+ log_level_initialized = 1;
}
odr_seterror(o, ONONE, 0);
}
odr_seterror(o, ONONE, 0);
@@
-251,7
+252,7
@@
void odr_reset(ODR o)
o->op->lenlen = 1;
if (o->op->iconv_handle != 0)
yaz_iconv(o->op->iconv_handle, 0, 0, 0, 0);
o->op->lenlen = 1;
if (o->op->iconv_handle != 0)
yaz_iconv(o->op->iconv_handle, 0, 0, 0, 0);
- yaz_log (log_level, "odr_reset o=%p", o);
+ yaz_log(log_level, "odr_reset o=%p", o);
}
void odr_destroy(ODR o)
}
void odr_destroy(ODR o)
@@
-262,17
+263,16
@@
void odr_destroy(ODR o)
if (o->op->stream_close)
o->op->stream_close(o->op->print);
if (o->op->iconv_handle != 0)
if (o->op->stream_close)
o->op->stream_close(o->op->print);
if (o->op->iconv_handle != 0)
- yaz_iconv_close (o->op->iconv_handle);
+ yaz_iconv_close(o->op->iconv_handle);
xfree(o->op);
xfree(o);
xfree(o->op);
xfree(o);
- yaz_log (log_level, "odr_destroy o=%p", o);
+ yaz_log(log_level, "odr_destroy o=%p", o);
}
void odr_setbuf(ODR o, char *buf, int len, int can_grow)
{
odr_seterror(o, ONONE, 0);
o->bp = (unsigned char *) buf;
}
void odr_setbuf(ODR o, char *buf, int len, int can_grow)
{
odr_seterror(o, ONONE, 0);
o->bp = (unsigned char *) buf;
-
o->buf = (unsigned char *) buf;
o->op->can_grow = can_grow;
o->top = o->pos = 0;
o->buf = (unsigned char *) buf;
o->op->can_grow = can_grow;
o->top = o->pos = 0;
@@
-300,6
+300,7
@@
void odr_printf(ODR o, const char *fmt, ...)
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab