Blame lib/striconv.h

Packit Service fdd496
/* Charset conversion.
Packit Service fdd496
   Copyright (C) 2001-2004, 2006-2007, 2009-2017 Free Software Foundation, Inc.
Packit Service fdd496
   Written by Bruno Haible and Simon Josefsson.
Packit Service fdd496
Packit Service fdd496
   This program is free software; you can redistribute it and/or modify
Packit Service fdd496
   it under the terms of the GNU General Public License as published by
Packit Service fdd496
   the Free Software Foundation; either version 3, or (at your option)
Packit Service fdd496
   any later version.
Packit Service fdd496
Packit Service fdd496
   This program is distributed in the hope that it will be useful,
Packit Service fdd496
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service fdd496
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service fdd496
   GNU General Public License for more details.
Packit Service fdd496
Packit Service fdd496
   You should have received a copy of the GNU General Public License
Packit Service fdd496
   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
Packit Service fdd496
Packit Service fdd496
#ifndef _STRICONV_H
Packit Service fdd496
#define _STRICONV_H
Packit Service fdd496
Packit Service fdd496
#include <stddef.h>
Packit Service fdd496
#if HAVE_ICONV
Packit Service fdd496
#include <iconv.h>
Packit Service fdd496
#endif
Packit Service fdd496
Packit Service fdd496
Packit Service fdd496
#ifdef __cplusplus
Packit Service fdd496
extern "C" {
Packit Service fdd496
#endif
Packit Service fdd496
Packit Service fdd496
Packit Service fdd496
#if HAVE_ICONV
Packit Service fdd496
Packit Service fdd496
/* Convert an entire string from one encoding to another, using iconv.
Packit Service fdd496
   The original string is at [SRC,...,SRC+SRCLEN-1].
Packit Service fdd496
   The conversion descriptor is passed as CD.
Packit Service fdd496
   *RESULTP and *LENGTH should initially be a scratch buffer and its size,
Packit Service fdd496
   or *RESULTP can initially be NULL.
Packit Service fdd496
   May erase the contents of the memory at *RESULTP.
Packit Service fdd496
   Return value: 0 if successful, otherwise -1 and errno set.
Packit Service fdd496
   If successful: The resulting string is stored in *RESULTP and its length
Packit Service fdd496
   in *LENGTHP.  *RESULTP is set to a freshly allocated memory block, or is
Packit Service fdd496
   unchanged if no dynamic memory allocation was necessary.  */
Packit Service fdd496
extern int mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
Packit Service fdd496
                         char **resultp, size_t *lengthp);
Packit Service fdd496
Packit Service fdd496
/* Convert an entire string from one encoding to another, using iconv.
Packit Service fdd496
   The original string is the NUL-terminated string starting at SRC.
Packit Service fdd496
   The conversion descriptor is passed as CD.  Both the "from" and the "to"
Packit Service fdd496
   encoding must use a single NUL byte at the end of the string (i.e. not
Packit Service fdd496
   UCS-2, UCS-4, UTF-16, UTF-32).
Packit Service fdd496
   Allocate a malloced memory block for the result.
Packit Service fdd496
   Return value: the freshly allocated resulting NUL-terminated string if
Packit Service fdd496
   successful, otherwise NULL and errno set.  */
Packit Service fdd496
extern char * str_cd_iconv (const char *src, iconv_t cd);
Packit Service fdd496
Packit Service fdd496
#endif
Packit Service fdd496
Packit Service fdd496
/* Convert an entire string from one encoding to another, using iconv.
Packit Service fdd496
   The original string is the NUL-terminated string starting at SRC.
Packit Service fdd496
   Both the "from" and the "to" encoding must use a single NUL byte at the
Packit Service fdd496
   end of the string (i.e. not UCS-2, UCS-4, UTF-16, UTF-32).
Packit Service fdd496
   Allocate a malloced memory block for the result.
Packit Service fdd496
   Return value: the freshly allocated resulting NUL-terminated string if
Packit Service fdd496
   successful, otherwise NULL and errno set.  */
Packit Service fdd496
extern char * str_iconv (const char *src,
Packit Service fdd496
                         const char *from_codeset, const char *to_codeset);
Packit Service fdd496
Packit Service fdd496
Packit Service fdd496
#ifdef __cplusplus
Packit Service fdd496
}
Packit Service fdd496
#endif
Packit Service fdd496
Packit Service fdd496
Packit Service fdd496
#endif /* _STRICONV_H */