Clean up assignments to iov_base, ensure it's always cast to void *. This should...
authorJeremy Allison <jra@samba.org>
Tue, 12 May 2009 18:45:37 +0000 (11:45 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 12 May 2009 18:45:37 +0000 (11:45 -0700)
Jeremy.

source3/lib/sendfile.c
source3/lib/util_sock.c
source3/lib/wb_reqtrans.c
source3/libsmb/async_smb.c
source3/libsmb/cliconnect.c
source3/libsmb/clientgen.c
source3/libsmb/clifile.c
source3/libsmb/clireadwrite.c
source3/libsmb/clitrans.c
source3/modules/onefs_system.c
source3/modules/vfs_aio_fork.c

index 59a18ce6e184b164946557b1758355b35e5c323c..3003246dd0f5adbbb86420afec50695749683467 100644 (file)
@@ -274,7 +274,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of
 
        if (header) {
                /* Set up the header/trailer iovec. */
-               hdtrl[0].iov_base = header->data;
+               hdtrl[0].iov_base = (void *)header->data;
                hdtrl[0].iov_len = hdr_len = header->length;
        } else {
                hdtrl[0].iov_base = NULL;
@@ -320,7 +320,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of
                                hdtrl[0].iov_len = 0;
                        } else {
                                /* iov_base is defined as a void *... */
-                               hdtrl[0].iov_base = ((char *)hdtrl[0].iov_base) + nwritten;
+                               hdtrl[0].iov_base = (void *)(((char *)hdtrl[0].iov_base) + nwritten);
                                hdtrl[0].iov_len -= nwritten;
                                nwritten = 0;
                        }
@@ -351,7 +351,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of
 
        /* Set up the header iovec. */
        if (header) {
-               hdtrl.iov_base = header->data;
+               hdtrl.iov_base = (void *)header->data;
                hdtrl.iov_len = hdr_len = header->length;
        } else {
                hdtrl.iov_base = NULL;
@@ -392,7 +392,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of
                                hdtrl.iov_len = 0;
                        } else {
                                hdtrl.iov_base =
-                                   (caddr_t)hdtrl.iov_base + nwritten;
+                                   (void *)((caddr_t)hdtrl.iov_base + nwritten);
                                hdtrl.iov_len -= nwritten;
                                nwritten = 0;
                        }
index 3fd0cc4ad31c83a0fe94ffecc9e2bbe94302b6fc..92e373b4eac6478ea844bbf963794aa4d109be4f 100644 (file)
@@ -680,7 +680,7 @@ ssize_t write_data_iov(int fd, const struct iovec *orig_iov, int iovcnt)
                        if (thistime < iov[0].iov_len) {
                                char *new_base =
                                        (char *)iov[0].iov_base + thistime;
-                               iov[0].iov_base = new_base;
+                               iov[0].iov_base = (void *)new_base;
                                iov[0].iov_len -= thistime;
                                break;
                        }
@@ -709,7 +709,7 @@ ssize_t write_data(int fd, const char *buffer, size_t N)
        ssize_t ret;
        struct iovec iov;
 
-       iov.iov_base = CONST_DISCARD(char *, buffer);
+       iov.iov_base = CONST_DISCARD(void *, buffer);
        iov.iov_len = N;
 
        ret = write_data_iov(fd, &iov, 1);
index c11561f14e8726ff080e2dc6bfd97388cc45e881..df92ecf8b065fde8eb8238bbca08d8acf54cafca 100644 (file)
@@ -143,11 +143,11 @@ struct tevent_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       state->iov[0].iov_base = wb_req;
+       state->iov[0].iov_base = (void *)wb_req;
        state->iov[0].iov_len = sizeof(struct winbindd_request);
 
        if (wb_req->extra_len != 0) {
-               state->iov[1].iov_base = wb_req->extra_data.data;
+               state->iov[1].iov_base = (void *)wb_req->extra_data.data;
                state->iov[1].iov_len = wb_req->extra_len;
                count = 2;
        }
@@ -299,11 +299,11 @@ struct tevent_req *wb_resp_write_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       state->iov[0].iov_base = wb_resp;
+       state->iov[0].iov_base = (void *)wb_resp;
        state->iov[0].iov_len = sizeof(struct winbindd_response);
 
        if (wb_resp->length > sizeof(struct winbindd_response)) {
-               state->iov[1].iov_base = wb_resp->extra_data.data;
+               state->iov[1].iov_base = (void *)wb_resp->extra_data.data;
                state->iov[1].iov_len =
                        wb_resp->length - sizeof(struct winbindd_response);
                count = 2;
index 17040b8c9f43eaeae7038658c2ee74db23932cb1..9fdd14793f1fecf4db047b961623847fd0fb3313 100644 (file)
@@ -496,11 +496,11 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
 
        SSVAL(state->bytecount_buf, 0, iov_len(bytes_iov, iov_count));
 
-       state->iov[0].iov_base = state->header;
+       state->iov[0].iov_base = (void *)state->header;
        state->iov[0].iov_len  = sizeof(state->header);
-       state->iov[1].iov_base = state->vwv;
+       state->iov[1].iov_base = (void *)state->vwv;
        state->iov[1].iov_len  = wct * sizeof(uint16_t);
-       state->iov[2].iov_base = state->bytecount_buf;
+       state->iov[2].iov_base = (void *)state->bytecount_buf;
        state->iov[2].iov_len  = sizeof(uint16_t);
 
        if (iov_count != 0) {
@@ -584,7 +584,7 @@ static bool cli_smb_req_iov_send(struct tevent_req *req,
                if (buf == NULL) {
                        return false;
                }
-               iov[0].iov_base = buf;
+               iov[0].iov_base = (void *)buf;
                iov[0].iov_len = talloc_get_size(buf);
                subreq = writev_send(state, state->ev, state->cli->outgoing,
                                     state->cli->fd, iov, 1);
@@ -623,7 +623,7 @@ struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx,
        struct tevent_req *req;
        struct iovec iov;
 
-       iov.iov_base = CONST_DISCARD(char *, bytes);
+       iov.iov_base = CONST_DISCARD(void *, bytes);
        iov.iov_len = num_bytes;
 
        req = cli_smb_req_create(mem_ctx, ev, cli, smb_command,
@@ -1023,7 +1023,7 @@ bool cli_smb_chain_send(struct tevent_req **reqs, int num_reqs)
                         * last byte.
                         */
                        this_iov[0].iov_len = chain_padding+1;
-                       this_iov[0].iov_base = &state->header[
+                       this_iov[0].iov_base = (void *)&state->header[
                                sizeof(state->header) - this_iov[0].iov_len];
                        memset(this_iov[0].iov_base, 0, this_iov[0].iov_len-1);
                }
index 7a8a93078d165a3341acd55fa58b65834ad47027..38985363c2e67846193293e1a8f7ada53daf5922 100644 (file)
@@ -219,7 +219,7 @@ struct tevent_req *cli_session_setup_guest_create(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       state->bytes.iov_base = bytes;
+       state->bytes.iov_base = (void *)bytes;
        state->bytes.iov_len = talloc_get_size(bytes);
 
        subreq = cli_smb_req_create(state, ev, cli, SMBsesssetupX, 0, 13, vwv,
@@ -1367,7 +1367,7 @@ struct tevent_req *cli_tcon_andx_create(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       state->bytes.iov_base = bytes;
+       state->bytes.iov_base = (void *)bytes;
        state->bytes.iov_len = talloc_get_size(bytes);
 
        subreq = cli_smb_req_create(state, ev, cli, SMBtconX, 0, 4, vwv,
index b06a6fa1879d887db017ffe913f160305af7cbc2..bc2a092de33a2df0af0998dcd78f99b6f9cb1148 100644 (file)
@@ -422,9 +422,9 @@ bool cli_send_smb_direct_writeX(struct cli_state *cli,
                return false;
        }
 
-       iov[0].iov_base = cli->outbuf;
+       iov[0].iov_base = (void *)cli->outbuf;
        iov[0].iov_len = len;
-       iov[1].iov_base = CONST_DISCARD(char *, p);
+       iov[1].iov_base = CONST_DISCARD(void *, p);
        iov[1].iov_len = extradata;
 
        nwritten = write_data_iov(cli->fd, iov, 2);
index fdfa257ec82d1dc49d52ee2bbeb21b9764d1271e..63e6c474db66e2342bb462e74f6e1e9b2b273eb4 100644 (file)
@@ -1465,7 +1465,7 @@ struct tevent_req *cli_open_create(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
 
-       state->bytes.iov_base = bytes;
+       state->bytes.iov_base = (void *)bytes;
        state->bytes.iov_len = talloc_get_size(bytes);
 
        subreq = cli_smb_req_create(state, ev, cli, SMBopenX, additional_flags,
index 07d438fd258491caf0b10097ddfc406415c4bc21..4e256ede57d2fe16b33bb3621e6648ccea11b6df 100644 (file)
@@ -848,9 +848,9 @@ struct tevent_req *cli_write_andx_create(TALLOC_CTX *mem_ctx,
        }
 
        state->pad = 0;
-       state->iov[0].iov_base = &state->pad;
+       state->iov[0].iov_base = (void *)&state->pad;
        state->iov[0].iov_len = 1;
-       state->iov[1].iov_base = CONST_DISCARD(uint8_t *, buf);
+       state->iov[1].iov_base = CONST_DISCARD(void *, buf);
        state->iov[1].iov_len = size;
 
        subreq = cli_smb_req_create(state, ev, cli, SMBwriteX, 0, wct, vwv,
index 8fc7a5269fb89c3c2ca5f2fbc59e0d1c7e2bdd09..d6d78cc6c3ec62cd6adda5bf959fc467a7400f4b 100644 (file)
@@ -860,9 +860,9 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
        switch (cmd) {
        case SMBtrans:
                pad[0] = 0;
-               iov[0].iov_base = pad;
+               iov[0].iov_base = (void *)pad;
                iov[0].iov_len = 1;
-               iov[1].iov_base = state->pipe_name_conv;
+               iov[1].iov_base = (void *)state->pipe_name_conv;
                iov[1].iov_len = state->pipe_name_conv_len;
                wct = 14 + state->num_setup;
                param_offset += iov[0].iov_len + iov[1].iov_len;
@@ -872,7 +872,7 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
                pad[0] = 0;
                pad[1] = 'D'; /* Copy this from "old" 3.0 behaviour */
                pad[2] = ' ';
-               iov[0].iov_base = pad;
+               iov[0].iov_base = (void *)pad;
                iov[0].iov_len = 3;
                wct = 14 + state->num_setup;
                param_offset += 3;
@@ -897,7 +897,7 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
        if (state->param_sent < state->num_param) {
                this_param = MIN(state->num_param - state->param_sent,
                                 useable_space);
-               iov[0].iov_base = state->param + state->param_sent;
+               iov[0].iov_base = (void *)(state->param + state->param_sent);
                iov[0].iov_len = this_param;
                iov += 1;
        }
@@ -905,7 +905,7 @@ static void cli_trans_format(struct cli_trans_state *state, uint8_t *pwct,
        if (state->data_sent < state->num_data) {
                this_data = MIN(state->num_data - state->data_sent,
                                useable_space - this_param);
-               iov[0].iov_base = state->data + state->data_sent;
+               iov[0].iov_base = (void *)(state->data + state->data_sent);
                iov[0].iov_len = this_data;
                iov += 1;
        }
index cf99a27a87c3edc800984c3a54f4daf7c0f040b3..22ef2f481b82fcddab7fd599a1d4773bed3b59db 100644 (file)
@@ -231,7 +231,7 @@ static ssize_t onefs_sys_do_sendfile(int tofd, int fromfd,
 
        /* Set up the header iovec. */
        if (header) {
-               hdtrl.iov_base = header->data;
+               hdtrl.iov_base = (void *)header->data;
                hdtrl.iov_len = hdr_len = header->length;
        } else {
                hdtrl.iov_base = NULL;
@@ -293,7 +293,7 @@ static ssize_t onefs_sys_do_sendfile(int tofd, int fromfd,
                                hdtrl.iov_len = 0;
                        } else {
                                hdtrl.iov_base =
-                                   (caddr_t)hdtrl.iov_base + nwritten;
+                                   (void *)((caddr_t)hdtrl.iov_base + nwritten);
                                hdtrl.iov_len -= nwritten;
                                nwritten = 0;
                        }
index e29ce5e7a8fe9da20f3bbf55fef47b92a3a1a6ad..8568ec39165d6e250e06d3ab5d279afb42f68240 100644 (file)
@@ -135,7 +135,7 @@ static ssize_t read_fd(int fd, void *ptr, size_t nbytes, int *recvfd)
        msg.msg_name = NULL;
        msg.msg_namelen = 0;
 
-       iov[0].iov_base = ptr;
+       iov[0].iov_base = (void *)ptr;
        iov[0].iov_len = nbytes;
        msg.msg_iov = iov;
        msg.msg_iovlen = 1;
@@ -206,7 +206,7 @@ static ssize_t write_fd(int fd, void *ptr, size_t nbytes, int sendfd)
        msg.msg_namelen = 0;
 
        ZERO_STRUCT(iov);
-       iov[0].iov_base = ptr;
+       iov[0].iov_base = (void *)ptr;
        iov[0].iov_len = nbytes;
        msg.msg_iov = iov;
        msg.msg_iovlen = 1;