Commit Graph

159 Commits

Author SHA1 Message Date
christos
adcc2139d9 Coveriry CID 2472: If the number of bits is invalid, return immediately
instead of accessing uninitialized variables.
2006-03-19 01:17:30 +00:00
christos
f174420e75 Coverity CID 2473: Fix uninitialized variable reference. 2006-03-19 01:15:06 +00:00
tnozaki
1b24b76f6b MB_CUR_MAX should be 2 when MODE_2BYTE flag set. 2006-02-15 19:50:27 +00:00
dogcow
86811edb37 change #include <sys/endian.h> => #include <machine/endian.h> so that
it's (more) consistent in the tree; this, along with changing tools/compat's
autoconf detection from AC_CHECK_FUNCS to AC_CHECK_DECLS makes the vast
majority of htobe16 and friends' redefinition errors bite the dust.
Tested with -current and FreeBSD.
2006-02-09 22:03:15 +00:00
tshiozak
bb345c8a27 add missing _citrus_MSKanji_stdenc_get_state_desc_generic() function.
pointed out by Patrick Welche <prlw1 _at_ newn _dot_ cam _dot_ ac _dot_ uk>
2005-12-07 06:20:20 +00:00
yamt
307c0260b8 remove unnecessary __UNCONST. 2005-12-02 11:14:20 +00:00
christos
03256c6e55 WARNS=4 2005-11-29 03:11:58 +00:00
martin
c66ae167ce Initialize error return value. 2005-10-29 19:19:38 +00:00
tshiozak
1beef8fe93 fix lib/31874.
- add _citrus_stdenc_get_state_desc() interface to get
  encoding-scheme-independent encoder/decoder state descriptions.
- make sure that iconv_std module uses it to judge whether the last
  sequences forms complete shift sequences.
- bump minor of i18n_module because of get_state_desc().
2005-10-29 18:02:04 +00:00
tshiozak
c8a7d58fe9 make sure that this module can handle all private/vendor-defined
character area.
This is reported by MORIYAMA Masayuki <msyk _at_ mtg.biglobe.ne.jp> and
"NARUSE, Yui" <naruse _at_ airemix.com>, and fixed by MORIYAMA-san.
2005-10-18 06:44:28 +00:00
tshiozak
eda4f3c630 fix a problem on wc->mb conversion for G2 plane.
This is reported by MORIYAMA Masayuki <msyk _at_ mtg.biglobe.ne.jp> and
"NARUSE, Yui" <naruse _at_ airemix.com>, and fixed by MORIYAMA-san.
2005-10-18 06:42:12 +00:00
tshiozak
a023aa0fb7 * add some comments.
* add some functions:
   _citrus_memory_stream_bind_ptr()
   _citrus_memory_stream_tell()
   _citrus_memory_stream_ungetc()
   _citrus_region_get_subregion()
* fix a bug in _citrus_memory_stream_seek().
2005-05-14 17:55:42 +00:00
tnozaki
a3b248100e add csmapper:CNS11643-1,2 and esdb:ISO-2022-CN,
integrate esdb:EUC-TW, locale:zh_TW.eucTW.
2005-03-27 22:30:05 +00:00
christos
bc0c808b3b Don't sign extend characters when they get converted to wide characters in
mbtowc. Otherwise you are not going to be able to wctomb them. Added
regression test. From kim, many thanks.
2005-03-27 18:51:19 +00:00
tnozaki
6e2609d649 anonymous union between chlen and _UTF7StatePrive has
compilation problem with gcc295.
this union attempt to make mbsinit(3) handle multibyte state correctly,
but it's useless as far as we use utf-7 only iconv interface.
so i eliminate ctype feature.

