1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

use uintptr_t instead of intptr_t where appropriate

This commit is contained in:
Andrew Tridgell 2008-04-17 14:47:07 +02:00
parent 2090e75e0c
commit d62f2bcc85
7 changed files with 10 additions and 9 deletions

View 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);

View 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;

View 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

View 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;

View 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))

View 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 */

View 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));