[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Dec 25 07:08:02 MST 2011


The branch, master has been updated
       via  1364eb7 lib/charset: Remove an unused variable
       via  b2eaa9a s3: Fix fn signatures in charset_macosx.c
       via  2b75e87 s3: Fix a 64-bit warning
       via  1fbc8c2 s3: Fix linking on Lion
       via  1eefd6b tdb: Use tdb_parse_record in tdb_update_hash
       via  c1e9537 tdb: Use tdb_parse_record in tdb_update_hash
       via  c3a4057 libreplace: Don't check for standards.h on darwin (Lion)
      from  eb61737 Fix bug #8679 - recvfile code path using splice() on Linux leaves data in the pipe on short write

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1364eb7bd7e7e6035b8a8cf4da46481f3d1460f0
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 25 11:49:04 2011 +0100

    lib/charset: Remove an unused variable
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Sun Dec 25 15:07:56 CET 2011 on sn-devel-104

commit b2eaa9afd367fd6652a6bbc28b0746be168162ef
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 25 11:43:43 2011 +0100

    s3: Fix fn signatures in charset_macosx.c

commit 2b75e877fb85f212f5250acb026505a7c7b1fc0c
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 25 11:35:07 2011 +0100

    s3: Fix a 64-bit warning

commit 1fbc8c2186642564a19205b2d07b3d7190cfdadd
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Dec 25 11:00:11 2011 +0100

    s3: Fix linking on Lion
    
    We are using CoreFoundation functions in charset_macosx.c. We need to link
    against that.

commit 1eefd6bafba689e807e208149ee39b0f773c1ff8
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 19 13:39:04 2011 +0100

    tdb: Use tdb_parse_record in tdb_update_hash
    
    This avoids a tdb_fetch, thus a malloc/memcpy/free in the tdb_store path

commit c1e9537ed0f58404fed96a7aa9e581b8ebb1fb60
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Dec 19 13:39:04 2011 +0100

    tdb: Use tdb_parse_record in tdb_update_hash
    
    This avoids a tdb_fetch, thus a malloc/memcpy/free in the tdb_store path

commit c3a4057a21c87cabbc03692b170e9e78badd9e5c
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Dec 23 21:37:57 2011 +0100

    libreplace: Don't check for standards.h on darwin (Lion)
    
    standards.h on Lion holds a #warning that standards.h will be removed. This is
    annoying during the build.

-----------------------------------------------------------------------

Summary of changes:
 lib/replace/libreplace_cc.m4        |   12 ++++++++++--
 lib/tdb/common/tdb.c                |   28 ++++++++++++++++------------
 lib/tdb2/tdb1_tdb.c                 |   26 +++++++++++++++-----------
 lib/util/charset/charset_macosxfs.c |    8 ++++----
 lib/util/charset/charset_proto.h    |    4 ++--
 lib/util/charset/convert_string.c   |    2 ++
 source3/configure.in                |    8 ++++++++
 source3/locking/locking.c           |    2 +-
 8 files changed, 58 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/replace/libreplace_cc.m4 b/lib/replace/libreplace_cc.m4
index 48d9e84..7ddc19f 100644
--- a/lib/replace/libreplace_cc.m4
+++ b/lib/replace/libreplace_cc.m4
@@ -102,9 +102,17 @@ case "$host_os" in
 		;;
 esac
 
+# Do not check for standards.h on darwin, we get nasty warnings on
+# OS/X Lion. Probably a positive-list of OS'es like IRIX and AIX
+# would be the better choice, but this seems to work fine
 
-
-AC_CHECK_HEADERS([standards.h])
+case "$host_os" in
+     *darwin*)
+	;;
+     *)
+        AC_CHECK_HEADERS([standards.h])
+	;;
+esac
 
 # Solaris needs HAVE_LONG_LONG defined
 AC_CHECK_TYPES(long long)
diff --git a/lib/tdb/common/tdb.c b/lib/tdb/common/tdb.c
index ac2a482..c0f934a 100644
--- a/lib/tdb/common/tdb.c
+++ b/lib/tdb/common/tdb.c
@@ -124,6 +124,19 @@ tdb_off_t tdb_find_lock_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t has
 
 static TDB_DATA _tdb_fetch(struct tdb_context *tdb, TDB_DATA key);
 
