diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-04-17 15:54:22 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-04-17 15:54:22 +0200 |
commit | e739fe91cfdbb7c8a792c4bdc6c5f18603507fc6 (patch) | |
tree | d9fe5d46ef4ca3693f0cb5712b412b7972c5b8eb /source4/lib/registry/tests/registry.c | |
parent | ef457187b4372f039f84fbb4f6e4f0fcffd67b5b (diff) | |
download | samba-e739fe91cfdbb7c8a792c4bdc6c5f18603507fc6.tar.gz samba-e739fe91cfdbb7c8a792c4bdc6c5f18603507fc6.tar.bz2 samba-e739fe91cfdbb7c8a792c4bdc6c5f18603507fc6.zip |
Fix bug in registry test on big-endian machines.
Andrew Bartlett
(This used to be commit c74c67c38383b43efd707934e8c457b757e49db1)
Diffstat (limited to 'source4/lib/registry/tests/registry.c')
-rw-r--r-- | source4/lib/registry/tests/registry.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index ec7873a111..ac812823b2 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -281,7 +281,8 @@ static bool test_query_key_nums(struct torture_context *tctx, void *_data) struct registry_key *root, *subkey1, *subkey2; WERROR error; uint32_t num_subkeys, num_values; - uint32_t data = 42; + char data[4]; + SIVAL(data, 0, 42); if (!create_test_key(tctx, rctx, "Berlin", &root, &subkey1)) return false; @@ -353,13 +354,15 @@ static bool test_set_value(struct torture_context *tctx, void *_data) struct registry_context *rctx = (struct registry_context *)_data; struct registry_key *subkey = NULL, *root; WERROR error; - uint32_t data = 42; + char data[4]; + + SIVAL(data, 0, 42); if (!create_test_key(tctx, rctx, "Dusseldorf", &root, &subkey)) return false; error = reg_val_set(subkey, "Answer", REG_DWORD, - data_blob_talloc(tctx, &data, sizeof(data))); + data_blob_talloc(tctx, data, sizeof(data))); torture_assert_werr_ok (tctx, error, "setting value"); return true; @@ -408,8 +411,9 @@ static bool test_get_value(struct torture_context *tctx, void *_data) struct registry_key *subkey = NULL, *root; WERROR error; DATA_BLOB data; - uint32_t value = 42; + char value[4]; uint32_t type; + SIVAL(value, 0, 42); if (!create_test_key(tctx, rctx, "Duisburg", &root, &subkey)) return false; @@ -420,7 +424,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data) "getting missing value"); error = reg_val_set(subkey, __FUNCTION__, REG_DWORD, - data_blob_talloc(tctx, &value, 4)); + data_blob_talloc(tctx, value, sizeof(value))); torture_assert_werr_ok(tctx, error, "setting value"); error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type, @@ -428,7 +432,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data) torture_assert_werr_ok(tctx, error, "getting value"); torture_assert_int_equal(tctx, 4, data.length, "value length ok"); - torture_assert_mem_equal(tctx, data.data, &value, 4, + torture_assert_mem_equal(tctx, data.data, value, 4, "value content ok"); torture_assert_int_equal(tctx, REG_DWORD, type, "value type"); |