aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/wavecom/mm-broadband-modem-wavecom.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/plugins/wavecom/mm-broadband-modem-wavecom.c b/plugins/wavecom/mm-broadband-modem-wavecom.c
index e6572df3..eb51ab04 100644
--- a/plugins/wavecom/mm-broadband-modem-wavecom.c
+++ b/plugins/wavecom/mm-broadband-modem-wavecom.c
@@ -555,27 +555,32 @@ load_supported_bands (MMIfaceModem *self,
/* We do assume that we already know if the modem is 2G-only, 3G-only or
* 2G+3G. This is checked quite before trying to load supported bands. */
+#define _g_array_insert_enum(array,index,type,val) do { \
+ type aux = (type)val; \
+ g_array_insert_val (array, index, aux); \
+ } while (0)
+
/* Add 3G-specific bands */
if (mm_iface_modem_is_3g (self)) {
bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 10);
- g_array_index (bands, MMModemBand, 0) = MM_MODEM_BAND_U2100;
- g_array_index (bands, MMModemBand, 1) = MM_MODEM_BAND_U1800;
- g_array_index (bands, MMModemBand, 2) = MM_MODEM_BAND_U17IV;
- g_array_index (bands, MMModemBand, 3) = MM_MODEM_BAND_U800;
- g_array_index (bands, MMModemBand, 4) = MM_MODEM_BAND_U850;
- g_array_index (bands, MMModemBand, 5) = MM_MODEM_BAND_U900;
- g_array_index (bands, MMModemBand, 6) = MM_MODEM_BAND_U900;
- g_array_index (bands, MMModemBand, 7) = MM_MODEM_BAND_U17IX;
- g_array_index (bands, MMModemBand, 8) = MM_MODEM_BAND_U1900;
- g_array_index (bands, MMModemBand, 9) = MM_MODEM_BAND_U2600;
+ _g_array_insert_enum (bands, 0, MMModemBand, MM_MODEM_BAND_U2100);
+ _g_array_insert_enum (bands, 1, MMModemBand, MM_MODEM_BAND_U1800);
+ _g_array_insert_enum (bands, 2, MMModemBand, MM_MODEM_BAND_U17IV);
+ _g_array_insert_enum (bands, 3, MMModemBand, MM_MODEM_BAND_U800);
+ _g_array_insert_enum (bands, 4, MMModemBand, MM_MODEM_BAND_U850);
+ _g_array_insert_enum (bands, 5, MMModemBand, MM_MODEM_BAND_U900);
+ _g_array_insert_enum (bands, 6, MMModemBand, MM_MODEM_BAND_U900);
+ _g_array_insert_enum (bands, 7, MMModemBand, MM_MODEM_BAND_U17IX);
+ _g_array_insert_enum (bands, 8, MMModemBand, MM_MODEM_BAND_U1900);
+ _g_array_insert_enum (bands, 9, MMModemBand, MM_MODEM_BAND_U2600);
}
/* Add 2G-specific bands */
else {
bands = g_array_sized_new (FALSE, FALSE, sizeof (MMModemBand), 4);
- g_array_index (bands, MMModemBand, 0) = MM_MODEM_BAND_EGSM;
- g_array_index (bands, MMModemBand, 1) = MM_MODEM_BAND_DCS;
- g_array_index (bands, MMModemBand, 2) = MM_MODEM_BAND_PCS;
- g_array_index (bands, MMModemBand, 3) = MM_MODEM_BAND_G850;
+ _g_array_insert_enum (bands, 0, MMModemBand, MM_MODEM_BAND_EGSM);
+ _g_array_insert_enum (bands, 1, MMModemBand, MM_MODEM_BAND_DCS);
+ _g_array_insert_enum (bands, 2, MMModemBand, MM_MODEM_BAND_PCS);
+ _g_array_insert_enum (bands, 3, MMModemBand, MM_MODEM_BAND_G850);
}
g_simple_async_result_set_op_res_gpointer (result,