patch contributed by Joerg Sonnenberg(who porting Citrus to DragonFlyBSD).
and yamt-san gave me advice, thanks a lot.
2005-03-14 03:43:10 +00:00
christos
068081ef36 Fix another _DIAGASSERT issue (Joerg Sonnenberger) 2005-03-12 04:20:30 +00:00
christos
61e7a23268 UTF8EncodingInfo is an empty struct; remove noop code and DIAGASSERT.
From Joerg Sonnenberger
2005-03-11 23:32:03 +00:00
tnozaki
fe05f588fb add new citrus iconv module UTF-7.
thanks advice, yamt-san.
2005-03-05 18:05:14 +00:00
tnozaki
97264db5f1 correct uninitialized value `err'. 2005-03-05 17:31:03 +00:00
simonb
3cebd9325e White space nit- don't put a space before/after increment/decrement
operators.
2005-02-11 06:21:21 +00:00
tnozaki
476f0d92a1 fix typo in _DIAGASSERT 2005-02-10 19:03:51 +00:00
mycroft
ffcb3c5a45 Use FD_CLOEXEC. 2005-01-19 00:52:37 +00:00
christos
3fd676b16c cast to size_t 2004-12-30 05:01:50 +00:00
christos
1f3a2bf23d sz should be size_t 2004-12-30 05:01:19 +00:00
christos
70c807f499 - cast to size_t
- sz should be size_t
2004-12-30 05:00:42 +00:00
yamt
5b3d234201 constify. 2004-12-21 11:25:43 +00:00
yamt
acdc3d1e0f constify. 2004-12-21 09:29:04 +00:00
yamt
824b77d67e _citrus_find_getops: use _C_LABEL_STRING. 2004-12-21 09:00:01 +00:00
yamt
8a0e62d02d open_shared: correct a buffer size. 2004-12-21 08:07:41 +00:00
christos
366176888a PR/27283: Onno van der Linden: incorrect check for mmap return value
While I am here, clean up the error path, KNF and use the proper stat
macro.
2004-10-17 22:21:43 +00:00
yamt
d94faebdc7 wctomb isn't supposed to set errno. 2004-09-26 00:51:39 +00:00
soda
89d5b6ffb2 forgot to replace #else with #endif, thanks yamt again. 2004-09-26 00:35:51 +00:00
yamt
8eaa138d56 _FUNCNAME(ctype_wcrtomb):
set *nresult on error rather than using stack garbage.
2004-09-26 00:17:15 +00:00
soda
63504487d1 oops, forgot to add "else" 2004-09-25 23:56:44 +00:00
soda
879ba02666 corrent an error in previous commit:
don't corrupt return value on error case, pointed out by yamt
2004-09-25 23:51:31 +00:00
soda
bb8f03e106 correct the return values of wcrtomb(3) and wctomb(3).
These return values should include the length of shift sequence
to restore the initial shift state.
2004-09-25 22:53:46 +00:00
tshiozak
09e09c2c2c make sure CITRUS=no to work. 2004-07-21 20:27:46 +00:00
tshiozak
23affd3c41 make sure that _citrus_lookup family functions can be specified their case
sensitivity.
2004-07-21 14:16:34 +00:00
yamt
c5bbd9dca0 _citrus_NONE_stdenc_wctomb: return E2BIG correctly. 2004-01-18 03:57:30 +00:00
christos
7d6187a689 PR/24023: Min Sik Kim: Don't deadlock while closing mappers. The module
uninit function can call close again, which will try to obtain a held
lock. Unlock the lock before calling the actual close function, since
we already disassociated cm from the rest of the data structures.
2004-01-08 19:23:19 +00:00
itojun
35f883b08a KNF 2004-01-02 21:49:35 +00:00
itojun
855852a04b comment on values from 0x80000000 to 0xffffffff 2004-01-02 12:27:41 +00:00
itojun
5d489a8a2a safer realloc 2004-01-02 12:25:46 +00:00
itojun
64d2443254 safer realloc, some KNF. noted by deraadt@openbsd 2004-01-02 12:19:25 +00:00
yamt
9a4bbff85d _citrus_iconv_std_iconv_convert:
- allow 0 byte input.  PR/23889 (Valeriy E. Ushakov)
- remove redundant E2BIG check, which should be done by
  each encoding modules anyway.
2003-12-29 18:05:01 +00:00
yamt
95a5e260a9 _citrus_MSKanji_wcrtomb_priv: return E2BIG correctly. 2003-12-29 17:59:03 +00:00
yamt
556685e5a3 _citrus_NONE_stdenc_cstomb: return E2BIG correctly. 2003-12-29 17:49:22 +00:00
jmc
782579c57a SUSE3 says htonl and friends come in via arpa/inet.h. This will actually not
hurt on NetBSD and makes hosting on non-native for tools/ work correctly
2003-10-28 04:00:51 +00:00
lukem
171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
yamt
faf00d99a2 don't use uninitialized variable ('chlenbak').
the problem reported by Markus Illenseer on tech-userlevel@
and analyzed by enami tsugutomo.
2003-10-14 12:50:03 +00:00
tshiozak
cf33db0f3a fix the problem about resetting the state of iconv().
iconv() was not conforming to the SUSv3 at this point.
reported by Bruno Haible.
2003-09-01 06:16:13 +00:00
agc
eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
thorpej
31ede4a9e3 Pull in host-tool config.h, if necessary. 2003-07-21 07:10:28 +00:00
tshiozak
5e3e3850e3 correct boundary check in _citrus_db_lookup_string_by_string(). 2003-07-16 08:13:51 +00:00
itojun
2ec4a5905e use bounded string op 2003-07-16 08:05:27 +00:00
tshiozak
0e0aa0868c use NONIDENTICAL instead of ILSEQ if the reverse conversion of ISO646.
(fix for lib/22135)
2003-07-14 11:37:49 +00:00
tshiozak
c1e771ab90 separate "nonidentical conversion" and "ilseq" under csmapper.
"nonidentical" means "the input character index is valid, but not
corresponding to the output codeset."
"ilseq" means "the input character index is invalid for the input codeset."
2003-07-12 15:39:19 +00:00
tshiozak
888aa165a5 add forgotten _CITRUS_HASH_REMOVE() at release_shared().
This hopefully fixes the PR pkg/22113.
2003-07-10 09:08:57 +00:00
tshiozak
8adfd9b778 make _DIAGNOSTIC happy. 2003-07-10 08:50:43 +00:00
tshiozak
918c07021f separate "close" process into two parts (with and without handling hash).
This change makes the code symmetrical and ensures the lock not to be
aquired recursively.
The problem that the lock is tried to be aquired recursively was
pointed out by Matthias Drochner.
2003-07-02 17:48:57 +00:00
tshiozak
58db2e99e2 add iconv_t cache.
- separate shared part and context part from iconv_t.
  - add cache of shared part.
and, bump shlib_version minor of i18n modules because iconv i/f is changed.
2003-07-01 09:42:15 +00:00
tshiozak
290f7cdee9 cosmetic change. 2003-07-01 08:34:03 +00:00
tshiozak
b50ac1a74f fix lib/22023 - there were references to uninitialized variables. 2003-07-01 08:33:06 +00:00
christos
6363afb646 use __attribute__((__packed__)) instead of __packed. 2003-06-30 17:54:13 +00:00
tshiozak
a8076e0474 add #include "config.h" when these files are built as parts of host tools. 2003-06-30 12:32:21 +00:00
tshiozak
cba952da4e u_int*_t -> uint*_t.
I would like to use stdint.h, but it is too modern for the host tools.
u_int*_t are more popular under UNIX-like systems, although they are
not backed up with any standards.
(src/tools/compat/stdint.h is maybe necessary.)
2003-06-29 17:30:07 +00:00
tshiozak
82d5554eda sync with the last change for citrus_hash.h. 2003-06-27 17:53:31 +00:00
tshiozak
2aa99730ce make sure to use LIST_* macros defined in sys/queue.h.
pointed out by yamt@netbsd.
2003-06-27 17:43:15 +00:00
yamt
d71154b0e4 in _citrus_ctype_btowc_fallback() and _citrus_ctype_wctob_fallback(),
use enough size byte arrays, instead of abusing mbstate_t.
just pedantic.  no functional change is involved.
2003-06-27 14:52:25 +00:00
yamt
8822a3e83e $NetBSD $ -> $NetBSD$ 2003-06-27 12:55:13 +00:00
itojun
c7ca01fc7d i guess the original intent was this... 2003-06-27 08:58:18 +00:00
itojun
877654378b memset() after null check 2003-06-27 08:56:07 +00:00
itojun
29aff1f984 clear memory after malloc() 2003-06-27 08:50:47 +00:00
tshiozak
f3995f1ad3 correct wcrtomb(3) - it is not conforming to standard on handling L'\0'.
This change also affects Citrus iconv engine.
2003-06-26 12:09:56 +00:00
tshiozak
f77c39f209 make sure that key is case-insensitive. 2003-06-26 12:05:04 +00:00
tshiozak
04e58308a3 Citrus iconv support (1)
add core engine of Citrus iconv and some support routines.
  - iconv core (citrus_iconv)
  - coded character set mapper (csmapper)
  - encoding scheme database (esdb)
  - standard encoding scheme handler (stdenc)
  - basic character set manipulation utilities (bcs)
  - mmap based infrastructure (citrus_lookup/_mmap/_memstream/_db)
  - some source codes of new plugins (not built yet)
2003-06-25 09:51:26 +00:00
petrov
cc36666171 No need in default label if default case is not processed. 2003-05-08 20:42:39 +00:00
tshiozak
c2cadb8a46 add support for zh_CN.GB18030 locale.
(lib/20835 by sigsegv at s25 dot xrea dot com)
XXX: charclass for GBK compatible area is not supported.
2003-03-25 18:26:51 +00:00
tshiozak
d0db871d32 fix the problem if EILSEQ is caused in mbrtowc(3) under *.UTF-8 locales.
(lib/20873 by khym at azeotrope dot org)
2003-03-25 17:35:36 +00:00
tshiozak
326ed36874 changes related to lib/20576 and lib/20577.
- add wcstok() and wcswcs(),
  - add wcstok(3),
  - move btowc() and wctob() into each ctype modules,
  - bump ctype interface ABI version,
  - bump i18n modules' minor and
  - update sets.
and fix a stupid bug in _RUNE_ISCACHED macro.
2003-03-05 20:18:14 +00:00
yamt
a7e4d902d4 - handle s==NULL case of wcrtomb.
- add a comment about it.

fix rest of PR 18269 by wurlitzer.
2003-01-01 15:57:12 +00:00
yamt
6a7521b053 - add missing _CEI_TO_EI/_TO_CEI.
- don't use 'cl' before assert it's non NULL.
2003-01-01 15:25:54 +00:00
yamt
13820b1f52 - add missing _CEI_TO_EI/_TO_CEI.
- add missing _STATE_NEEDS_EXPLICIT_INIT checks.
- more comment.
2003-01-01 15:04:01 +00:00
yamt
26baecb89a in _RESTART_BEGIN macro, don't use external variable directly. 2003-01-01 14:45:13 +00:00
yamt
1e35b17a10 when s==0, wctomb should initialize its internal state and return if
encodings have state dependency or not.

a patch provided with PR 18269 by wurlitzer.
modified by me.

fix part of PR 18269.
2003-01-01 14:34:27 +00:00
yamt
dec2654840 mbsrtowcs_priv template:
n == 0 is not an error. it's a valid input.
_citrus_NONE_ctype_mbsrtowcs:
	fix a typo that causes SEGV.

while i'm here, make them similar each other.

fix PR 19620.
2003-01-01 13:29:45 +00:00
uebayasi
1e0907fb9a Typos in comments. 2002-12-26 07:58:19 +00:00
lukem
91d06a031b More use of ${NETBSDSRCDIR}/some/path instead of ${.CURDIR}/../../some/path 2002-08-19 13:35:05 +00:00
thorpej
967ae659f1 Add some casts to quiet a "discards qualifier from pointer target type"
warning from gcc 3.2 (experimental) (which is complaining about the loss
of __restrict).

Reviewed and approved by tshiozak@astec.co.jp.
2002-05-24 04:04:30 +00:00
yamt
ab015054f8 - fix a.out case. (pointed by an anonymous person)
- use __ELF__ to determine if we're using elf.
2002-04-20 05:55:47 +00:00
yamt
27563a14f1 - move _TO_CEI to template from each module/*.c.
- nuke _TO_EI and _TO_STATE.
- convert _TO_EI(cl) to _CEI_TO_EI(_TO_CEI(cl)).
- wrap long lines.
2002-03-28 10:53:48 +00:00
yamt
0f59b7f0ae fix comments.
(_TO_INTERNAL_STATE -> _CEI_TO_STATE)
2002-03-28 10:38:52 +00:00
yamt
3daba72ae9 introduce new macro _STATE_NEEDS_EXPLICIT_INIT.
and use it for encodings that needs explicit
init_state in addition to zero-fill.
2002-03-28 10:29:11 +00:00
yamt
6854a8c8c8 drop __packed__ attribute from _ISO2022State. 2002-03-28 01:59:50 +00:00
yamt
7b15929c54 fix wcstombs: convertion should always begin with
an initial shift state. and nuke s_wcstombs.
2002-03-27 17:54:40 +00:00
yamt
097394b63d fix state backup.
XXX this should be move into wcrtomb_priv.
2002-03-27 17:18:41 +00:00
yamt
f0ab6c6443 - change _ENCODING_MB_CUR_MAX to take a pointer to encoding info.
- don't use MB_CUR_MAX here since it's depend on current locale.
  use _ENCODING_MB_CUR_MAX instead.
2002-03-27 15:01:16 +00:00
yamt
9e8142572a fix wcsrtombs to restart correctly. 2002-03-26 07:53:38 +00:00
yamt
c89607bec7 wcsrtombs: handle dst == 0 case correctly. 2002-03-25 20:47:02 +00:00
yamt
e274c8a885 - handle the case that buffer size == 0 for wcsrtombs.
- add a XXX comment.
2002-03-25 20:29:30 +00:00