Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
authorAndrew Tridgell <tridge@samba.org>
Thu, 17 Apr 2008 13:21:08 +0000 (15:21 +0200)
committerAndrew Tridgell <tridge@samba.org>
Thu, 17 Apr 2008 13:21:08 +0000 (15:21 +0200)
(This used to be commit 3ab9abf40605a4a6b220faeebaef81546a8d87a0)

source4/cluster/ctdb/include/includes.h
source4/lib/ldb/ldb_tdb/ldb_index.c
source4/lib/replace/libreplace_cc.m4
source4/lib/replace/replace.c
source4/lib/replace/replace.h
source4/lib/util/util.h
source4/libcli/raw/rawrequest.c
source4/libcli/raw/rawtrans.c
source4/libcli/smb2/request.c
source4/librpc/ndr/ndr_basic.c
source4/smb_server/smb/request.c

index 48c3c2ea4cf0f8fd61e00b5b84a6329de79d9959..0ed44cbad031611e96713d7c6a32491433c840bf 100644 (file)
@@ -21,7 +21,7 @@ extern int LogLevel;
 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
 
 #ifndef discard_const
-#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
+#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
 #endif
 
 struct timeval timeval_zero(void);
index d8776f48e254a53df309754a44f67acb3e1d98ac..1b6d9feed6117cd5175176c347540e560af54ca6 100644 (file)
@@ -545,7 +545,7 @@ static int ltdb_index_dn_one(struct ldb_module *module,
 
        /* the attribute is indexed. Pull the list of DNs that match the 
           search criterion */
-       val.data = (uint8_t *)((intptr_t)ldb_dn_get_casefold(parent_dn));
+       val.data = (uint8_t *)((uintptr_t)ldb_dn_get_casefold(parent_dn));
        val.length = strlen((char *)val.data);
        key = ltdb_index_key(ldb, LTDB_IDXONE, &val);
        if (!key) {
@@ -1140,7 +1140,7 @@ int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       val.data = (uint8_t *)((intptr_t)ldb_dn_get_casefold(pdn));
+       val.data = (uint8_t *)((uintptr_t)ldb_dn_get_casefold(pdn));
        if (val.data == NULL) {
                talloc_free(pdn);
                return LDB_ERR_OPERATIONS_ERROR;
index bf5056838d0ca2a30539ca5bc75f1104f38bf562..0ce0958a96d34f8f8c066486d6ccfa69a254986f 100644 (file)
@@ -132,7 +132,8 @@ AC_CHECK_SIZEOF(off_t)
 AC_CHECK_SIZEOF(size_t)
 AC_CHECK_SIZEOF(ssize_t)
 
-AC_CHECK_TYPE(intptr_t, unsigned long long)
+AC_CHECK_TYPE(intptr_t, long long)
+AC_CHECK_TYPE(uintptr_t, unsigned long long)
 AC_CHECK_TYPE(ptrdiff_t, unsigned long long)
 
 if test x"$ac_cv_type_long_long" != x"yes";then
index 6930f9b0791c057deeb8045be91b085d25f662ff..443da2ab24e1894c376cbe1181fbbe7567b554be 100644 (file)
@@ -458,7 +458,7 @@ char *rep_strcasestr(const char *haystack, const char *needle)
        for (s=haystack;*s;s++) {
                if (toupper(*needle) == toupper(*s) &&
                    strncasecmp(s, needle, nlen) == 0) {
-                       return (char *)((intptr_t)s);
+                       return (char *)((uintptr_t)s);
                }
        }
        return NULL;
index 5fe79394ebf63fd4bb1d7bfeb96e9a163e38cfed..bf95169352ecb9cebde68b3abcdc31a9da36efec 100644 (file)
@@ -499,7 +499,7 @@ typedef int bool;
   Also, please call this via the discard_const_p() macro interface, as that
   makes the return type safe.
 */
-#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
+#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
 
 /** Type-safe version of discard_const */
 #define discard_const_p(type, ptr) ((type *)discard_const(ptr))
index 3bf6b98d2fb3f247ce9800ab5b835aab271935c3..ffe83c14b297d9573fc669e9b03fcaa4321b82cf 100644 (file)
@@ -64,7 +64,7 @@ extern const char *panic_action;
   makes the return type safe.
 */
 #ifndef discard_const
-#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
+#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
 #endif
 
 /** Type-safe version of discard_const */
index a42c71054718b1fb67268cbb31beda22498ba8e9..ef856c6ea1d0c5799d72d879694d2f3aa7dcc6e2 100644 (file)
@@ -700,10 +700,10 @@ DATA_BLOB smbcli_req_pull_blob(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_
 static bool smbcli_req_data_oob(struct request_bufinfo *bufinfo, const uint8_t *ptr, uint32_t count)
 {
        /* be careful with wraparound! */
-       if (ptr < bufinfo->data ||
-           ptr >= bufinfo->data + bufinfo->data_size ||
+       if ((uintptr_t)ptr < (uintptr_t)bufinfo->data ||
+           (uintptr_t)ptr >= (uintptr_t)bufinfo->data + bufinfo->data_size ||
            count > bufinfo->data_size ||
-           ptr + count > bufinfo->data + bufinfo->data_size) {
+           (uintptr_t)ptr + count > (uintptr_t)bufinfo->data + bufinfo->data_size) {
                return true;
        }
        return false;
index 29881afd2bc2ff7be350842ef36304a50b63c9e9..0f15b2151b6046452b0a1519c3e780875b9d7386 100644 (file)
@@ -40,10 +40,10 @@ static bool raw_trans_oob(struct smbcli_request *req,
        ptr = req->in.hdr + offset;
        
        /* be careful with wraparound! */
-       if (ptr < req->in.data ||
-           ptr >= req->in.data + req->in.data_size ||
+       if ((uintptr_t)ptr < (uintptr_t)req->in.data ||
+           (uintptr_t)ptr >= (uintptr_t)req->in.data + req->in.data_size ||
            count > req->in.data_size ||
-           ptr + count > req->in.data + req->in.data_size) {
+           (uintptr_t)ptr + count > (uintptr_t)req->in.data + req->in.data_size) {
                return true;
        }
        return false;   
index 2471fcaa4ddae7342679e789153b101fb18c74e5..f52b0ceef2586ab17f22fbfcc639c51134078854 100644 (file)
@@ -211,10 +211,10 @@ bool smb2_oob(struct smb2_request_buffer *buf, const uint8_t *ptr, size_t size)
                return false;
        }
        /* be careful with wraparound! */
-       if (ptr < buf->body ||
-           ptr >= buf->body + buf->body_size ||
+       if ((uintptr_t)ptr < (uintptr_t)buf->body ||
+           (uintptr_t)ptr >= (uintptr_t)buf->body + buf->body_size ||
            size > buf->body_size ||
-           ptr + size > buf->body + buf->body_size) {
+           (uintptr_t)ptr + size > (uintptr_t)buf->body + buf->body_size) {
                return true;
        }
        return false;
@@ -669,7 +669,7 @@ NTSTATUS smb2_push_o16s16_string(struct smb2_request_buffer *buf,
        }
 
        if (*str == 0) {
-               blob.data = str;
+               blob.data = discard_const(str);
                blob.length = 0;
                return smb2_push_o16s16_blob(buf, ofs, blob);
        }
index 93a177f94e5f127698e14652cbbe2a02edd53fbd..1d2b47c850b4e246c47f6ad07723fad79c35903b 100644 (file)
@@ -196,7 +196,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, u
 */
 _PUBLIC_ enum ndr_err_code ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v)
 {
-       intptr_t h;
+       uintptr_t h;
        NDR_PULL_ALIGN(ndr, sizeof(h));
        NDR_PULL_NEED_BYTES(ndr, sizeof(h));
        memcpy(&h, ndr->data+ndr->offset, sizeof(h));
@@ -393,7 +393,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, u
 */
 _PUBLIC_ enum ndr_err_code ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v)
 {
-       intptr_t h = (intptr_t)v;
+       uintptr_t h = (intptr_t)v;
        NDR_PUSH_ALIGN(ndr, sizeof(h));
        NDR_PUSH_NEED_BYTES(ndr, sizeof(h));
        memcpy(ndr->data+ndr->offset, &h, sizeof(h));
index 87073517ddcdf799d2d230fff8ba8a1935ec708a..c7fa2d7d8abca1959b121b2c961d5c9bc20b90ef 100644 (file)
@@ -651,10 +651,10 @@ bool req_data_oob(struct request_bufinfo *bufinfo, const uint8_t *ptr, uint32_t
        }
        
        /* be careful with wraparound! */
-       if (ptr < bufinfo->data ||
-           ptr >= bufinfo->data + bufinfo->data_size ||
+       if ((uintptr_t)ptr < (uintptr_t)bufinfo->data ||
+           (uintptr_t)ptr >= (uintptr_t)bufinfo->data + bufinfo->data_size ||
            count > bufinfo->data_size ||
-           ptr + count > bufinfo->data + bufinfo->data_size) {
+           (uintptr_t)ptr + count > (uintptr_t)bufinfo->data + bufinfo->data_size) {
                return true;
        }
        return false;