svn commit: samba r2857 - in branches/SAMBA_4_0/source: auth include lib lib/cmdline lib/registry/reg_backend_nt4 libads libcli/auth libcli/raw libcli/util librpc/ndr smb_server smbd torture torture/basic torture/local torture/rpc

tridge at samba.org tridge at samba.org
Fri Oct 8 08:13:01 GMT 2004


Author: tridge
Date: 2004-10-08 08:13:00 +0000 (Fri, 08 Oct 2004)
New Revision: 2857

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=2857&nolog=1

Log:
this commit gets rid of smb_ucs2_t, wpstring and fpstring, plus lots of associated functions.

The motivation for this change was to avoid having to convert to/from
ucs2 strings for so many operations. Doing that was slow, used many
static buffers, and was also incorrect as it didn't cope properly with
unicode codepoints above 65536 (which could not be represented
correctly as smb_ucs2_t chars)

The two core functions that allowed this change are next_codepoint()
and push_codepoint(). These functions allow you to correctly walk a
arbitrary multi-byte string a character at a time without converting
the whole string to ucs2.

While doing this cleanup I also fixed several ucs2 string handling
bugs. See the commit for details.

The following code (which counts the number of occuraces of 'c' in a
string) shows how to use the new interface:

size_t count_chars(const char *s, char c)
{
	size_t count = 0;

	while (*s) {
		size_t size;
		codepoint_t c2 = next_codepoint(s, &size);
		if (c2 == c) count++;
		s += size;
	}

	return count;
}


Added:
   branches/SAMBA_4_0/source/lib/util_strlist.c
Modified:
   branches/SAMBA_4_0/source/auth/pass_check.c
   branches/SAMBA_4_0/source/include/charset.h
   branches/SAMBA_4_0/source/include/rewrite.h
   branches/SAMBA_4_0/source/include/safe_string.h
   branches/SAMBA_4_0/source/lib/basic.mk
   branches/SAMBA_4_0/source/lib/charcnv.c
   branches/SAMBA_4_0/source/lib/cmdline/popt_common.c
   branches/SAMBA_4_0/source/lib/iconv.c
   branches/SAMBA_4_0/source/lib/ms_fnmatch.c
   branches/SAMBA_4_0/source/lib/registry/reg_backend_nt4/reg_backend_nt4.c
   branches/SAMBA_4_0/source/lib/util_str.c
   branches/SAMBA_4_0/source/lib/util_unistr.c
   branches/SAMBA_4_0/source/libads/ldap_printer.c
   branches/SAMBA_4_0/source/libcli/auth/ntlmssp_parse.c
   branches/SAMBA_4_0/source/libcli/raw/rawrequest.c
   branches/SAMBA_4_0/source/libcli/util/smbencrypt.c
   branches/SAMBA_4_0/source/librpc/ndr/ndr_basic.c
   branches/SAMBA_4_0/source/smb_server/request.c
   branches/SAMBA_4_0/source/smbd/server.c
   branches/SAMBA_4_0/source/torture/basic/utable.c
   branches/SAMBA_4_0/source/torture/local/iconv.c
   branches/SAMBA_4_0/source/torture/masktest.c
   branches/SAMBA_4_0/source/torture/rpc/netlogon.c


Changeset:
Sorry, the patch is too large (2729 lines) to include; please use WebSVN to see it!
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=2857&nolog=1


More information about the samba-cvs mailing list