From ea607878584cbd35bfd575f76e47641e42a855fd Mon Sep 17 00:00:00 2001 From: Nathan Harold Date: Mon, 31 Jul 2017 19:44:46 -0700 Subject: [PATCH] libril: Fix Const-Correctness for RIL_RadioFunctions Re-add constant for function pointer table to RIL_RadioFunctions. Const was accidentally removed during a warnings cleanup. Bug: 64231560 Test: compilation Change-Id: I93675980c51d9162f624495d12fe3c97f1da8031 --- ril/libril/RilSapSocket.cpp | 6 +++--- ril/libril/RilSapSocket.h | 8 ++++---- ril/libril/ril.cpp | 4 ++-- ril/libril/sap_service.cpp | 2 +- ril/libril/sap_service.h | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ril/libril/RilSapSocket.cpp b/ril/libril/RilSapSocket.cpp index cf99773c..f58d327b 100644 --- a/ril/libril/RilSapSocket.cpp +++ b/ril/libril/RilSapSocket.cpp @@ -112,7 +112,7 @@ RilSapSocket *RilSapSocket::getSocketById(RIL_SOCKET_ID socketId) { } void RilSapSocket::initSapSocket(const char *socketName, - RIL_RadioFunctions *uimFuncs) { + const RIL_RadioFunctions *uimFuncs) { if (strcmp(socketName, RIL1_SERVICE_NAME) == 0) { if(!SocketExists(socketName)) { @@ -146,7 +146,7 @@ void RilSapSocket::initSapSocket(const char *socketName, } void RilSapSocket::addSocketToList(const char *socketName, RIL_SOCKET_ID socketid, - RIL_RadioFunctions *uimFuncs) { + const RIL_RadioFunctions *uimFuncs) { RilSapSocket* socket = NULL; RilSapSocketList *current; @@ -191,7 +191,7 @@ bool RilSapSocket::SocketExists(const char *socketName) { RilSapSocket::RilSapSocket(const char *socketName, RIL_SOCKET_ID socketId, - RIL_RadioFunctions *inputUimFuncs): + const RIL_RadioFunctions *inputUimFuncs): RilSocket(socketName, socketId) { if (inputUimFuncs) { uimFuncs = inputUimFuncs; diff --git a/ril/libril/RilSapSocket.h b/ril/libril/RilSapSocket.h index 8c8c4bca..1a816c58 100644 --- a/ril/libril/RilSapSocket.h +++ b/ril/libril/RilSapSocket.h @@ -39,7 +39,7 @@ class RilSapSocket : public RilSocket { * Place holder for the radio functions returned by the initialization * function. Currenty only onRequest handler is being used. */ - RIL_RadioFunctions* uimFuncs; + const RIL_RadioFunctions* uimFuncs; /** * Wrapper struct for handling the requests in the queue. @@ -69,7 +69,7 @@ class RilSapSocket : public RilSocket { * @param Radio functions to be used by the socket. */ static void initSapSocket(const char *socketName, - RIL_RadioFunctions *uimFuncs); + const RIL_RadioFunctions *uimFuncs); /** * Ril envoronment variable that holds the request and @@ -137,7 +137,7 @@ class RilSapSocket : public RilSocket { * and add socket to the socket list. */ static void addSocketToList(const char *socketName, RIL_SOCKET_ID socketid, - RIL_RadioFunctions *uimFuncs); + const RIL_RadioFunctions *uimFuncs); /** * Check if a socket of the given name exists in the socket list. @@ -157,7 +157,7 @@ class RilSapSocket : public RilSocket { */ RilSapSocket(const char *socketName, RIL_SOCKET_ID socketId, - RIL_RadioFunctions *inputUimFuncs); + const RIL_RadioFunctions *inputUimFuncs); /** * Class method that selects the socket on which the onRequestComplete diff --git a/ril/libril/ril.cpp b/ril/libril/ril.cpp index a6cac4a1..78acd366 100644 --- a/ril/libril/ril.cpp +++ b/ril/libril/ril.cpp @@ -488,10 +488,10 @@ RIL_register (const RIL_RadioFunctions *callbacks) { } extern "C" void -RIL_register_socket (RIL_RadioFunctions *(*Init)(const struct RIL_Env *, int, char **), +RIL_register_socket (const RIL_RadioFunctions *(*Init)(const struct RIL_Env *, int, char **), RIL_SOCKET_TYPE socketType, int argc, char **argv) { - RIL_RadioFunctions* UimFuncs = NULL; + const RIL_RadioFunctions* UimFuncs = NULL; if(Init) { UimFuncs = Init(&RilSapSocket::uimRilEnv, argc, argv); diff --git a/ril/libril/sap_service.cpp b/ril/libril/sap_service.cpp index 254d0004..abfbfefe 100644 --- a/ril/libril/sap_service.cpp +++ b/ril/libril/sap_service.cpp @@ -914,7 +914,7 @@ void sap::processUnsolResponse(MsgHeader *rsp, RilSapSocket *sapSocket) { processResponse(rsp, sapSocket, MsgType_UNSOL_RESPONSE); } -void sap::registerService(RIL_RadioFunctions *callbacks) { +void sap::registerService(const RIL_RadioFunctions *callbacks) { using namespace android::hardware; int simCount = 1; const char *serviceNames[] = { diff --git a/ril/libril/sap_service.h b/ril/libril/sap_service.h index afed6126..4b9e3c64 100644 --- a/ril/libril/sap_service.h +++ b/ril/libril/sap_service.h @@ -24,7 +24,7 @@ namespace sap { -void registerService(RIL_RadioFunctions *callbacks); +void registerService(const RIL_RadioFunctions *callbacks); void processResponse(MsgHeader *rsp, RilSapSocket *sapSocket); void processUnsolResponse(MsgHeader *rsp, RilSapSocket *sapSocket);