aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZiyan <jaraidaniel@gmail.com>2016-09-14 20:41:28 +0200
committerAndreas Blaesius <skate4life@gmx.de>2016-09-25 18:54:55 +0200
commit17cb6ef47b040cf8ec5d32b1f75bc2ff6ea86ad5 (patch)
tree8fea40aa84c2d649a078cd83e86ba2c61594648f
parent49de0338018bc67b82ef17ce17520c4b79b8948f (diff)
downloaddevice_samsung_espresso3g-17cb6ef47b040cf8ec5d32b1f75bc2ff6ea86ad5.zip
device_samsung_espresso3g-17cb6ef47b040cf8ec5d32b1f75bc2ff6ea86ad5.tar.gz
device_samsung_espresso3g-17cb6ef47b040cf8ec5d32b1f75bc2ff6ea86ad5.tar.bz2
libsecril-shim: update RIL_REQUEST_QUERY_AVAILABLE_NETWORKS fix
Our new ril blob is now sending one more extra unused qan element; let's remove that one as well. Change-Id: I1566aad2ab6123add3305003e0343fb9d5fb12f3
-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);