YAZ  5.34.0
Data Structures | Functions
siconv.c File Reference

Implements simple ICONV. More...

#include <assert.h>
#include <errno.h>
#include <string.h>
#include <yaz/xmalloc.h>
#include "iconv-p.h"

Go to the source code of this file.

Data Structures

struct  yaz_iconv_struct
 

Functions

int yaz_iconv_isbuiltin (yaz_iconv_t cd)
 tests whether conversion is handled by YAZ' iconv or system iconv More...
 
static int prepare_encoders (yaz_iconv_t cd, const char *tocode)
 
static int prepare_decoders (yaz_iconv_t cd, const char *tocode)
 
yaz_iconv_t yaz_iconv_open (const char *tocode, const char *fromcode)
 just like iconv_open(3) More...
 
size_t yaz_iconv (yaz_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
 just like iconv(3) More...
 
int yaz_iconv_error (yaz_iconv_t cd)
 returns last error - like errno for iconv(3) More...
 
int yaz_iconv_close (yaz_iconv_t cd)
 just like iconv_close(3) More...
 
void yaz_iconv_set_errno (yaz_iconv_t cd, int no)
 

Detailed Description

Implements simple ICONV.

This implements an interface similar to that of iconv and is used by YAZ to interface with iconv (if present). For systems where iconv is not present, this layer provides a few important conversions: UTF-8, MARC-8, Latin-1.

Definition in file siconv.c.

Function Documentation

◆ prepare_decoders()

static int prepare_decoders ( yaz_iconv_t  cd,
const char *  tocode 
)
static

◆ prepare_encoders()

static int prepare_encoders ( yaz_iconv_t  cd,
const char *  tocode 
)
static

◆ yaz_iconv()

size_t yaz_iconv ( yaz_iconv_t  cd,
char **  inbuf,
size_t *  inbytesleft,
char **  outbuf,
size_t *  outbytesleft 
)

◆ yaz_iconv_close()

int yaz_iconv_close ( yaz_iconv_t  cd)

◆ yaz_iconv_error()

int yaz_iconv_error ( yaz_iconv_t  cd)

returns last error - like errno for iconv(3)

Definition at line 279 of file siconv.c.

References yaz_iconv_struct::my_errno.

Referenced by wrbuf_iconv_write2(), and yaz_write_marc8_generic().

◆ yaz_iconv_isbuiltin()

int yaz_iconv_isbuiltin ( yaz_iconv_t  cd)

tests whether conversion is handled by YAZ' iconv or system iconv

Definition at line 45 of file siconv.c.

References yaz_iconv_struct::decoder, yaz_iconv_struct::encoder, yaz_iconv_decoder_s::read_handle, and yaz_iconv_encoder_s::write_handle.

◆ yaz_iconv_open()

yaz_iconv_t yaz_iconv_open ( const char *  tocode,
const char *  fromcode 
)

◆ yaz_iconv_set_errno()

void yaz_iconv_set_errno ( yaz_iconv_t  cd,
int  no 
)