iconv_compat.c revision 282275
1/*-
2 * Copyright (c) 2013 Peter Wemm
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: stable/10/lib/libc/iconv/iconv_compat.c 282275 2015-04-30 16:08:47Z tijl $
27 */
28
29/*
30 * These are ABI implementations for when the raw iconv_* symbol
31 * space was exposed via libc.so.7 in its early life.  This is
32 * a transition aide, these wrappers will not normally ever be
33 * executed except via __sym_compat() references.
34 */
35#include <sys/types.h>
36#include <iconv.h>
37#include "iconv-internal.h"
38
39size_t
40__iconv_compat(iconv_t a, char ** b, size_t * c, char ** d,
41     size_t * e, __uint32_t f, size_t *g)
42{
43	return __bsd___iconv(a, b, c, d, e, f, g);
44}
45
46void
47__iconv_free_list_compat(char ** a, size_t b)
48{
49	__bsd___iconv_free_list(a, b);
50}
51
52int
53__iconv_get_list_compat(char ***a, size_t *b, __iconv_bool c)
54{
55	return __bsd___iconv_get_list(a, b, c);
56}
57
58size_t
59iconv_compat(iconv_t a, char ** __restrict b,
60      size_t * __restrict c, char ** __restrict d,
61      size_t * __restrict e)
62{
63	return __bsd_iconv(a, b, c, d, e);
64}
65
66const char *
67iconv_canonicalize_compat(const char *a)
68{
69	return __bsd_iconv_canonicalize(a);
70}
71
72int
73iconv_close_compat(iconv_t a)
74{
75	return __bsd_iconv_close(a);
76}
77
78iconv_t
79iconv_open_compat(const char *a, const char *b)
80{
81	return __bsd_iconv_open(a, b);
82}
83
84int
85iconv_open_into_compat(const char *a, const char *b, iconv_allocation_t *c)
86{
87	return __bsd_iconv_open_into(a, b, c);
88}
89
90void
91iconv_set_relocation_prefix_compat(const char *a, const char *b)
92{
93	return __bsd_iconv_set_relocation_prefix(a, b);
94}
95
96int
97iconvctl_compat(iconv_t a, int b, void *c)
98{
99	return __bsd_iconvctl(a, b, c);
100}
101
102void
103iconvlist_compat(int (*a) (unsigned int, const char * const *, void *), void *b)
104{
105	return __bsd_iconvlist(a, b);
106}
107
108int _iconv_version_compat = 0x0108;	/* Magic - not used */
109
110__sym_compat(__iconv, __iconv_compat, FBSD_1.2);
111__sym_compat(__iconv_free_list, __iconv_free_list_compat, FBSD_1.2);
112__sym_compat(__iconv_get_list, __iconv_get_list_compat, FBSD_1.2);
113__sym_compat(_iconv_version, _iconv_version_compat, FBSD_1.3);
114__sym_compat(iconv, iconv_compat, FBSD_1.3);
115__sym_compat(iconv_canonicalize, iconv_canonicalize_compat, FBSD_1.2);
116__sym_compat(iconv_close, iconv_close_compat, FBSD_1.3);
117__sym_compat(iconv_open, iconv_open_compat, FBSD_1.3);
118__sym_compat(iconv_open_into, iconv_open_into_compat, FBSD_1.3);
119__sym_compat(iconv_set_relocation_prefix, iconv_set_relocation_prefix_compat, FBSD_1.3);
120__sym_compat(iconvctl, iconvctl_compat, FBSD_1.3);
121__sym_compat(iconvlist, iconvlist_compat, FBSD_1.3);
122