Coverage Report

Created: 2026-05-16 06:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/dcmtk/oficonv/libsrc/citrus_module.c
Line
Count
Source
1
/*-
2
 * Copyright (c)1999, 2000, 2001, 2002 Citrus Project,
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
27
/*-
28
 * Copyright (c) 1998 The NetBSD Foundation, Inc.
29
 * All rights reserved.
30
 *
31
 * This code is derived from software contributed to The NetBSD Foundation
32
 * by Paul Kranenburg.
33
 *
34
 * Redistribution and use in source and binary forms, with or without
35
 * modification, are permitted provided that the following conditions
36
 * are met:
37
 * 1. Redistributions of source code must retain the above copyright
38
 *    notice, this list of conditions and the following disclaimer.
39
 * 2. Redistributions in binary form must reproduce the above copyright
40
 *    notice, this list of conditions and the following disclaimer in the
41
 *    documentation and/or other materials provided with the distribution.
42
 *
43
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
44
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
45
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
46
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
47
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
49
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
50
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
51
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
53
 * POSSIBILITY OF SUCH DAMAGE.
54
 */
55
56
/*-
57
 * Copyright (c) 1993
58
 *  The Regents of the University of California.  All rights reserved.
59
 *
60
 * This code is derived from software contributed to Berkeley by
61
 * Paul Borman at Krystal Technologies.
62
 *
63
 * Redistribution and use in source and binary forms, with or without
64
 * modification, are permitted provided that the following conditions
65
 * are met:
66
 * 1. Redistributions of source code must retain the above copyright
67
 *    notice, this list of conditions and the following disclaimer.
68
 * 2. Redistributions in binary form must reproduce the above copyright
69
 *    notice, this list of conditions and the following disclaimer in the
70
 *    documentation and/or other materials provided with the distribution.
71
 * 3. Neither the name of the University nor the names of its contributors
72
 *    may be used to endorse or promote products derived from this software
73
 *    without specific prior written permission.
74
 *
75
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
76
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
77
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
78
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
79
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
80
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
81
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
82
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
83
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
84
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
85
 * SUCH DAMAGE.
86
 */
87
88
#include "dcmtk/config/osconfig.h"
89
#include "citrus_module.h"
90
91
#include <sys/types.h>
92
#ifdef HAVE_DIRENT_H
93
#include <dirent.h>
94
#endif
95
#include <errno.h>
96
#include <limits.h>
97
#include <stdbool.h>
98
#include <stddef.h>
99
#include <stdio.h>
100
#include <stdlib.h>
101
#include <string.h>
102
#ifdef HAVE_UNISTD_H
103
#include <unistd.h>
104
#endif
105
106
#define I18NMODULE_MAJOR    5
107
108
#include "citrus_bcs.h"
109
110
#include "citrus_iconv_local.h"
111
#include "citrus_iconv_std.h"
112
#include "citrus_iconv_none.h"
113
114
#include "citrus_stdenc_local.h"
115
#include "citrus_big5.h"
116
#include "citrus_dechanyu.h"
117
#include "citrus_euc.h"
118
#include "citrus_euctw.h"
119
#include "citrus_gbk2k.h"
120
#include "citrus_hz.h"
121
#include "citrus_iso2022.h"
122
#include "citrus_johab.h"
123
#include "citrus_mskanji.h"
124
#include "citrus_ues.h"
125
#include "citrus_utf1632.h"
126
#include "citrus_utf7.h"
127
#include "citrus_utf8.h"
128
#include "citrus_viqr.h"
129
#include "citrus_zw.h"
130
#include "citrus_jisx0208.h"
131
132
#include "citrus_mapper_local.h"
133
#include "citrus_mapper_none.h"
134
#include "citrus_mapper_646.h"
135
#include "citrus_mapper_serial.h"
136
#include "citrus_mapper_zone.h"
137
#include "citrus_mapper_std.h"
138
139
#ifdef _MSC_VER
140
/* disable warning about typecasts from void * to function pointer
141
 * and vice versa in older MSVC versions (VS 2015 and older) */
142
#pragma warning(disable: 4054)
143
#pragma warning(disable: 4055)
144
#endif
145
146
void *
147
_citrus_find_getops(_citrus_module_t handle, const char *modname,
148
    const char *ifname)
149
0
{
150
0
    (void) modname;
151
0
    (void) ifname;
152
0
    return (void *) handle;
153
0
}
154
155
int
156
_citrus_load_module(_citrus_module_t *rhandle, const char *encname)
157
0
{
158
0
    if (strcmp(encname, "iconv_std") == 0) *rhandle = (_citrus_module_t) &_citrus_iconv_std_iconv_getops;
159
0
    else if (strcmp(encname, "iconv_none") == 0) *rhandle = (_citrus_module_t) &_citrus_iconv_none_iconv_getops;
160
0
    else if (strcmp(encname, "UTF8") == 0) *rhandle = (_citrus_module_t) &_citrus_UTF8_stdenc_getops;
161
0
    else if (strcmp(encname, "BIG5") == 0) *rhandle = (_citrus_module_t) &_citrus_BIG5_stdenc_getops;
162
0
    else if (strcmp(encname, "DECHanyu") == 0) *rhandle = (_citrus_module_t) &_citrus_DECHanyu_stdenc_getops;
163
0
    else if (strcmp(encname, "EUC") == 0) *rhandle = (_citrus_module_t) &_citrus_EUC_stdenc_getops;
164
0
    else if (strcmp(encname, "EUCTW") == 0) *rhandle = (_citrus_module_t) &_citrus_EUCTW_stdenc_getops;
165
0
    else if (strcmp(encname, "GBK2K") == 0) *rhandle = (_citrus_module_t) &_citrus_GBK2K_stdenc_getops;
166
0
    else if (strcmp(encname, "HZ") == 0) *rhandle = (_citrus_module_t) &_citrus_HZ_stdenc_getops;
167
0
    else if (strcmp(encname, "ISO2022") == 0) *rhandle = (_citrus_module_t) &_citrus_ISO2022_stdenc_getops;
168
0
    else if (strcmp(encname, "JISX0208") == 0) *rhandle = (_citrus_module_t) &_citrus_JISX0208_stdenc_getops;
169
0
    else if (strcmp(encname, "JOHAB") == 0) *rhandle = (_citrus_module_t) &_citrus_JOHAB_stdenc_getops;
170
0
    else if (strcmp(encname, "MSKanji") == 0) *rhandle = (_citrus_module_t) &_citrus_MSKanji_stdenc_getops;
171
0
    else if (strcmp(encname, "UES") == 0) *rhandle = (_citrus_module_t) &_citrus_UES_stdenc_getops;
172
0
    else if (strcmp(encname, "UTF1632") == 0) *rhandle = (_citrus_module_t) &_citrus_UTF1632_stdenc_getops;
173
0
    else if (strcmp(encname, "UTF7") == 0) *rhandle = (_citrus_module_t) &_citrus_UTF7_stdenc_getops;
174
0
    else if (strcmp(encname, "VIQR") == 0) *rhandle = (_citrus_module_t) &_citrus_VIQR_stdenc_getops;
175
0
    else if (strcmp(encname, "ZW") == 0) *rhandle = (_citrus_module_t) &_citrus_ZW_stdenc_getops;
176
0
    else if (strcmp(encname, "mapper_none") == 0) *rhandle = (_citrus_module_t) &_citrus_mapper_none_mapper_getops;
177
0
    else if (strcmp(encname, "mapper_std") == 0) *rhandle = (_citrus_module_t) &_citrus_mapper_std_mapper_getops;
178
0
    else if (strcmp(encname, "mapper_serial") == 0) *rhandle = (_citrus_module_t) &_citrus_mapper_serial_mapper_getops;
179
0
    else if (strcmp(encname, "mapper_zone") == 0) *rhandle = (_citrus_module_t) &_citrus_mapper_zone_mapper_getops;
180
0
    else if (strcmp(encname, "mapper_646") == 0) *rhandle = (_citrus_module_t) &_citrus_mapper_646_mapper_getops;
181
0
    else if (strcmp(encname, "mapper_parallel") == 0) *rhandle = (_citrus_module_t) &_citrus_mapper_parallel_mapper_getops;
182
0
    else
183
0
    {
184
0
        return (EINVAL);
185
0
    }
186
0
    return (0);
187
0
}
188
189
void
190
_citrus_unload_module(_citrus_module_t handle)
191
0
{
192
0
    (void) handle;
193
0
}