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 5.4.1
[yaz-moved-to-github.git]
/
src
/
siconv.c
diff --git
a/src/siconv.c
b/src/siconv.c
index
d7f066d
..
42220e2
100644
(file)
--- a/
src/siconv.c
+++ b/
src/siconv.c
@@
-1,5
+1,5
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) Index Data
* See the file LICENSE for details.
*/
/**
* See the file LICENSE for details.
*/
/**
@@
-20,25
+20,18
@@
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
-#include <ctype.h>
#if HAVE_ICONV_H
#include <iconv.h>
#endif
#include <yaz/xmalloc.h>
#if HAVE_ICONV_H
#include <iconv.h>
#endif
#include <yaz/xmalloc.h>
-#include <yaz/nmem.h>
+#include <yaz/errno.h>
#include "iconv-p.h"
struct yaz_iconv_struct {
int my_errno;
int init_flag;
#include "iconv-p.h"
struct yaz_iconv_struct {
int my_errno;
int init_flag;
-#if 0
- size_t (*init_handle)(yaz_iconv_t cd, unsigned char *inbuf,
- size_t inbytesleft, size_t *no_read);
- unsigned long (*read_handle)(yaz_iconv_t cd, unsigned char *inbuf,
- size_t inbytesleft, size_t *no_read);
-#endif
size_t no_read_x;
unsigned long unget_x;
#if HAVE_ICONV_H
size_t no_read_x;
unsigned long unget_x;
#if HAVE_ICONV_H
@@
-71,6
+64,8
@@
static int prepare_encoders(yaz_iconv_t cd, const char *tocode)
return 1;
if (yaz_wchar_encoder(tocode, &cd->encoder))
return 1;
return 1;
if (yaz_wchar_encoder(tocode, &cd->encoder))
return 1;
+ if (yaz_danmarc_encoder(tocode, &cd->encoder))
+ return 1;
return 0;
}
return 0;
}
@@
-92,12
+87,14
@@
static int prepare_decoders(yaz_iconv_t cd, const char *tocode)
return 1;
if (yaz_wchar_decoder(tocode, &cd->decoder))
return 1;
return 1;
if (yaz_wchar_decoder(tocode, &cd->decoder))
return 1;
+ if (yaz_danmarc_decoder(tocode, &cd->decoder))
+ return 1;
return 0;
}
yaz_iconv_t yaz_iconv_open(const char *tocode, const char *fromcode)
{
return 0;
}
yaz_iconv_t yaz_iconv_open(const char *tocode, const char *fromcode)
{
- yaz_iconv_t cd = (yaz_iconv_t) xmalloc (sizeof(*cd));
+ yaz_iconv_t cd = (yaz_iconv_t) xmalloc(sizeof(*cd));
cd->encoder.data = 0;
cd->encoder.write_handle = 0;
cd->encoder.data = 0;
cd->encoder.write_handle = 0;
@@
-184,10
+181,10
@@
size_t yaz_iconv(yaz_iconv_t cd, char **inbuf, size_t *inbytesleft,
if (cd->init_flag)
{
cd->my_errno = YAZ_ICONV_UNKNOWN;
if (cd->init_flag)
{
cd->my_errno = YAZ_ICONV_UNKNOWN;
-
+
if (cd->encoder.init_handle)
(*cd->encoder.init_handle)(&cd->encoder);
if (cd->encoder.init_handle)
(*cd->encoder.init_handle)(&cd->encoder);
-
+
cd->unget_x = 0;
cd->no_read_x = 0;
cd->unget_x = 0;
cd->no_read_x = 0;
@@
-197,7
+194,7
@@
size_t yaz_iconv(yaz_iconv_t cd, char **inbuf, size_t *inbytesleft,
size_t r = (cd->decoder.init_handle)(
cd, &cd->decoder,
inbuf ? (unsigned char *) *inbuf : 0,
size_t r = (cd->decoder.init_handle)(
cd, &cd->decoder,
inbuf ? (unsigned char *) *inbuf : 0,
- inbytesleft ? *inbytesleft : 0,
+ inbytesleft ? *inbytesleft : 0,
&no_read);
if (r)
{
&no_read);
if (r)
{
@@
-248,7
+245,7
@@
size_t yaz_iconv(yaz_iconv_t cd, char **inbuf, size_t *inbytesleft,
break;
}
x = (*cd->decoder.read_handle)(
break;
}
x = (*cd->decoder.read_handle)(
- cd, &cd->decoder,
+ cd, &cd->decoder,
(unsigned char *) *inbuf, *inbytesleft, &no_read);
if (no_read == 0)
{
(unsigned char *) *inbuf, *inbytesleft, &no_read);
if (no_read == 0)
{
@@
-306,7
+303,9
@@
void yaz_iconv_set_errno(yaz_iconv_t cd, int no)
/*
* 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
*/
+