From 98fa83a693c24002dc0087c4304ea1143b498d1f Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 19 May 2020 13:49:53 +0200 Subject: [PATCH] cinterion,tests: avoid cast-align errors We can safely cast the data in a GArray to gpointer first, and then to the pointer type we require. cinterion/tests/test-modem-helpers-cinterion.c: In function 'common_test_scfg': cinterion/tests/test-modem-helpers-cinterion.c:56:56: error: cast increases required alignment of target type [-Werror=cast-align] expected_bands_str = mm_common_build_bands_string ((const MMModemBand *)expected_bands->data, ^ cinterion/tests/test-modem-helpers-cinterion.c:58:47: error: cast increases required alignment of target type [-Werror=cast-align] bands_str = mm_common_build_bands_string ((const MMModemBand *)bands->data, ^ cinterion/tests/test-modem-helpers-cinterion.c: In function 'common_test_scfg_response': cinterion/tests/test-modem-helpers-cinterion.c:209:56: error: cast increases required alignment of target type [-Werror=cast-align] expected_bands_str = mm_common_build_bands_string ((const MMModemBand *)expected_bands->data, ^ cinterion/tests/test-modem-helpers-cinterion.c:211:47: error: cast increases required alignment of target type [-Werror=cast-align] bands_str = mm_common_build_bands_string ((const MMModemBand *)bands->data, ^ --- plugins/cinterion/tests/test-modem-helpers-cinterion.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/cinterion/tests/test-modem-helpers-cinterion.c b/plugins/cinterion/tests/test-modem-helpers-cinterion.c index 654368f9..ff21a921 100644 --- a/plugins/cinterion/tests/test-modem-helpers-cinterion.c +++ b/plugins/cinterion/tests/test-modem-helpers-cinterion.c @@ -53,9 +53,9 @@ common_test_scfg (const gchar *response, mm_common_bands_garray_sort (bands); mm_common_bands_garray_sort (expected_bands); - expected_bands_str = mm_common_build_bands_string ((const MMModemBand *)expected_bands->data, + expected_bands_str = mm_common_build_bands_string ((const MMModemBand *)(gconstpointer)expected_bands->data, expected_bands->len); - bands_str = mm_common_build_bands_string ((const MMModemBand *)bands->data, + bands_str = mm_common_build_bands_string ((const MMModemBand *)(gconstpointer)bands->data, bands->len); /* Instead of comparing the array one by one, compare the strings built from the mask @@ -206,9 +206,9 @@ common_test_scfg_response (const gchar *response, mm_common_bands_garray_sort (bands); mm_common_bands_garray_sort (expected_bands); - expected_bands_str = mm_common_build_bands_string ((const MMModemBand *)expected_bands->data, + expected_bands_str = mm_common_build_bands_string ((const MMModemBand *)(gconstpointer)expected_bands->data, expected_bands->len); - bands_str = mm_common_build_bands_string ((const MMModemBand *)bands->data, + bands_str = mm_common_build_bands_string ((const MMModemBand *)(gconstpointer)bands->data, bands->len); /* Instead of comparing the array one by one, compare the strings built from the mask