+static int tdb_update_hash_cmp(TDB_DATA key, TDB_DATA data, void *private_data)
+{
+	TDB_DATA *dbuf = (TDB_DATA *)private_data;
+
+	if (dbuf->dsize != data.dsize) {
+		return -1;
+	}
+	if (memcmp(dbuf->dptr, data.dptr, data.dsize) != 0) {
+		return -1;
+	}
+	return 0;
+}
+
 /* update an entry in place - this only works if the new data size
    is <= the old data size and the key exists.
    on failure return -1.
@@ -141,18 +154,9 @@ static int tdb_update_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash,
 	 * surprisingly common (eg. with a ldb re-index). */
 	if (rec.key_len == key.dsize && 
 	    rec.data_len == dbuf.dsize &&
-	    rec.full_hash == hash) {
-		TDB_DATA data = _tdb_fetch(tdb, key);
-		if (data.dsize == dbuf.dsize &&
-		    memcmp(data.dptr, dbuf.dptr, data.dsize) == 0) {
-			if (data.dptr) {
-				free(data.dptr);
-			}
-			return 0;
-		}
-		if (data.dptr) {
-			free(data.dptr);
-		}
+	    rec.full_hash == hash &&
+	    tdb_parse_record(tdb, key, tdb_update_hash_cmp, &dbuf) == 0) {
+		return 0;
 	}
 
 	/* must be long enough key, data and tailer */
diff --git a/lib/tdb2/tdb1_tdb.c b/lib/tdb2/tdb1_tdb.c
index a220f47..869672a 100644
--- a/lib/tdb2/tdb1_tdb.c
+++ b/lib/tdb2/tdb1_tdb.c
@@ -146,6 +146,19 @@ tdb1_off_t tdb1_find_lock_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t h
 
 static TDB_DATA _tdb1_fetch(struct tdb_context *tdb, TDB_DATA key);
 
+static int tdb_update_hash_cmp(TDB_DATA key, TDB_DATA data, void *private_data)
+{
+	TDB_DATA *dbuf = (TDB_DATA *)private_data;
+
+	if (dbuf->dsize != data.dsize) {
+		return -1;
+	}
+	if (memcmp(dbuf->dptr, data.dptr, data.dsize) != 0) {
+		return -1;
+	}
+	return 0;
+}
+
 /* update an entry in place - this only works if the new data size
    is <= the old data size and the key exists.
    on failure return -1.
@@ -163,18 +176,9 @@ static int tdb1_update_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash
 	 * surprisingly common (eg. with a ldb re-index). */
 	if (rec.key_len == key.dsize &&
 	    rec.data_len == dbuf.dsize &&
-	    rec.full_hash == hash) {
-		TDB_DATA data = _tdb1_fetch(tdb, key);
-		if (data.dsize == dbuf.dsize &&
-		    memcmp(data.dptr, dbuf.dptr, data.dsize) == 0) {
-			if (data.dptr) {
-				free(data.dptr);
-			}
+	    rec.full_hash == hash &&
+	    tdb1_parse_record(tdb, key, tdb_update_hash_cmp, &dbuf) == 0) {
 			return 0;
-		}
-		if (data.dptr) {
-			free(data.dptr);
-		}
 	}
 
 	/* must be long enough key, data and tailer */
