diff options
author | Dan Williams <dan@ioncontrol.co> | 2025-05-22 08:05:28 -0500 |
---|---|---|
committer | Dan Williams <dan@ioncontrol.co> | 2025-05-22 08:05:28 -0500 |
commit | 41ceaf6d5ecd85a7f88fc4ed9bdc80a6d2313d23 (patch) | |
tree | 251ec3f14f1d6b78ea880ab419c6531cd92be482 | |
parent | 847ce9ada5dfa1fecdbdcd4dc80a69d7b62bf324 (diff) | |
parent | 5888949fa3da666cd81e41ce305f4e137eddaf4a (diff) |
Merge request !1359 from 'cpms-spaces'
modem-helpers: handle spaces in +CPMS query response
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1359
Closes #990
-rw-r--r-- | src/mm-modem-helpers.c | 2 | ||||
-rw-r--r-- | src/tests/test-modem-helpers.c | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index f56fe5ac..926b1997 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -3335,7 +3335,7 @@ mm_3gpp_parse_cpms_test_response (const gchar *reply, * +CPMS: <memr>,<usedr>,<totalr>,<memw>,<usedw>,<totalw>, <mems>,<useds>,<totals> */ -#define CPMS_QUERY_REGEX "\\+CPMS:\\s*\"(?P<memr>.*)\",[0-9]+,[0-9]+,\"(?P<memw>.*)\",[0-9]+,[0-9]+,\"(?P<mems>.*)\",[0-9]+,[0-9]" +#define CPMS_QUERY_REGEX "\\+CPMS:\\s*\"(?P<memr>.*)\",\\s*[0-9]+,\\s*[0-9]+,\\s*\"(?P<memw>.*)\",\\s*[0-9]+,\\s*[0-9]+,\\s*\"(?P<mems>.*)\",\\s*[0-9]+,\\s*[0-9]" gboolean mm_3gpp_parse_cpms_query_response (const gchar *reply, diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c index 5ed5721d..a3a42ad8 100644 --- a/src/tests/test-modem-helpers.c +++ b/src/tests/test-modem-helpers.c @@ -3330,7 +3330,7 @@ CpmsQueryTest cpms_query_test[] = { {"+CPMS: \"SM\",100,100,\"SR\",5,10,\"TA\",1,100", 1, 4}, {"+CPMS: \"XX\",100,100,\"BM\",5,10,\"TA\",1,100", 0, 5}, {"+CPMS: \"XX\",100,100,\"YY\",5,10,\"TA\",1,100", 0, 0}, - {NULL, 0, 0} + {"+CPMS: \"MT\", 0, 100, \"MT\", 0, 100, \"MT\", 0, 100", 3, 3}, }; static void @@ -3339,13 +3339,14 @@ test_cpms_query_response (void *f, gpointer d) { MMSmsStorage mem2; gboolean ret; GError *error = NULL; - int i; + guint i; - for (i = 0; cpms_query_test[i].query != NULL; i++){ + for (i = 0; i < G_N_ELEMENTS (cpms_query_test); i++){ ret = mm_3gpp_parse_cpms_query_response (cpms_query_test[i].query, &mem1, &mem2, &error); + g_assert_no_error (error); g_assert (ret); g_assert_no_error (error); g_assert_cmpuint (cpms_query_test[i].mem1_want, ==, mem1); |