From 9112a632f6791ffc3c3c1aadd214cbaba8fe816e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 4 Dec 2004 13:56:25 +0000 Subject: r4063: - change char * -> uint8_t in struct request_buffer - change smbcli_read/write to take void * for the buffers to match read(2)/write(2) all this fixes a lot of gcc-4 warnings metze (This used to be commit b94f92bc6637f748d6f7049f4f9a30b0b8d18a7a) --- source4/torture/basic/aliases.c | 10 +++++----- source4/torture/basic/denytest.c | 18 +++++++++--------- source4/torture/basic/locking.c | 6 +++--- source4/torture/basic/utable.c | 8 ++++---- source4/torture/nbench/nbio.c | 6 +++--- source4/torture/raw/context.c | 6 +++--- source4/torture/raw/lock.c | 4 ++-- source4/torture/raw/open.c | 2 +- source4/torture/raw/read.c | 14 +++++++------- source4/torture/raw/seek.c | 2 +- source4/torture/raw/streams.c | 2 +- source4/torture/raw/write.c | 14 +++++++------- source4/torture/torture.c | 20 ++++++++++---------- 13 files changed, 56 insertions(+), 56 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/basic/aliases.c b/source4/torture/basic/aliases.c index 50aabb825a..018bfd9f1a 100644 --- a/source4/torture/basic/aliases.c +++ b/source4/torture/basic/aliases.c @@ -125,7 +125,7 @@ static void qfileinfo_aliases(struct smbcli_state *cli) printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); } - smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2)); + smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2)); SSVAL(t2.in.params.data, 0, fnum); @@ -165,7 +165,7 @@ static void qpathinfo_aliases(struct smbcli_state *cli) printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); } - smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2)); + smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2)); smbcli_close(cli->tree, fnum); SIVAL(t2.in.params.data, 2, 0); @@ -209,7 +209,7 @@ static void findfirst_aliases(struct smbcli_state *cli) printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); } - smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2)); + smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2)); smbcli_close(cli->tree, fnum); SSVAL(t2.in.params.data, 0, 0); @@ -321,7 +321,7 @@ static void setfileinfo_aliases(struct smbcli_state *cli) printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); } - smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2)); + smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2)); SSVAL(t2.in.params.data, 0, fnum); SSVAL(t2.in.params.data, 4, 0); @@ -362,7 +362,7 @@ static void setpathinfo_aliases(struct smbcli_state *cli) printf("ERROR: open of %s failed (%s)\n", fname, smbcli_errstr(cli->tree)); } - smbcli_write(cli->tree, fnum, 0, (char *)&t2, 0, sizeof(t2)); + smbcli_write(cli->tree, fnum, 0, &t2, 0, sizeof(t2)); smbcli_close(cli->tree, fnum); SSVAL(t2.in.params.data, 2, 0); diff --git a/source4/torture/basic/denytest.c b/source4/torture/basic/denytest.c index 7979778c3f..0e0032058f 100644 --- a/source4/torture/basic/denytest.c +++ b/source4/torture/basic/denytest.c @@ -1454,12 +1454,12 @@ BOOL torture_denytest1(void) } else if (fnum2 == -1) { res = A_0; } else { - char x = 1; + uint8_t x = 1; res = A_0; - if (smbcli_read(cli1->tree, fnum2, (void *)&x, 0, 1) == 1) { + if (smbcli_read(cli1->tree, fnum2, &x, 0, 1) == 1) { res += A_R; } - if (smbcli_write(cli1->tree, fnum2, 0, (void *)&x, 0, 1) == 1) { + if (smbcli_write(cli1->tree, fnum2, 0, &x, 0, 1) == 1) { res += A_W; } } @@ -1551,12 +1551,12 @@ BOOL torture_denytest2(void) } else if (fnum2 == -1) { res = A_0; } else { - char x = 1; + uint8_t x = 1; res = A_0; - if (smbcli_read(cli2->tree, fnum2, (void *)&x, 0, 1) == 1) { + if (smbcli_read(cli2->tree, fnum2, &x, 0, 1) == 1) { res += A_R; } - if (smbcli_write(cli2->tree, fnum2, 0, (void *)&x, 0, 1) == 1) { + if (smbcli_write(cli2->tree, fnum2, 0, &x, 0, 1) == 1) { res += A_W; } } @@ -1782,7 +1782,7 @@ static BOOL torture_ntdenytest(struct smbcli_state *cli1, struct smbcli_state *c union smb_open io1, io2; extern int torture_numops; int failures = 0; - char buf[1]; + uint8_t buf[1]; ZERO_STRUCT(buf); @@ -1843,11 +1843,11 @@ static BOOL torture_ntdenytest(struct smbcli_state *cli1, struct smbcli_state *c } else { res = A_0; if (smbcli_read(cli2->tree, - io2.ntcreatex.out.fnum, (void *)buf, 0, sizeof(buf)) >= 1) { + io2.ntcreatex.out.fnum, buf, 0, sizeof(buf)) >= 1) { res += A_R; } if (smbcli_write(cli2->tree, - io2.ntcreatex.out.fnum, 0, (void *)buf, 0, sizeof(buf)) >= 1) { + io2.ntcreatex.out.fnum, 0, buf, 0, sizeof(buf)) >= 1) { res += A_W; } } diff --git a/source4/torture/basic/locking.c b/source4/torture/basic/locking.c index ba7d568706..7a1a13762b 100644 --- a/source4/torture/basic/locking.c +++ b/source4/torture/basic/locking.c @@ -464,7 +464,7 @@ BOOL torture_locktest4(void) const char *fname = "\\lockt4.lck"; int fnum1, fnum2, f; BOOL ret; - char buf[1000]; + uint8_t buf[1000]; BOOL correct = True; if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) { @@ -632,7 +632,7 @@ BOOL torture_locktest5(void) const char *fname = "\\lockt5.lck"; int fnum1, fnum2, fnum3; BOOL ret; - char buf[1000]; + uint8_t buf[1000]; BOOL correct = True; if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) { @@ -792,7 +792,7 @@ BOOL torture_locktest7(void) int fnum1; int fnum2 = -1; size_t size; - char buf[200]; + uint8_t buf[200]; BOOL correct = False; if (!torture_open_connection(&cli1)) { diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c index f9233595cf..01984077a3 100644 --- a/source4/torture/basic/utable.c +++ b/source4/torture/basic/utable.c @@ -28,7 +28,7 @@ BOOL torture_utable(void) fstring fname; const char *alt_name; int fnum; - char c2[4]; + uint8_t c2[4]; int c, len, fd; int chars_allowed=0, alt_allowed=0; uint8_t valid[0x10000]; @@ -102,7 +102,7 @@ BOOL torture_utable(void) static char *form_name(int c) { static fstring fname; - char c2[4]; + uint8_t c2[4]; char *p; int len; @@ -178,7 +178,7 @@ BOOL torture_casetable(void) return False; } - smbcli_read(cli->tree, fnum, (char *)c2, 0, size); + smbcli_read(cli->tree, fnum, c2, 0, size); printf("%04x: ", c); equiv[c][0] = c; for (i=0; itree, fnum, 0, (char *)&c, size, sizeof(c)); + smbcli_write(cli->tree, fnum, 0, &c, size, sizeof(c)); smbcli_close(cli->tree, fnum); } diff --git a/source4/torture/nbench/nbio.c b/source4/torture/nbench/nbio.c index 32bd108442..b83234be91 100644 --- a/source4/torture/nbench/nbio.c +++ b/source4/torture/nbench/nbio.c @@ -293,7 +293,7 @@ void nb_writex(int handle, int offset, int size, int ret_size, NTSTATUS status) union smb_write io; int i; NTSTATUS ret; - char *buf; + uint8_t *buf; i = find_handle(handle); @@ -330,7 +330,7 @@ void nb_write(int handle, int offset, int size, int ret_size, NTSTATUS status) union smb_write io; int i; NTSTATUS ret; - char *buf; + uint8_t *buf; i = find_handle(handle); @@ -420,7 +420,7 @@ void nb_readx(int handle, int offset, int size, int ret_size, NTSTATUS status) union smb_read io; int i; NTSTATUS ret; - char *buf; + uint8_t *buf; i = find_handle(handle); diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index 7fb49c3376..d0a948c401 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -67,7 +67,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) union smb_close cl; int fnum; const char *fname = BASEDIR "\\test.txt"; - char c = 1; + uint8_t c = 1; printf("TESTING SESSION HANDLING\n"); @@ -208,7 +208,7 @@ static BOOL test_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) union smb_close cl; int fnum; const char *fname = BASEDIR "\\test.txt"; - char c = 1; + uint8_t c = 1; printf("TESTING TREE HANDLING\n"); @@ -307,7 +307,7 @@ static BOOL test_pid(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) union smb_close cl; int fnum; const char *fname = BASEDIR "\\test.txt"; - char c = 1; + uint8_t c = 1; uint16_t pid1, pid2; printf("TESTING PID HANDLING\n"); diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index 547115c9f5..478c0a5a42 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -366,7 +366,7 @@ static BOOL test_pidhigh(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) BOOL ret = True; int fnum; const char *fname = BASEDIR "\\test.txt"; - char c = 1; + uint8_t c = 1; if (!torture_setup_dir(cli, BASEDIR)) { return False; @@ -598,7 +598,7 @@ static BOOL test_changetype(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) NTSTATUS status; BOOL ret = True; int fnum; - char c = 0; + uint8_t c = 0; const char *fname = BASEDIR "\\test.txt"; if (!torture_setup_dir(cli, BASEDIR)) { diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c index fe0d4fe4fa..a1cc76ebd8 100644 --- a/source4/torture/raw/open.c +++ b/source4/torture/raw/open.c @@ -33,7 +33,7 @@ enum rdwr_mode {RDWR_NONE, RDWR_RDONLY, RDWR_WRONLY, RDWR_RDWR}; */ static enum rdwr_mode check_rdwr(struct smbcli_tree *tree, int fnum) { - char c = 1; + uint8_t c = 1; BOOL can_read = (smbcli_read(tree, fnum, &c, 0, 1) == 1); BOOL can_write = (smbcli_write(tree, fnum, 0, &c, 0, 1) == 1); if ( can_read && can_write) return RDWR_RDWR; diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c index ff6d2baa2b..12818f7ba6 100644 --- a/source4/torture/raw/read.c +++ b/source4/torture/raw/read.c @@ -50,7 +50,7 @@ /* setup a random buffer based on a seed */ -static void setup_buffer(char *buf, uint_t seed, int len) +static void setup_buffer(uint8_t *buf, uint_t seed, int len) { int i; srandom(seed); @@ -60,12 +60,12 @@ static void setup_buffer(char *buf, uint_t seed, int len) /* check a random buffer based on a seed */ -static BOOL check_buffer(char *buf, uint_t seed, int len, int line) +static BOOL check_buffer(uint8_t *buf, uint_t seed, int len, int line) { int i; srandom(seed); for (i=0;itree, lockfname, O_RDWR | O_CREAT | O_EXCL, @@ -298,13 +298,13 @@ static BOOL rw_torture(struct smbcli_state *c) break; } - if (smbcli_write(c->tree, fnum, 0, (char *)&pid, 0, sizeof(pid)) != sizeof(pid)) { + if (smbcli_write(c->tree, fnum, 0, &pid, 0, sizeof(pid)) != sizeof(pid)) { printf("write failed (%s)\n", smbcli_errstr(c->tree)); correct = False; } for (j=0;j<50;j++) { - if (smbcli_write(c->tree, fnum, 0, (char *)buf, + if (smbcli_write(c->tree, fnum, 0, buf, sizeof(pid)+(j*sizeof(buf)), sizeof(buf)) != sizeof(buf)) { printf("write failed (%s)\n", smbcli_errstr(c->tree)); @@ -314,7 +314,7 @@ static BOOL rw_torture(struct smbcli_state *c) pid2 = 0; - if (smbcli_read(c->tree, fnum, (char *)&pid2, 0, sizeof(pid)) != sizeof(pid)) { + if (smbcli_read(c->tree, fnum, &pid2, 0, sizeof(pid)) != sizeof(pid)) { printf("read failed (%s)\n", smbcli_errstr(c->tree)); correct = False; } @@ -366,8 +366,8 @@ static BOOL rw_torture3(struct smbcli_state *c, const char *lockfname) { int fnum = -1; uint_t i = 0; - char buf[131072]; - char buf_rd[131072]; + uint8_t buf[131072]; + uint8_t buf_rd[131072]; uint_t count; uint_t countprev = 0; ssize_t sent = 0; @@ -597,7 +597,7 @@ static BOOL run_tcon_test(void) int fnum1; uint16_t cnum1, cnum2, cnum3; uint16_t vuid1, vuid2; - char buf[4]; + uint8_t buf[4]; BOOL ret = True; struct smbcli_tree *tree1; const char *host = lp_parm_string(-1, "torture", "host"); @@ -818,7 +818,7 @@ static BOOL run_fdpasstest(void) struct smbcli_state *cli1, *cli2; const char *fname = "\\fdpass.tst"; int fnum1, oldtid; - pstring buf; + uint8_t buf[1024]; if (!torture_open_connection(&cli1) || !torture_open_connection(&cli2)) { return False; @@ -1284,7 +1284,7 @@ static BOOL run_trans2test(void) fnum = smbcli_open(cli->tree, fname2, O_RDWR | O_CREAT | O_TRUNC, DENY_NONE); - smbcli_write(cli->tree, fnum, 0, (char *)&fnum, 0, sizeof(fnum)); + smbcli_write(cli->tree, fnum, 0, &fnum, 0, sizeof(fnum)); smbcli_close(cli->tree, fnum); if (NT_STATUS_IS_ERR(smbcli_qpathinfo2(cli->tree, "\\trans2\\", &c_time, &a_time, &m_time2, &w_time, &size, NULL, NULL))) { printf("ERROR: qpathinfo2 failed (%s)\n", smbcli_errstr(cli->tree)); @@ -1536,7 +1536,7 @@ static BOOL run_vuidtest(void) static struct smbcli_state *cli2; const char *fname = "\\readonly.file"; int fnum1, fnum2; - char buf[20]; + uint8_t buf[20]; size_t fsize; BOOL correct = True; char *tmp_path; -- cgit