diff --git a/lib/util/charset/charset_macosxfs.c b/lib/util/charset/charset_macosxfs.c
index b32aa2b..895277d 100644
--- a/lib/util/charset/charset_macosxfs.c
+++ b/lib/util/charset/charset_macosxfs.c
@@ -206,7 +206,7 @@ static void hexdump( const char * label, const char * s, size_t len )
  */
 size_t macosxfs_encoding_pull(
 	void *cd,				/* Encoder handle */
-	char **inbuf, size_t *inbytesleft,	/* Script string */
+	const char **inbuf, size_t *inbytesleft, /* Script string */
 	char **outbuf, size_t *outbytesleft)	/* UTF-16-LE string */
 {
 	static const int script_code = kCFStringEncodingUTF8;
@@ -328,7 +328,7 @@ size_t macosxfs_encoding_pull(
 
 size_t macosxfs_encoding_push(
 	void *cd,				/* Encoder handle */
-	char **inbuf, size_t *inbytesleft,	/* UTF-16-LE string */
+	const char **inbuf, size_t *inbytesleft, /* UTF-16-LE string */
 	char **outbuf, size_t *outbytesleft)	/* Script string */
 {
 	static const int script_code = kCFStringEncodingUTF8;
@@ -434,7 +434,7 @@ size_t macosxfs_encoding_push(
  */
 static size_t macosxfs_encoding_pull(
 	void *cd,				/* Encoder handle */
-	char **inbuf, size_t *inbytesleft,	/* Script string */
+	const char **inbuf, size_t *inbytesleft, /* Script string */
 	char **outbuf, size_t *outbytesleft)	/* UTF-16-LE string */
 {
 	static const int script_code = kCFStringEncodingUTF8;
@@ -522,7 +522,7 @@ static size_t macosxfs_encoding_pull(
 
 static size_t macosxfs_encoding_push(
 	void *cd,				/* Encoder handle */
-	char **inbuf, size_t *inbytesleft,	/* UTF-16-LE string */
+	const char **inbuf, size_t *inbytesleft, /* UTF-16-LE string */
 	char **outbuf, size_t *outbytesleft)	/* Script string */
 {
 	static const int script_code = kCFStringEncodingUTF8;
diff --git a/lib/util/charset/charset_proto.h b/lib/util/charset/charset_proto.h
index 3b3187a..6da7118 100644
--- a/lib/util/charset/charset_proto.h
+++ b/lib/util/charset/charset_proto.h
@@ -26,11 +26,11 @@ size_t weird_pull(void *cd, const char **inbuf, size_t *inbytesleft,
 
 size_t macosxfs_encoding_pull(
 	void *cd,				/* Encoder handle */
-	char **inbuf, size_t *inbytesleft,	/* Script string */
+	const char **inbuf, size_t *inbytesleft, /* Script string */
 	char **outbuf, size_t *outbytesleft);	/* UTF-16-LE string */
 size_t macosxfs_encoding_push(
 	void *cd,				/* Encoder handle */
-	char **inbuf, size_t *inbytesleft,	/* UTF-16-LE string */
+	const char **inbuf, size_t *inbytesleft, /* UTF-16-LE string */
 	char **outbuf, size_t *outbytesleft);	/* Script string */
 
 
diff --git a/lib/util/charset/convert_string.c b/lib/util/charset/convert_string.c
index 8f46c88..4f9917e 100644
--- a/lib/util/charset/convert_string.c
+++ b/lib/util/charset/convert_string.c
@@ -179,7 +179,9 @@ bool convert_string_error_handle(struct smb_iconv_handle *ic,
 		size_t slen = srclen;
 		size_t dlen = destlen;
 		unsigned char lastp = '\0';
+#ifndef BROKEN_UNICODE_COMPOSE_CHARACTERS
 		bool ret;
+#endif
 
 		if (slen == (size_t)-1) {
 			while (dlen &&
diff --git a/source3/configure.in b/source3/configure.in
index cbea99d..6f4300c 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -768,6 +768,14 @@ CPPFLAGS="-Iinclude $CPPFLAGS"
 AC_CHECK_HEADERS([CoreFoundation/CFStringEncodingConverter.h], [], [AC_CHECK_HEADERS([CFStringEncodingConverter.h])])
 CPPFLAGS="$old_CPPFLAGS"
 
+# To link lib/util/charset/charset_macosxfs.c, we need to tell the linker
+# about CoreFoundation
+case "$host_os" in
+    *darwin11*)
+		LDFLAGS="$LDFLAGS -framework CoreFoundation"
+	;;
+esac
+
 # In valgrind 1.0.x, it's just valgrind.h.  In 1.9.x+ there's a
 # subdirectory of headers.
 AC_CHECK_HEADERS(valgrind.h valgrind/valgrind.h valgrind/memcheck.h)
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 45c2ce9..0c457b7 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -497,7 +497,7 @@ char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e)
 {
 	return talloc_asprintf(ctx, "share_mode_entry[%d]: "
 		 "pid = %s, share_access = 0x%x, private_options = 0x%x, "
-		 "access_mask = 0x%x, mid = 0x%llx, type= 0x%x, gen_id = %lu, "
+		 "access_mask = 0x%x, mid = 0x%llx, type= 0x%x, gen_id = %llu, "
 		 "uid = %u, flags = %u, file_id %s, name_hash = 0x%x",
 		 num,
 		 procid_str_static(&e->pid),


-- 
Samba Shared Repository


More information about the samba-cvs mailing list