From: Jelmer Vernooij Date: Sun, 30 Apr 2006 13:54:03 +0000 (+0000) Subject: r15358: Fix some compiler warnings / type safety. Found by tcc X-Git-Tag: samba-4.0.0alpha6~801^3~6349 X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=cf0f4ec073b694e43daeeddf9aab51cd3e51fd2b;p=bbaumbach%2Fsamba-autobuild%2F.git r15358: Fix some compiler warnings / type safety. Found by tcc (This used to be commit 12ba42de5886f9f4f9b1698476557e0c217d06f3) --- diff --git a/source4/lib/appweb/ejs/ejsLib.c b/source4/lib/appweb/ejs/ejsLib.c index af5ce52731e..0dfc2e0ed2d 100644 --- a/source4/lib/appweb/ejs/ejsLib.c +++ b/source4/lib/appweb/ejs/ejsLib.c @@ -64,8 +64,8 @@ static void *lockData; this is a workaround for the use of global variables in ejs */ struct ejs_state_ctx { - struct MprVar master; - struct MprArray *ejsList; + MprVar master; + MprArray *ejsList; }; void *ejs_save_state(void) diff --git a/source4/lib/appweb/mpr/miniMpr.h b/source4/lib/appweb/mpr/miniMpr.h index 0b2dc3490d7..bf57d50abcd 100644 --- a/source4/lib/appweb/mpr/miniMpr.h +++ b/source4/lib/appweb/mpr/miniMpr.h @@ -185,9 +185,6 @@ typedef char* MprStr; #ifndef __cplusplus typedef unsigned char uchar; -#ifndef __bool_true_false_are_defined -typedef int bool; -#endif #endif /* diff --git a/source4/lib/socket_wrapper/socket_wrapper.c b/source4/lib/socket_wrapper/socket_wrapper.c index 6e6711834be..6bb7f6464f5 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.c +++ b/source4/lib/socket_wrapper/socket_wrapper.c @@ -462,7 +462,7 @@ _PUBLIC_ int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen) child_si->protocol = parent_si->protocol; child_si->bound = 1; - ret = real_getsockname(fd, &un_my_addr, &un_my_addrlen); + ret = real_getsockname(fd, (struct sockaddr *)&un_my_addr, &un_my_addrlen); if (ret == -1) return ret; ret = sockaddr_convert_from_un(child_si, &un_my_addr, un_my_addrlen, diff --git a/source4/libcli/ldap/ldap_controls.c b/source4/libcli/ldap/ldap_controls.c index ccb1b74a558..47b1262aea1 100644 --- a/source4/libcli/ldap/ldap_controls.c +++ b/source4/libcli/ldap/ldap_controls.c @@ -127,9 +127,11 @@ static BOOL decode_server_sort_request(void *mem_ctx, DATA_BLOB in, void **out) } if (asn1_peek_tag(&data, ASN1_BOOLEAN)) { - if (!asn1_read_BOOLEAN(&data, &(lssc[num]->reverse))) { + bool reverse; + if (!asn1_read_BOOLEAN(&data, &reverse)) { return False; } + lssc[num]->reverse = reverse; } if (!asn1_end_tag(&data)) { @@ -902,9 +904,11 @@ BOOL ldap_decode_control(void *mem_ctx, struct asn1_data *data, struct ldb_contr } if (asn1_peek_tag(data, ASN1_BOOLEAN)) { - if (!asn1_read_BOOLEAN(data, &(ctrl->critical))) { + bool critical; + if (!asn1_read_BOOLEAN(data, &critical)) { return False; } + critical = ctrl->critical; } else { ctrl->critical = False; } diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c index 70a1c0523ae..3e5457f0cd3 100644 --- a/source4/ntvfs/posix/pvfs_resolve.c +++ b/source4/ntvfs/posix/pvfs_resolve.c @@ -548,7 +548,7 @@ NTSTATUS pvfs_resolve_partial(struct pvfs_state *pvfs, TALLOC_CTX *mem_ctx, NTSTATUS pvfs_resolve_name_fd(struct pvfs_state *pvfs, int fd, struct pvfs_filename *name) { - dev_t device = 0; + dev_t device = (dev_t)0; ino_t inode = 0; if (name->exists) { diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index ab955abb262..4dc07b9dc14 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -219,7 +219,7 @@ static WERROR winreg_EnumValue(struct dcesrv_call_state *dce_call, TALLOC_CTX *m /* the client can optionally pass a NULL for type, meaning they don't want that back */ if (r->in.type != NULL) { - r->out.type = talloc(mem_ctx, uint32_t); + r->out.type = talloc(mem_ctx, enum winreg_Type); *r->out.type = value->data_type; } @@ -398,7 +398,7 @@ static WERROR winreg_QueryValue(struct dcesrv_call_state *dce_call, TALLOC_CTX * } /* Just asking for the size of the buffer */ - r->out.type = &val->data_type; + r->out.type = (enum winreg_Type *)&val->data_type; r->out.length = &val->data.length; if (!r->in.data) { r->out.size = talloc(mem_ctx, uint32_t); diff --git a/source4/torture/com/simple.c b/source4/torture/com/simple.c index bb67ca7bba4..82aab476be4 100644 --- a/source4/torture/com/simple.c +++ b/source4/torture/com/simple.c @@ -38,7 +38,7 @@ static BOOL test_readwrite(TALLOC_CTX *mem_ctx, const char *host) struct IUnknown *interfaces[3]; WERROR results[2]; struct com_context *ctx; - char test_data[5]; + uint8_t test_data[5]; int i; com_init(); @@ -53,7 +53,7 @@ static BOOL test_readwrite(TALLOC_CTX *mem_ctx, const char *host) if (host) { error = dcom_create_object(ctx, &clsid, host, 2, IID, - &interfaces, + (struct IUnknown ***)&interfaces, results); } else { error = com_create_object(ctx, &clsid, 2, IID, interfaces, results); @@ -74,7 +74,7 @@ static BOOL test_readwrite(TALLOC_CTX *mem_ctx, const char *host) test_data[i] = i+1; } - error = IStream_Write((struct IStream *)interfaces[0], mem_ctx, &test_data, 5, NULL); + error = IStream_Write((struct IStream *)interfaces[0], mem_ctx, test_data, 5, NULL); if (!W_ERROR_IS_OK(error)) { printf("IStream::Write() failed - %s\n", win_errstr(error)); ret = False; diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c index 5a05e669a2c..a03da8002a5 100644 --- a/source4/torture/rpc/winreg.c +++ b/source4/torture/rpc/winreg.c @@ -111,7 +111,7 @@ static BOOL test_CreateKey(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct winreg_CreateKey r; struct policy_handle newhandle; NTSTATUS status; - uint32_t action_taken = 0; + enum winreg_CreateAction action_taken = 0; printf("\ntesting CreateKey\n"); @@ -149,7 +149,7 @@ static BOOL test_CreateKey_sd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { struct winreg_CreateKey r; NTSTATUS status; - uint32_t action_taken = 0; + enum winreg_CreateAction action_taken = 0; struct security_descriptor *sd; DATA_BLOB sdblob; struct winreg_SecBuf secbuf; @@ -500,15 +500,16 @@ static BOOL test_QueryValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct p { struct winreg_QueryValue r; NTSTATUS status; - uint32_t zero = 0; + enum winreg_Type zero_type = 0; uint32_t offered = 0xfff; + uint32_t zero = 0; printf("Testing QueryValue\n"); r.in.handle = handle; r.in.data = NULL; r.in.value_name.name = valuename; - r.in.type = &zero; + r.in.type = &zero_type; r.in.size = &offered; r.in.length = &zero; @@ -530,7 +531,7 @@ static BOOL test_EnumValue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, int max_valnamelen, int max_valbufsize) { struct winreg_EnumValue r; - uint32_t type = 0; + enum winreg_Type type = 0; uint32_t size = max_valbufsize, zero = 0; BOOL ret = True; uint8_t buf8;