File: h_iconv.c

package info (click to toggle)
darcs 2.12.4-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,748 kB
  • sloc: haskell: 42,936; sh: 11,086; ansic: 837; perl: 129; makefile: 8
file content (18 lines) | stat: -rw-r--r-- 631 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "h_iconv.h"

// Wrapper functions, since iconv_open et al are macros in libiconv.
iconv_t darcs_iconv_open(const char *tocode, const char *fromcode) {
    return iconv_open(tocode, fromcode);
}

void darcs_iconv_close(iconv_t cd) {
    iconv_close(cd);
}

size_t darcs_iconv(iconv_t cd, char **inbuf, size_t *inbytesleft,
                char **outbuf, size_t *outbytesleft) {
    // Cast inbuf to (void*) so that it works both on Solaris, which expects
    // a (const char**), and on other platforms (e.g. Linux), which expect
    // a (char **).
    return iconv(cd, (void*)inbuf, inbytesleft, outbuf, outbytesleft);
}