Back to index

im-sdk  12.3.91
Defines | Typedefs | Functions
csconv.h File Reference
#include <sys/types.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define CSC_BASE_DIR_DEFAULT   "/usr/lib/iiim/csconv"
#define CSC_PATH   "/usr/lib/iiim/csconv/csconv.so"

Typedefs

typedef struct _csconv_infocsconv_t

Functions

csconv_t csconv_open_locale (const char *, const char *, const char *)
csconv_t csconv_open (const char *, const char *)
size_t csconv (csconv_t, const char **, size_t *, char **, size_t *)
int csconv_close (csconv_t)

Define Documentation

#define CSC_BASE_DIR_DEFAULT   "/usr/lib/iiim/csconv"

Definition at line 10 of file csconv.h.

#define CSC_PATH   "/usr/lib/iiim/csconv/csconv.so"

Definition at line 11 of file csconv.h.


Typedef Documentation

typedef struct _csconv_info* csconv_t

Definition at line 14 of file csconv.h.


Function Documentation

size_t csconv ( csconv_t  ,
const char **  ,
size_t *  ,
char **  ,
size_t *   
)

Definition at line 147 of file csconv.c.

{
    if (!cd || cd == (csconv_t)-1) {
#ifdef HAVE_ERRNO_H
      errno = EINVAL;
#endif
      return (size_t)-1;
    }
    return iconv(cd->cd, (ICONV_CONST char**)inbuf, inbytesleft, putbuf, outbytesleft);
}

Here is the caller graph for this function:

Definition at line 164 of file csconv.c.

{
    int retval = 0;
    if (!cd || cd == (csconv_t)-1) return -1;
    retval = iconv_close(cd->cd);
    free(cd);
    return retval;
}

Here is the caller graph for this function:

csconv_t csconv_open ( const char *  ,
const char *   
)

Definition at line 128 of file csconv.c.

{
#ifdef HAVE_LOCALE_H
    /* try to find current locale */
    /* we should pass NULL as a second argument */
    return csconv_open_locale(setlocale(LC_CTYPE, NULL), tocode, fromcode);
#endif
#ifdef HAVE_ERRNO_H
    /* we cannot determine locale */
    /* set errno to EINVAL */
    errno = EINVAL;
#endif
    return (csconv_t)-1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

csconv_t csconv_open_locale ( const char *  ,
const char *  ,
const char *   
)

Definition at line 96 of file csconv.c.

{
    csconv_t conv = NULL;
    char *from = NULL, *to = NULL;

    if (locale == NULL) goto error;
    if ((read_conf(locale, tocode, fromcode, &to, &from) == -1)) goto error;
    conv = calloc(1, sizeof(*conv));
    if (!conv) goto error;

    conv->cd = iconv_open(to, from);
    if (conv->cd == (iconv_t) -1) goto error;
    free(from);
    free(to);
    return conv;

error:
    if (conv) free(conv);
    if (from) free(from);
    if (to) free(to);
#ifdef HAVE_ERRNO_H
    errno = EINVAL;
#endif
    return (csconv_t)-1;
}

Here is the call graph for this function:

Here is the caller graph for this function: