Deleted Added
full compact
iconv.c (104568) iconv.c (109623)
1/*
2 * Copyright (c) 2000-2001, Boris Popov
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

--- 15 unchanged lines hidden (view full) ---

24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
1/*
2 * Copyright (c) 2000-2001, Boris Popov
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

--- 15 unchanged lines hidden (view full) ---

24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $FreeBSD: head/sys/libkern/iconv.c 104568 2002-10-06 12:20:09Z mux $
32 * $FreeBSD: head/sys/libkern/iconv.c 109623 2003-01-21 08:56:16Z alfred $
33 */
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/iconv.h>
38#include <sys/malloc.h>
39
40#include "iconv_converter_if.h"

--- 140 unchanged lines hidden (view full) ---

181 return EEXIST;
182 csize = sizeof(*csp);
183 ucsto = strcmp(to, iconv_unicode_string) == 0;
184 if (!ucsto)
185 csize += strlen(to) + 1;
186 ucsfrom = strcmp(from, iconv_unicode_string) == 0;
187 if (!ucsfrom)
188 csize += strlen(from) + 1;
33 */
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/iconv.h>
38#include <sys/malloc.h>
39
40#include "iconv_converter_if.h"

--- 140 unchanged lines hidden (view full) ---

181 return EEXIST;
182 csize = sizeof(*csp);
183 ucsto = strcmp(to, iconv_unicode_string) == 0;
184 if (!ucsto)
185 csize += strlen(to) + 1;
186 ucsfrom = strcmp(from, iconv_unicode_string) == 0;
187 if (!ucsfrom)
188 csize += strlen(from) + 1;
189 csp = malloc(csize, M_ICONV, M_WAITOK);
189 csp = malloc(csize, M_ICONV, 0);
190 bzero(csp, csize);
191 csp->cp_id = iconv_csid++;
192 csp->cp_dcp = dcp;
193 cp = (char*)(csp + 1);
194 if (!ucsto) {
195 strcpy(cp, to);
196 csp->cp_to = cp;
197 cp += strlen(cp) + 1;

--- 157 unchanged lines hidden (view full) ---

355 if (din.ia_datalen > ICONV_CSMAXDATALEN)
356 return EINVAL;
357 if (iconv_lookupconv(din.ia_converter, &dcp) != 0)
358 return EINVAL;
359 error = iconv_register_cspair(din.ia_to, din.ia_from, dcp, NULL, &csp);
360 if (error)
361 return error;
362 if (din.ia_datalen) {
190 bzero(csp, csize);
191 csp->cp_id = iconv_csid++;
192 csp->cp_dcp = dcp;
193 cp = (char*)(csp + 1);
194 if (!ucsto) {
195 strcpy(cp, to);
196 csp->cp_to = cp;
197 cp += strlen(cp) + 1;

--- 157 unchanged lines hidden (view full) ---

355 if (din.ia_datalen > ICONV_CSMAXDATALEN)
356 return EINVAL;
357 if (iconv_lookupconv(din.ia_converter, &dcp) != 0)
358 return EINVAL;
359 error = iconv_register_cspair(din.ia_to, din.ia_from, dcp, NULL, &csp);
360 if (error)
361 return error;
362 if (din.ia_datalen) {
363 csp->cp_data = malloc(din.ia_datalen, M_ICONVDATA, M_WAITOK);
363 csp->cp_data = malloc(din.ia_datalen, M_ICONVDATA, 0);
364 error = copyin(din.ia_data, csp->cp_data, din.ia_datalen);
365 if (error)
366 goto bad;
367 }
368 dout.ia_csid = csp->cp_id;
369 error = SYSCTL_OUT(req, &dout, sizeof(dout));
370 if (error)
371 goto bad;

--- 112 unchanged lines hidden ---
364 error = copyin(din.ia_data, csp->cp_data, din.ia_datalen);
365 if (error)
366 goto bad;
367 }
368 dout.ia_csid = csp->cp_id;
369 error = SYSCTL_OUT(req, &dout, sizeof(dout));
370 if (error)
371 goto bad;

--- 112 unchanged lines hidden ---