From c38e96278a8ec1ccdff33e14a751bfcb8c3d63bf Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Mon, 29 Mar 2010 21:27:18 +0200 Subject: s4:registry/tests/generic.c - fix the DWORD_* types test to work also against big endian platforms --- source4/lib/registry/tests/generic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c index 206fad0d41..75b6c7ff26 100644 --- a/source4/lib/registry/tests/generic.c +++ b/source4/lib/registry/tests/generic.c @@ -62,8 +62,8 @@ static bool test_str_regtype(struct torture_context *ctx) static bool test_reg_val_data_string_dword(struct torture_context *ctx) { - uint32_t d = 0x20; - DATA_BLOB db = { (uint8_t *)&d, sizeof(d) }; + uint8_t d[] = { 0x20, 0x00, 0x00, 0x00 }; + DATA_BLOB db = { d, 4 }; torture_assert_str_equal(ctx, "0x00000020", reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_DWORD, db), "dword failed"); @@ -72,8 +72,8 @@ static bool test_reg_val_data_string_dword(struct torture_context *ctx) static bool test_reg_val_data_string_dword_big_endian(struct torture_context *ctx) { - uint32_t d = 0x20; - DATA_BLOB db = { (uint8_t *)&d, sizeof(d) }; + uint8_t d[] = { 0x20, 0x00, 0x00, 0x00 }; + DATA_BLOB db = { d, 4 }; torture_assert_str_equal(ctx, "0x00000020", reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_DWORD_BIG_ENDIAN, db), "dword failed"); @@ -82,8 +82,8 @@ static bool test_reg_val_data_string_dword_big_endian(struct torture_context *ct static bool test_reg_val_data_string_qword(struct torture_context *ctx) { - uint64_t d = 0x20; - DATA_BLOB db = { (uint8_t *)&d, sizeof(d) }; + uint8_t d[] = { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + DATA_BLOB db = { d, 8 }; torture_assert_str_equal(ctx, "0x0000000000000020", reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_QWORD, db), "qword failed"); -- cgit