From e835621799647ee70630b389fb53d15b15d68355 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 17 Jul 2005 09:20:52 +0000 Subject: r8520: fixed a pile of warnings from the build farm gcc -Wall output on S390. This is an attempt to avoid the panic we're seeing in the automatic builds. The main fixes are: - assumptions that sizeof(size_t) == sizeof(int), mostly in printf formats - use of NULL format statements to perform dn searches. - assumption that sizeof() returns an int (This used to be commit a58ea6b3854973b694d2b1e22323ed7eb00e3a3f) --- source4/torture/auth/ntlmssp.c | 6 ++++-- source4/torture/auth/pac.c | 4 ++-- source4/torture/basic/aliases.c | 4 ++-- source4/torture/basic/delaywrite.c | 19 ++++++++++++------- source4/torture/basic/denytest.c | 2 +- source4/torture/basic/locking.c | 3 ++- source4/torture/basic/utable.c | 2 +- source4/torture/ldap/basic.c | 6 +++--- source4/torture/local/iconv.c | 12 ++++++------ source4/torture/local/idtree.c | 2 +- source4/torture/local/socket.c | 8 ++++---- source4/torture/nbt/register.c | 2 +- source4/torture/raw/composite.c | 4 ++-- source4/torture/raw/context.c | 4 ++-- source4/torture/raw/qfileinfo.c | 4 ++-- source4/torture/raw/streams.c | 4 ++-- source4/torture/rpc/autoidl.c | 4 ++-- source4/torture/rpc/samsync.c | 4 ++-- source4/torture/torture.c | 6 +++--- source4/torture/torture_util.c | 4 ++-- 20 files changed, 56 insertions(+), 48 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/auth/ntlmssp.c b/source4/torture/auth/ntlmssp.c index 578acb4441..c012ee5174 100644 --- a/source4/torture/auth/ntlmssp.c +++ b/source4/torture/auth/ntlmssp.c @@ -73,7 +73,8 @@ BOOL torture_ntlmssp_self_check(void) dump_data_pw("NTLMSSP expected sig: ", expected_sig.data, expected_sig.length); if (sig.length != expected_sig.length) { - printf("Wrong sig length: %d != %d\n", sig.length, expected_sig.length); + printf("Wrong sig length: %d != %d\n", + (int)sig.length, (int)expected_sig.length); return False; } @@ -125,7 +126,8 @@ BOOL torture_ntlmssp_self_check(void) dump_data_pw("NTLMSSP expected sig: ", expected_sig.data, expected_sig.length); if (sig.length != expected_sig.length) { - printf("Wrong sig length: %d != %d\n", sig.length, expected_sig.length); + printf("Wrong sig length: %d != %d\n", + (int)sig.length, (int)expected_sig.length); return False; } diff --git a/source4/torture/auth/pac.c b/source4/torture/auth/pac.c index f03b20b286..21c3119e31 100644 --- a/source4/torture/auth/pac.c +++ b/source4/torture/auth/pac.c @@ -303,14 +303,14 @@ static BOOL torture_pac_saved_check(void) */ if (tmp_blob.length != validate_blob.length) { DEBUG(0, ("PAC push failed: orignial buffer length[%u] != created buffer length[%u]\n", - tmp_blob.length, validate_blob.length)); + (unsigned)tmp_blob.length, (unsigned)validate_blob.length)); talloc_free(mem_ctx); return False; } if (memcmp(tmp_blob.data, validate_blob.data, tmp_blob.length) != 0) { DEBUG(0, ("PAC push failed: length[%u] matches, but data does not\n", - tmp_blob.length)); + (unsigned)tmp_blob.length)); talloc_free(mem_ctx); return False; } diff --git a/source4/torture/basic/aliases.c b/source4/torture/basic/aliases.c index edea3d963e..364dfeecf2 100644 --- a/source4/torture/basic/aliases.c +++ b/source4/torture/basic/aliases.c @@ -55,7 +55,7 @@ static void gen_aliases(struct smbcli_state *cli, struct smb_trans2 *t2, int lev DLIST_ADD(alias_blobs, t2b); d_printf("\tFound level %4u (0x%03x) of size %3d (0x%02x)\n", level, level, - t2b->data.length, t2b->data.length); + (int)t2b->data.length, t2b->data.length); count++; } @@ -285,7 +285,7 @@ static void gen_set_aliases(struct smbcli_state *cli, struct smb_trans2 *t2, int DLIST_ADD(alias_blobs, t2b); d_printf("\tFound level %4u (0x%03x) of size %3d (0x%02x)\n", level, level, - t2->in.data.length, t2->in.data.length); + (int)t2->in.data.length, t2->in.data.length); count++; } diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 7839581caa..ebce013170 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -72,7 +72,8 @@ static BOOL test_delayed_write_update(struct smbcli_state *cli, TALLOC_CTX *mem_ written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1); if (written != 1) { - printf("write failed - wrote %d bytes (%s)\n", written, __location__); + printf("write failed - wrote %d bytes (%s)\n", + (int)written, __location__); return False; } @@ -239,7 +240,8 @@ static BOOL test_delayed_write_update2(struct smbcli_state *cli, TALLOC_CTX *mem written = smbcli_write(cli->tree, fnum1, 0, "0123456789", 1, 10); if (written != 10) { - printf("write failed - wrote %d bytes (%s)\n", written, __location__); + printf("write failed - wrote %d bytes (%s)\n", + (int)written, __location__); return False; } @@ -294,7 +296,8 @@ static BOOL test_delayed_write_update2(struct smbcli_state *cli, TALLOC_CTX *mem written = smbcli_write(cli->tree, fnum2, 0, "0123456789", 11, 10); if (written != 10) { - printf("write failed - wrote %d bytes (%s)\n", written, __location__); + printf("write failed - wrote %d bytes (%s)\n", + (int)written, __location__); return False; } @@ -319,7 +322,8 @@ static BOOL test_delayed_write_update2(struct smbcli_state *cli, TALLOC_CTX *mem written = smbcli_write(cli->tree, fnum2, 0, "0123456789", 21, 10); if (written != 10) { - printf("write failed - wrote %d bytes (%s)\n", written, __location__); + printf("write failed - wrote %d bytes (%s)\n", + (int)written, __location__); return False; } @@ -397,7 +401,8 @@ static BOOL test_delayed_write_update2(struct smbcli_state *cli, TALLOC_CTX *mem written = smbcli_write(cli->tree, fnum1, 0, "0123456789", 31, 10); if (written != 10) { - printf("write failed - wrote %d bytes (%s)\n", written, __location__); + printf("write failed - wrote %d bytes (%s)\n", + (int)written, __location__); return False; } @@ -511,7 +516,7 @@ static BOOL test_finfo_after_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx if (written != 1) { printf("(%s) written gave %d - should have been 1\n", - __location__, written); + __location__, (int)written); ret = False; goto done; } @@ -532,7 +537,7 @@ static BOOL test_finfo_after_write(struct smbcli_state *cli, TALLOC_CTX *mem_ctx if (written != 1) { printf("(%s) written gave %d - should have been 1\n", - __location__, written); + __location__, (int)written); ret = False; goto done; } diff --git a/source4/torture/basic/denytest.c b/source4/torture/basic/denytest.c index 35c22ff19f..8d16fa5e73 100644 --- a/source4/torture/basic/denytest.c +++ b/source4/torture/basic/denytest.c @@ -1433,7 +1433,7 @@ BOOL torture_denytest1(void) smbcli_close(cli1->tree, fnum1); } - printf("testing %d entries\n", ARRAY_SIZE(denytable1)); + printf("testing %d entries\n", (int)ARRAY_SIZE(denytable1)); GetTimeOfDay(&tv_start); diff --git a/source4/torture/basic/locking.c b/source4/torture/basic/locking.c index 3f395f3907..3ab26c3879 100644 --- a/source4/torture/basic/locking.c +++ b/source4/torture/basic/locking.c @@ -959,7 +959,8 @@ BOOL torture_locktest7(void) } if (size != 0) { - printf("Unable to truncate locked file. Size was %u (%s)\n", size, __location__); + printf("Unable to truncate locked file. Size was %u (%s)\n", + (unsigned)size, __location__); correct = False; goto fail; } diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c index ea1bb76b8c..cf3b07886a 100644 --- a/source4/torture/basic/utable.c +++ b/source4/torture/basic/utable.c @@ -175,7 +175,7 @@ BOOL torture_casetable(void) if (size/sizeof(int) >= MAX_EQUIVALENCE) { printf("too many chars match?? size=%d c=0x%04x\n", - size, c); + (int)size, c); smbcli_close(cli->tree, fnum); return False; } diff --git a/source4/torture/ldap/basic.c b/source4/torture/ldap/basic.c index 69b9017d8a..7dfc81b692 100644 --- a/source4/torture/ldap/basic.c +++ b/source4/torture/ldap/basic.c @@ -125,13 +125,13 @@ static BOOL test_search_rootDSE(struct ldap_connection *conn, char **basedn) int j; for (j=0; jattributes[i].num_values; j++) { DEBUG(1,("\t%s: %d %.*s\n", r->attributes[i].name, - r->attributes[i].values[j].length, - r->attributes[i].values[j].length, + (int)r->attributes[i].values[j].length, + (int)r->attributes[i].values[j].length, (char *)r->attributes[i].values[j].data)); if (!(*basedn) && strcasecmp("defaultNamingContext",r->attributes[i].name)==0) { *basedn = talloc_asprintf(conn, "%.*s", - r->attributes[i].values[j].length, + (int)r->attributes[i].values[j].length, (char *)r->attributes[i].values[j].data); } } diff --git a/source4/torture/local/iconv.c b/source4/torture/local/iconv.c index 9aa678995b..662816d533 100644 --- a/source4/torture/local/iconv.c +++ b/source4/torture/local/iconv.c @@ -174,7 +174,7 @@ static int test_buffer(uint8_t *inbuf, size_t size, const char *charset) } if (ret1 != ret2) { - printf("ret1=%d ret2=%d\n", ret1, ret2); + printf("ret1=%d ret2=%d\n", (int)ret1, (int)ret2); ok = 0; } @@ -187,20 +187,20 @@ static int test_buffer(uint8_t *inbuf, size_t size, const char *charset) if (outsize1 != outsize2) { printf("\noutsize mismatch outsize1=%d outsize2=%d\n", - outsize1, outsize2); + (int)outsize1, (int)outsize2); ok = 0; } if (size_in1 != size_in2) { printf("\nsize_in mismatch size_in1=%d size_in2=%d\n", - size_in1, size_in2); + (int)size_in1, (int)size_in2); ok = 0; } if (!ok || len1 != len2 || memcmp(buf1, buf2, len1) != 0) { - printf("\nsize=%d ret1=%d ret2=%d\n", size, ret1, ret2); + printf("\nsize=%d ret1=%d ret2=%d\n", (int)size, (int)ret1, (int)ret2); show_buf(" IN1:", inbuf, size-size_in1); show_buf(" IN2:", inbuf, size-size_in2); show_buf("OUT1:", buf1, len1); @@ -248,7 +248,7 @@ static int test_buffer(uint8_t *inbuf, size_t size, const char *charset) if (outsize3 != sizeof(buf3) - size) { printf("wrong outsize3 - %d should be %d\n", - outsize3, sizeof(buf3) - size); + (int)outsize3, (int)(sizeof(buf3) - size)); ok = 0; } @@ -302,7 +302,7 @@ static int test_codepoint(unsigned int codepoint) if (size2 != size) { printf("next_codepoint(%u) gave wrong size %d (should be %d)\n", - codepoint, size2, size); + codepoint, (int)size2, (int)size); return 0; } diff --git a/source4/torture/local/idtree.c b/source4/torture/local/idtree.c index 94463cefa6..d4a81cb567 100644 --- a/source4/torture/local/idtree.c +++ b/source4/torture/local/idtree.c @@ -64,7 +64,7 @@ BOOL torture_local_idtree(void) if (p != NULL) { printf("non-present at %d gave %p (would be %d)\n", ii, p, - (((char *)p) - (char *)(&ids[0])) / sizeof(int)); + (int)(((char *)p) - (char *)(&ids[0])) / sizeof(int)); ret = False; } if (random() % 5) { diff --git a/source4/torture/local/socket.c b/source4/torture/local/socket.c index 8f8e10b3c5..ec0d3b1467 100644 --- a/source4/torture/local/socket.c +++ b/source4/torture/local/socket.c @@ -86,7 +86,7 @@ static BOOL test_udp(TALLOC_CTX *mem_ctx) ret = False; } if (nread != size) { - printf("Unexpected recvfrom size %d should be %d\n", nread, size); + printf("Unexpected recvfrom size %d should be %d\n", (int)nread, (int)size); ret = False; } @@ -107,7 +107,7 @@ static BOOL test_udp(TALLOC_CTX *mem_ctx) ret = False; } if (nread != size) { - printf("Unexpected recvfrom size %d should be %d\n", nread, size); + printf("Unexpected recvfrom size %d should be %d\n", (int)nread, (int)size); ret = False; } if (from_port != srv_port) { @@ -191,7 +191,7 @@ static BOOL test_tcp(TALLOC_CTX *mem_ctx) ret = False; } if (nread != size) { - printf("Unexpected recvfrom size %d should be %d\n", nread, size); + printf("Unexpected recvfrom size %d should be %d\n", (int)nread, (int)size); ret = False; } @@ -215,7 +215,7 @@ static BOOL test_tcp(TALLOC_CTX *mem_ctx) ret = False; } if (nread != size) { - printf("Unexpected recvfrom size %d should be %d\n", nread, size); + printf("Unexpected recvfrom size %d should be %d\n", (int)nread, (int)size); ret = False; } if (from_port != srv_port) { diff --git a/source4/torture/nbt/register.c b/source4/torture/nbt/register.c index 463783e1c9..bca9fbeef4 100644 --- a/source4/torture/nbt/register.c +++ b/source4/torture/nbt/register.c @@ -28,7 +28,7 @@ #define CHECK_VALUE(v, correct) do { \ if ((v) != (correct)) { \ printf("(%s) Incorrect value %s=%d - should be %d\n", \ - __location__, #v, v, correct); \ + __location__, #v, (int)v, (int)correct); \ ret = False; \ }} while (0) diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index e78227be16..457bcea7f9 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -96,7 +96,7 @@ static BOOL test_loadfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) if (io2.out.size != len) { printf("wrong length in returned data - %d should be %d\n", - io2.out.size, len); + io2.out.size, (int)len); return False; } @@ -187,7 +187,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) if (io2.out.size != len) { printf("wrong length in returned data - %d " "should be %d\n", - io2.out.size, len); + io2.out.size, (int)len); ret = False; continue; } diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index 4fb7bc9cde..5b094d722f 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -217,7 +217,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) CHECK_STATUS(status, NT_STATUS_INVALID_HANDLE); printf("create %d secondary security contexts on the same transport\n", - ARRAY_SIZE(sessions)); + (int)ARRAY_SIZE(sessions)); for (i=0; i transport->negotiate.sesskey; setups[i].in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ @@ -237,7 +237,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } printf("finishing %d secondary security contexts on the same transport\n", - ARRAY_SIZE(sessions)); + (int)ARRAY_SIZE(sessions)); for (i=0; i< ARRAY_SIZE(sessions); i++) { status = smb_composite_sesssetup_recv(composite_contexts[i]); CHECK_STATUS(status, NT_STATUS_OK); diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c index 9a1a8a1144..5f628fd9c8 100644 --- a/source4/torture/raw/qfileinfo.c +++ b/source4/torture/raw/qfileinfo.c @@ -584,8 +584,8 @@ BOOL torture_raw_qfileinfo(void) printf(" flags=%d %s=%*.*s\n", s1->all_eas.out.eas[i].flags, s1->all_eas.out.eas[i].name.s, - s1->all_eas.out.eas[i].value.length, - s1->all_eas.out.eas[i].value.length, + (int)s1->all_eas.out.eas[i].value.length, + (int)s1->all_eas.out.eas[i].value.length, s1->all_eas.out.eas[i].value.data); } } diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index 6753234af4..0d787ecf93 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -38,7 +38,7 @@ #define CHECK_VALUE(v, correct) do { \ if ((v) != (correct)) { \ printf("(%s) Incorrect value %s=%d - should be %d\n", \ - __location__, #v, v, correct); \ + __location__, #v, (int)v, (int)correct); \ ret = False; \ }} while (0) @@ -77,7 +77,7 @@ static BOOL check_stream(struct smbcli_state *cli, TALLOC_CTX *mem_ctx, ret = smbcli_read(cli->tree, fnum, buf, 0, strlen(value)+11); if (ret != strlen(value)) { printf("Failed to read %d bytes from stream '%s' - got %d\n", - strlen(value), full_name, ret); + strlen(value), full_name, (int)ret); return False; } diff --git a/source4/torture/rpc/autoidl.c b/source4/torture/rpc/autoidl.c index 3bf8f0e2c8..1a498311d8 100644 --- a/source4/torture/rpc/autoidl.c +++ b/source4/torture/rpc/autoidl.c @@ -216,7 +216,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_ta if (NT_STATUS_IS_OK(status)) { printf("opnum %d min_input %d - output %d\n", - opnum, stub_in.length, stub_out.length); + opnum, (int)stub_in.length, (int)stub_out.length); dump_data(0, stub_out.data, stub_out.length); talloc_free(p); test_ptr_scan(mem_ctx, iface, opnum, &stub_in, 0, stub_in.length, 0); @@ -229,7 +229,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_ta if (NT_STATUS_IS_OK(status)) { printf("opnum %d min_input %d - output %d (with handle)\n", - opnum, stub_in.length, stub_out.length); + opnum, (int)stub_in.length, (int)stub_out.length); dump_data(0, stub_out.data, stub_out.length); talloc_free(p); test_ptr_scan(mem_ctx, iface, opnum, &stub_in, 0, stub_in.length, 0); diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index 2e1e9d8740..988f94d904 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -865,7 +865,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam if (old->secret.length != lsa_blob_out.length) { printf("Returned secret %s doesn't match: %d != %d\n", - old->name, old->secret.length, lsa_blob_out.length); + old->name, (int)old->secret.length, (int)lsa_blob_out.length); ret = False; } else if (memcmp(lsa_blob_out.data, old->secret.data, old->secret.length) != 0) { @@ -905,7 +905,7 @@ static BOOL samsync_handle_secret(TALLOC_CTX *mem_ctx, struct samsync_state *sam if (new->secret.length != lsa_blob_out.length) { printf("Returned secret %s doesn't match: %d != %d\n", - new->name, new->secret.length, lsa_blob_out.length); + new->name, (int)new->secret.length, (int)lsa_blob_out.length); ret = False; } else if (memcmp(lsa_blob_out.data, new->secret.data, new->secret.length) != 0) { diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 87aba2060a..55ad143373 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -368,14 +368,14 @@ static BOOL rw_torture2(struct smbcli_state *c1, struct smbcli_state *c2) if ((bytes_written = smbcli_write(c1->tree, fnum1, 0, buf, 0, buf_size)) != buf_size) { printf("write failed (%s)\n", smbcli_errstr(c1->tree)); - printf("wrote %d, expected %d\n", bytes_written, buf_size); + printf("wrote %d, expected %d\n", (int)bytes_written, (int)buf_size); correct = False; break; } if ((bytes_read = smbcli_read(c2->tree, fnum2, buf_rd, 0, buf_size)) != buf_size) { printf("read failed (%s)\n", smbcli_errstr(c2->tree)); - printf("read %d, expected %d\n", bytes_read, buf_size); + printf("read %d, expected %d\n", (int)bytes_read, (int)buf_size); correct = False; break; } @@ -1933,7 +1933,7 @@ BOOL torture_ioctl_test(void) if (NT_STATUS_IS_OK(status)) { printf("ioctl device=0x%x function=0x%x OK : %d bytes\n", - device, function, parms.ioctl.out.blob.length); + device, function, (int)parms.ioctl.out.blob.length); } } } diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c index 753f36164f..176a8e101b 100644 --- a/source4/torture/torture_util.c +++ b/source4/torture/torture_util.c @@ -391,8 +391,8 @@ NTSTATUS torture_check_ea(struct smbcli_state *cli, printf("Expected value '%s' not '%*.*s' for ea %s\n", value, - info.ea_list.out.eas[0].value.length, - info.ea_list.out.eas[0].value.length, + (int)info.ea_list.out.eas[0].value.length, + (int)info.ea_list.out.eas[0].value.length, info.ea_list.out.eas[0].value.data, eaname); -- cgit