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
Indentation
[yaz-moved-to-github.git]
/
odr
/
odr.c
diff --git
a/odr/odr.c
b/odr/odr.c
index
22f9b21
..
948043c
100644
(file)
--- a/
odr/odr.c
+++ b/
odr/odr.c
@@
-2,7
+2,7
@@
* Copyright (c) 1995-2003, Index Data
* See the file LICENSE for details.
*
* Copyright (c) 1995-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: odr.c,v 1.39 2003-01-06 08:20:27 adam Exp $
+ * $Id: odr.c,v 1.42 2003-05-19 14:37:38 adam Exp $
*
*/
#if HAVE_CONFIG_H
*
*/
#if HAVE_CONFIG_H
@@
-35,7
+35,8
@@
char *odr_errlist[] =
"Malformed data",
"Stack overflow",
"Length of constructed type different from sum of members",
"Malformed data",
"Stack overflow",
"Length of constructed type different from sum of members",
- "Overflow writing definite length of constructed type"
+ "Overflow writing definite length of constructed type",
+ "HTTP Bad Request"
};
char *odr_errmsg(int n)
};
char *odr_errmsg(int n)
@@
-53,6
+54,19
@@
int odr_geterror(ODR o)
return o->error;
}
return o->error;
}
+int odr_geterrorx(ODR o, int *x)
+{
+ if (x)
+ *x = o->op->error_id;
+ return o->error;
+}
+
+void odr_seterror(ODR o, int error, int id)
+{
+ o->error = error;
+ o->op->error_id = id;
+}
+
void odr_setprint(ODR o, FILE *file)
{
o->print = file;
void odr_setprint(ODR o, FILE *file)
{
o->print = file;
@@
-62,10
+76,13
@@
int odr_set_charset(ODR o, const char *to, const char *from)
{
if (o->op->iconv_handle)
yaz_iconv_close (o->op->iconv_handle);
{
if (o->op->iconv_handle)
yaz_iconv_close (o->op->iconv_handle);
-
- o->op->iconv_handle = yaz_iconv_open (to, from);
- if (o->op->iconv_handle == 0)
- return -1;
+ o->op->iconv_handle = 0;
+ if (to && from)
+ {
+ o->op->iconv_handle = yaz_iconv_open (to, from);
+ if (o->op->iconv_handle == 0)
+ return -1;
+ }
return 0;
}
return 0;
}
@@
-94,7
+111,7
@@
ODR odr_createmem(int direction)
void odr_reset(ODR o)
{
void odr_reset(ODR o)
{
- o->error = ONONE;
+ odr_seterror(o, ONONE, 0);
o->bp = o->buf;
odr_seek(o, ODR_S_SET, 0);
o->top = 0;
o->bp = o->buf;
odr_seek(o, ODR_S_SET, 0);
o->top = 0;
@@
-141,3
+158,4
@@
char *odr_getbuf(ODR o, int *len, int *size)
*size = o->size;
return (char*) o->buf;
}
*size = o->size;
return (char*) o->buf;
}
+