telit: minor coding style fixes
This commit is contained in:
@@ -26,9 +26,6 @@
|
||||
#include "mm-modem-helpers.h"
|
||||
#include "mm-modem-helpers-telit.h"
|
||||
|
||||
#define EMPTY_STRING ""
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* +CSIM response parser */
|
||||
|
||||
@@ -198,7 +195,7 @@ mm_telit_get_2g_mm_bands (GMatchInfo *match_info,
|
||||
|
||||
match_str = g_match_info_fetch_named (match_info, "Bands2G");
|
||||
|
||||
if (match_str == NULL || g_strcmp0(match_str, EMPTY_STRING) == 0) {
|
||||
if (match_str == NULL || match_str[0] == '\0') {
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Could not find 2G band flags from response");
|
||||
ret = FALSE;
|
||||
@@ -213,7 +210,9 @@ mm_telit_get_2g_mm_bands (GMatchInfo *match_info,
|
||||
}
|
||||
|
||||
for (i = 0; i < flags->len; i++) {
|
||||
guint flag = g_array_index (flags, guint, i);
|
||||
guint flag;
|
||||
|
||||
flag = g_array_index (flags, guint, i);
|
||||
if (!mm_telit_update_band_array (flag, map, bands, error)) {
|
||||
ret = FALSE;
|
||||
goto end;
|
||||
@@ -265,10 +264,9 @@ mm_telit_get_3g_mm_bands (GMatchInfo *match_info,
|
||||
{ BND_FLAG_UNKNOWN, {}},
|
||||
};
|
||||
|
||||
|
||||
match_str = g_match_info_fetch_named (match_info, "Bands3G");
|
||||
|
||||
if (match_str == NULL || g_strcmp0(match_str, EMPTY_STRING) == 0) {
|
||||
if (match_str == NULL || match_str[0] == '\0') {
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Could not find 3G band flags from response");
|
||||
ret = FALSE;
|
||||
@@ -283,7 +281,9 @@ mm_telit_get_3g_mm_bands (GMatchInfo *match_info,
|
||||
}
|
||||
|
||||
for (i = 0; i < flags->len; i++) {
|
||||
guint flag = g_array_index (flags, guint, i);
|
||||
guint flag;
|
||||
|
||||
flag = g_array_index (flags, guint, i);
|
||||
if (!mm_telit_update_band_array (flag, map, bands, error)) {
|
||||
ret = FALSE;
|
||||
goto end;
|
||||
@@ -311,12 +311,11 @@ mm_telit_get_4g_mm_bands(GMatchInfo *match_info,
|
||||
gchar *match_str = NULL;
|
||||
guint i;
|
||||
guint max_value;
|
||||
|
||||
gchar **tokens;
|
||||
|
||||
match_str = g_match_info_fetch_named (match_info, "Bands4G");
|
||||
|
||||
if (match_str == NULL || g_strcmp0(match_str, EMPTY_STRING) == 0) {
|
||||
if (match_str == NULL || match_str[0] == '\0') {
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Could not find 4G band flags from response");
|
||||
ret = FALSE;
|
||||
@@ -351,6 +350,7 @@ end:
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_telit_bands_contains (GArray *mm_bands, const MMModemBand mm_band)
|
||||
{
|
||||
@@ -403,7 +403,7 @@ mm_telit_get_band_flags_from_string (const gchar *flag_str,
|
||||
guint flag;
|
||||
guint i;
|
||||
|
||||
if (g_strcmp0(flag_str, "") == 0) {
|
||||
if (flag_str == NULL || flag_str[0] == '\0') {
|
||||
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"String is empty, no band flags to parse");
|
||||
return FALSE;
|
||||
@@ -443,6 +443,3 @@ mm_telit_get_band_flags_from_string (const gchar *flag_str,
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -137,8 +137,11 @@ test_parse_band_flag_str (void) {
|
||||
g_assert_true (res);
|
||||
|
||||
for (j = 0; j < band_flag_test[i].band_flags_len; j++) {
|
||||
guint ref = band_flag_test[i].band_flags[j];
|
||||
guint cur = g_array_index (band_flags, guint, j);
|
||||
guint ref;
|
||||
guint cur;
|
||||
|
||||
ref = band_flag_test[i].band_flags[j];
|
||||
cur = g_array_index (band_flags, guint, j);
|
||||
|
||||
g_assert_true (ref == cur);
|
||||
}
|
||||
@@ -221,8 +224,11 @@ test_parse_supported_bands_response (void) {
|
||||
|
||||
|
||||
for (j = 0; j < supported_band_mapping_tests[i].mm_bands_len; j++) {
|
||||
MMModemBand ref = supported_band_mapping_tests[i].mm_bands[j];
|
||||
MMModemBand cur = g_array_index (bands, MMModemBand, j);
|
||||
MMModemBand ref;
|
||||
MMModemBand cur;
|
||||
|
||||
ref = supported_band_mapping_tests[i].mm_bands[j];
|
||||
cur = g_array_index (bands, MMModemBand, j);
|
||||
g_assert_cmpint (cur, ==, ref);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user