* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
- * $Id: odr-priv.h,v 1.1 2002-07-25 13:20:20 adam Exp $
+ * $Id: odr-priv.h,v 1.2 2002-08-28 07:53:51 adam Exp $
*/
#ifndef ODR_PRIV_H
#define ODR_PRIV_H
-#if HAVE_ICONV_H
-#include <iconv.h>
-#endif
-
#include <yaz/odr.h>
+#include <yaz/yaz-util.h>
struct Odr_ber_tag { /* used to be statics in ber_tag... */
int lclass;
odr_constack stack[ODR_MAX_STACK];
struct Odr_ber_tag odr_ber_tag;
-#if HAVE_ICONV_H
- iconv_t iconv_handle;
-#endif
+ yaz_iconv_t iconv_handle;
};
/* Private macro.
* Copyright (c) 1995-2002, Index Data
* See the file LICENSE for details.
*
- * $Id: odr.c,v 1.35 2002-07-25 12:51:08 adam Exp $
+ * $Id: odr.c,v 1.36 2002-08-28 07:53:51 adam Exp $
*
*/
#if HAVE_CONFIG_H
int odr_set_charset(ODR o, const char *to, const char *from)
{
-#if HAVE_ICONV_H
- if (o->op->iconv_handle != (iconv_t)(-1))
- iconv_close (o->op->iconv_handle);
+ if (o->op->iconv_handle)
+ yaz_iconv_close (o->op->iconv_handle);
o->op->iconv_handle = iconv_open (to, from);
- if (o->op->iconv_handle == (iconv_t)(-1))
+ if (o->op->iconv_handle == 0)
return -1;
return 0;
-#else
- return -1;
-#endif
}
#include <yaz/log.h>
r->enable_bias = 1;
r->op = xmalloc (sizeof(*r->op));
r->op->odr_ber_tag.lclass = -1;
-#if HAVE_ICONV_H
- r->op->iconv_handle = (iconv_t)(-1);
-#endif
+ r->op->iconv_handle = 0;
odr_reset(r);
yaz_log (LOG_DEBUG, "odr_createmem dir=%d o=%p", direction, r);
return r;
nmem_reset(o->mem);
o->choice_bias = -1;
o->lenlen = 1;
-#if HAVE_ICONV_H
- if (o->op->iconv_handle != (iconv_t)(-1))
- iconv(o->op->iconv_handle, 0, 0, 0, 0);
-#endif
+ if (o->op->iconv_handle != 0)
+ yaz_iconv(o->op->iconv_handle, 0, 0, 0, 0);
yaz_log (LOG_DEBUG, "odr_reset o=%p", o);
}
xfree(o->buf);
if (o->print && o->print != stderr)
fclose(o->print);
-#if HAVE_ICONV_H
- if (o->op->iconv_handle != (iconv_t)(-1))
- iconv_close (o->op->iconv_handle);
-#endif
+ if (o->op->iconv_handle != 0)
+ yaz_iconv_close (o->op->iconv_handle);
xfree(o->op);
xfree(o);
yaz_log (LOG_DEBUG, "odr_destroy o=%p", o);
* See the file LICENSE for details.
* Sebastian Hammer, Adam Dickmeiss
*
- * $Id: odr_oct.c,v 1.17 2002-07-25 12:51:08 adam Exp $
+ * $Id: odr_oct.c,v 1.18 2002-08-28 07:53:51 adam Exp $
*/
#if HAVE_CONFIG_H
#include <config.h>
if (o->direction == ODR_ENCODE)
{
t->buf = 0;
-#if HAVE_ICONV_H
- if (o->op->iconv_handle != (iconv_t)(-1))
+
+ if (o->op->iconv_handle != 0)
{
size_t inleft = strlen(*p);
char *inbuf = *p;
t->buf = outbuf;
- ret = iconv (o->op->iconv_handle, &inbuf, &inleft,
- &outbuf, &outleft);
+ ret = yaz_iconv (o->op->iconv_handle, &inbuf, &inleft,
+ &outbuf, &outleft);
if (ret == (size_t)(-1))
{
o->error = ODATA;
}
t->size = t->len = outbuf - (char*) t->buf;
}
-#endif
if (!t->buf)
{
t->buf = (unsigned char *) *p;
if (o->direction == ODR_DECODE)
{
*p = 0;
-#if HAVE_ICONV_H
- if (o->op->iconv_handle != (iconv_t)(-1))
+
+ if (o->op->iconv_handle != 0)
{
size_t inleft = t->len;
char *inbuf = t->buf;
*p = outbuf;
- ret = iconv (o->op->iconv_handle, &inbuf, &inleft,
- &outbuf, &outleft);
+ ret = yaz_iconv (o->op->iconv_handle, &inbuf, &inleft,
+ &outbuf, &outleft);
if (ret == (size_t)(-1))
{
o->error = ODATA;
(*p)[inleft] = '\0'; /* null terminate it */
}
-#endif
if (!*p)
{
*p = (char *) t->buf;