aboutsummaryrefslogtreecommitdiffstats
path: root/rilsrc/libsecril-shim/secril-shim.c
diff options
context:
space:
mode:
Diffstat (limited to 'rilsrc/libsecril-shim/secril-shim.c')
-rw-r--r--rilsrc/libsecril-shim/secril-shim.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/rilsrc/libsecril-shim/secril-shim.c b/rilsrc/libsecril-shim/secril-shim.c
index ad22cee..5bc2fb2 100644
--- a/rilsrc/libsecril-shim/secril-shim.c
+++ b/rilsrc/libsecril-shim/secril-shim.c
@@ -122,20 +122,19 @@ static void fixupDataCallList(void *response, size_t responselen) {
static void onCompleteQueryAvailableNetworks(RIL_Token t, RIL_Errno e, void *response, size_t responselen) {
/* Response is a char **, pointing to an array of char *'s */
size_t numStrings = responselen / sizeof(char *);
- size_t numNeededStrings = numStrings - (numStrings / 5);
- size_t newResponseLen = numNeededStrings * sizeof(char *);
+ size_t newResponseLen = (numStrings - (numStrings / 3)) * sizeof(char *);
void *newResponse = malloc(newResponseLen);
- /* Remove every 5th string (qan element) */
+ /* Remove every 5th and 6th strings (qan elements) */
char **p_cur = (char **) response;
char **p_new = (char **) newResponse;
size_t i, j;
- for (i = 0, j = 0; i < numStrings; ++i) {
- if ((i + 1) % 5 != 0) {
- p_new[j] = p_cur[i];
- ++j;
- }
+ for (i = 0, j = 0; i < numStrings; i += 6) {
+ p_new[j++] = p_cur[i];
+ p_new[j++] = p_cur[i + 1];
+ p_new[j++] = p_cur[i + 2];
+ p_new[j++] = p_cur[i + 3];
}
/* Send the fixed response to libril */
@@ -204,7 +203,7 @@ static void onRequestCompleteShim(RIL_Token t, RIL_Errno e, void *response, size
}
break;
case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS:
- /* Remove the extra (unused) element from the operator info, freaking out the framework.
+ /* Remove the extra (unused) elements from the operator info, freaking out the framework.
* Formerly, this is know as the mQANElements override. */
if (response != NULL && responselen != 0 && (responselen % sizeof(char *) == 0)) {
onCompleteQueryAvailableNetworks(t, e, response, responselen);