summaryrefslogtreecommitdiff
path: root/lib/util/charset
AgeCommit message (Collapse)AuthorFilesLines
2011-04-13lib/util/charset Add more tests for convert_string_error_handle()Andrew Bartlett1-0/+101
This helps define the semantics of this function very clearly, particularly for partial and invalid inputs. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13lib/util/charset Preserve 'pull' errors even when converting via UTF16Andrew Bartlett1-3/+8
When we do not have a direct iconv handle between any two charsets, we must go iva UTF16. However, we should still return the same buffer and error code as if we were able to go direct - including the partial conversion and the error code. This is important for locating the invalid multibyte character in the stream, for example. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13lib/util/charset Add tests for convert_string_error_handleAndrew Bartlett1-1/+68
These confirm that the errno is set correctly and that we stop on a partial multibyte character Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13lib/util/charset Add expected values for upper/lower case testsAndrew Bartlett1-0/+16
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13lib/util/charset Fix and add public interface for convert_string_error_handleAndrew Bartlett2-7/+14
It makes much more sense for this to match the source3/ interface and return a bool. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-04-13lib/util/charset Move source3/lib/util_unistr.c to the common code.Andrew Bartlett3-1/+345
This file (largely) contains functions to deal with UTF16 strings. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-03-31lib/util/charset Add tests for strcasecmp_m(), talloc_strupper() et alAndrew Bartlett4-15/+241
This adds tests for: strncasecmp_m strcasecmp_m strupper_talloc_n strlower_talloc strhaslower strhasupper The tests can certainly be improved with pre-calculated upper and lower case text, but this at least puts them though their paces. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Thu Mar 31 14:24:22 CEST 2011 on sn-devel-104
2011-03-31charconv: Use talloc_tos() in the S3 buildVolker Lendecke1-1/+9
In S3 we put a talloc_pool on top of the stack so that an allocation from talloc_tos() normally is just a pointer increment. Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Thu Mar 31 09:14:01 CEST 2011 on sn-devel-104
2011-03-31Arg. I hate the "if (xxx) return foo" all on one line style of code.Jeremy Allison1-2/+8
Fix the talloc leaks I introduced by not spotting these returns. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Mar 31 05:19:34 CEST 2011 on sn-devel-104
2011-03-31Don't burn 2k of stack on every iconv, use the heap when it's a slow call.Jeremy Allison1-16/+25
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Mar 31 04:09:09 CEST 2011 on sn-devel-104
2011-03-31lib/util/charset smb_panic() on incorrect use of strlen_m_extAndrew Bartlett1-0/+18
This may save a developer some time in the future. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Thu Mar 31 02:40:31 CEST 2011 on sn-devel-104
2011-03-31lib/util/charset Add tests for strlen_m_ext() and convert_string_talloc()Andrew Bartlett1-2/+87
This convers a few more cases for convert_string_talloc() and introduces tests for strlen_m_ext() across complex multibyte strings. Andrew Bartlett
2011-03-31lib/util/charset Add wrapper to allow testing of strlen_m_ext()Andrew Bartlett2-2/+22
This allows test routines to force in particular character sets, and not rely on the smb.conf. Andrew Bartlett
2011-03-31lib/util/charset correct calculation of UTF8 character sizesAndrew Bartlett1-1/+1
Characters between 0x800 0x0FFFF are 3 bytes long. Andrew Bartlett
2011-03-30Fix convert_string() to take a *converted_size arg. and return a bool.Jeremy Allison3-34/+45
Makes these interfaces much harder to misuse and easier to ensure error checking. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Mar 30 23:59:37 CEST 2011 on sn-devel-104
2011-03-30lib/util/charset Add tests for convert_string_talloc_handle()Andrew Bartlett3-0/+431
Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Mar 30 13:02:47 CEST 2011 on sn-devel-104
2011-03-30lib/util/charset Remove pointless static bool initialisedAndrew Bartlett1-5/+0
2011-03-25charcnv: ensure convert_string_error doesn't conflict with s3 functionAndrew Tridgell1-5/+5
use _handle for handle based functions Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Fri Mar 25 05:22:24 CET 2011 on sn-devel-104
2011-03-25lib/util/charset rename iconv_convenience to iconv_handleAndrew Bartlett6-79/+79
This better reflects what this structure is Andrew Bartlett
2011-03-25charcnv: added convert_string_error()Andrew Tridgell1-33/+57
this will allow us to remove conv_silent Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-03-25unistr: moved some UCS2 macros into util_unistrAndrew Tridgell1-9/+0
we need to move towards eliminating smb_ucs2_t. This moves a couple of the related macros into the only file they are used in Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-03-25libcli: created smb_constants.hAndrew Tridgell1-0/+1
this starts the (long!) process of moving some of the SMB constants into common files. This just moves the FLAGS2_ defines, which are needed for common string routines (for FLAGS2_UNICODE_STRINGS)
2011-03-24charcnv: removed the allow_badcharcnv and allow_bad_conv options to ↵Andrew Tridgell4-44/+36
convert_string*() we shouldn't accept bad multi-byte strings, it just hides problems Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Thu Mar 24 01:47:26 CET 2011 on sn-devel-104
2011-03-24charset: remove another allow_badcharcnv check Andrew Tridgell1-3/+0
better to fail only if there is a bad character
2011-03-23lib/util: Merge basic string length and comparison functionsAndrew Bartlett5-343/+427
These functions now use the codepoints for more accurate string handling and now form common code. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Mar 23 08:21:54 CET 2011 on sn-devel-104
2011-03-23charcnv: remove the automatic fail on allow_badcharcnv trueAndrew Tridgell1-5/+0
we should just fail the call if the string really is bad
2011-03-19lib/: Fix prototypes for functions.Jelmer Vernooij1-2/+2
2011-02-23lib/util/charset: ICONV_WRAPPER needs talloc.Günther Deschner1-1/+1
Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Wed Feb 23 12:46:33 CET 2011 on sn-devel-104
2011-02-21Fix missing dependency on libreplace.Jelmer Vernooij1-1/+1
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Mon Feb 21 01:17:33 CET 2011 on sn-devel-104
2011-02-18lib/util/charset Add back setlocale(), but only when called from binariesAndrew Bartlett2-3/+24
When called from a library, we don't want to call this, as we may overwrite some of our calling program's context. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Fri Feb 18 09:29:35 CET 2011 on sn-devel-104
2011-02-18lib/util/charcnv Move iconv handle setup in commonAndrew Bartlett5-320/+366
We now use the struct smb_iconv_convenience at the core of all our iconv code, and use global_iconv_convenience for the callers that don't specify one. Andrew Bartlett
2011-02-18lib/util/charset Use top level iconv.c in source3Andrew Bartlett3-12/+90
The two files were very similar already, the only change required was to adopt the s3 module registration fucntion name. (NTSTATUS wasn't used as the charset code does not otherwise use that type). Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-02-18charset Remove use of {isupper,islower,toupper,tolower}_w functionsAndrew Bartlett1-0/+2
These now call the common _m functions that consider UTF16 code points. This removes the code which will make up a 'lame' table in memory, as this can just as correctly be handled by running the algorithm at runtime (which is to call toupper() and tolower() on characters < 128). When used, a top level waf build will always locate the correct table - in the build tree or outside - due to relinking the installed binary. Andrew Bartlett
2011-02-18charset: allow s3 waf build to use lib/util/charsetAndrew Tridgell1-5/+6
the only conflict is with 'CHARSET' itself, which now builds conditionally on _SAMBA_BUILD_==4 Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-02-18lib/util/charset use get_dyn_CODEPAGEDIR(), which is in commonAndrew Bartlett1-2/+2
This is provided by the s3 and s4 dynconfig implementations. Andrew Bartlett
2011-02-18lib/util/charset split codepoints.c into it's own subsystemAndrew Bartlett1-3/+6
2011-02-18lib/util/charset use a path to dynconfig.h that works in s3 and s4Andrew Bartlett1-1/+1
2011-02-18lib/util/charset add functions isupper_m and islower_mAndrew Bartlett2-0/+19
2011-02-07s4-charset: use dyn_CODEPAGEDIR for location of upcase.dat/lowcase.datAndrew Tridgell1-12/+4
this matches samba3 behaviour Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-02-04charcnv: removed call to setlocale() (bug 7519)Andrew Tridgell1-10/+0
We don't need this setlocale() call, and it can break applications that use our libraries Thanks to Milan Crha for pointing this out Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Fri Feb 4 06:51:01 CET 2011 on sn-devel-104
2010-12-14build: fix bad syntaxMatthieu Patou1-1/+1
Autobuild-User: Matthieu Patou <mat@samba.org> Autobuild-Date: Tue Dec 14 20:55:17 CET 2010 on sn-devel-104
2010-12-11s4-smbtorture: Make test names lowercase and dot-separated.Jelmer Vernooij2-2/+2
This is consistent with the test names used by selftest, should make the names less confusing and easier to integrate with other tools. Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Dec 11 04:16:13 CET 2010 on sn-devel-104
2010-12-10build: finishing fixing broken libiconv on hpuxMatthieu Patou1-0/+2
2010-12-08build: Cope with broken libiconvMatthieu Patou1-1/+5
library iconv needs mbrtowc but some system didn't provide it (ie. HP-UX 11.0) Autobuild-User: Matthieu Patou <mat@samba.org> Autobuild-Date: Wed Dec 8 23:19:19 CET 2010 on sn-devel-104
2010-11-03lib/util/charset/charconv: clarify comments in next_codepoint_convenience_ext()Michael Adam1-5/+8
Give the unicod U+<hexnumber> notation of the codepoints referred to in the comments. Also reformat the comments some.
2010-11-03lib/util/charset/util_unistr: clarify the comment header for strlen_m().Michael Adam1-5/+6
2010-11-03lib/util/charset/util_unistr: add strlen_m_ext_term() - variant of ↵Michael Adam2-0/+12
strlen_m_ext() counting terminator
2010-11-03lib/util/charset/util_unistr: add strlen_m_ext that takes input and output ↵Michael Adam2-10/+51
charset The function calculates the number of units (8 or 16-bit, depending on the destination charset), that would be needed to convert the input string which is expected to be in in src_charset encoding to the dst_charset (which should be a unicode charset).
2010-11-03lib/charcnv/util_unistr: add next_codepoint_ext() that accepts input charset.Michael Adam2-0/+8
next_codepoint() takes as string in CH_UNIX encoding and returns the unicode codepoint of the next (possibly multibyte) character of the input string. The new next_codepoint_ext() function adds the encoding of the input string as a parameter. next_codepoint() now only calls next_codepoint_ext() with CH_UNIX als src_charset argument.
2010-11-03lib/charset/charcnv: rename a parameter of next_codepoint_convenience_ext() ↵Michael Adam1-5/+5
for clarity