OSDN Git Service

Fix Const-Correctness for RIL_RadioFunctions
authorNathan Harold <nharold@google.com>
Tue, 1 Aug 2017 02:44:46 +0000 (19:44 -0700)
committerNathan Harold <nharold@google.com>
Tue, 1 Aug 2017 22:14:51 +0000 (15:14 -0700)
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

libril/RilSapSocket.cpp
libril/RilSapSocket.h
libril/ril.cpp
libril/sap_service.cpp
libril/sap_service.h
rild/rild.c

index 02db4ad..92b7a7b 100644 (file)
@@ -110,7 +110,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)) {
@@ -144,7 +144,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;
 
@@ -189,7 +189,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;
@@ -285,4 +285,4 @@ void RilSapSocket::onUnsolicitedResponse(int unsolResponse, void *data, size_t d
         sap::processUnsolResponse(&rsp, this);
         free(payload);
     }
-}
\ No newline at end of file
+}
index 1f6163e..4f6316c 100644 (file)
@@ -55,7 +55,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.
@@ -85,7 +85,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
@@ -153,7 +153,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.
@@ -173,7 +173,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
index ea9ca86..1451a56 100644 (file)
@@ -484,10 +484,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);
index 7bed05a..1f6fe54 100644 (file)
@@ -915,7 +915,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[] = {
index afed612..cb5ae10 100644 (file)
 
 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);
 
 }   // namespace android
 
-#endif  // RIL_SERVICE_H
\ No newline at end of file
+#endif  // RIL_SERVICE_H
index ce04040..d324692 100644 (file)
@@ -53,7 +53,7 @@ extern char ril_service_name[MAX_SERVICE_NAME_LENGTH];
 extern void RIL_register (const RIL_RadioFunctions *callbacks);
 extern void rilc_thread_pool ();
 
-extern void RIL_register_socket (RIL_RadioFunctions *(*rilUimInit)
+extern void RIL_register_socket (const RIL_RadioFunctions *(*rilUimInit)
         (const struct RIL_Env *, int, char **), RIL_SOCKET_TYPE socketType, int argc, char **argv);
 
 extern void RIL_onRequestComplete(RIL_Token t, RIL_Errno e,
@@ -153,7 +153,7 @@ int main(int argc, char **argv) {
     // Pointer to ril init function in vendor ril
     const RIL_RadioFunctions *(*rilInit)(const struct RIL_Env *, int, char **);
     // Pointer to sap init function in vendor ril
-    RIL_RadioFunctions *(*rilUimInit)(const struct RIL_Env *, int, char **);
+    const RIL_RadioFunctions *(*rilUimInit)(const struct RIL_Env *, int, char **);
     const char *err_str = NULL;
 
     // functions returned by ril init function in vendor ril
@@ -231,7 +231,7 @@ int main(int argc, char **argv) {
 
     dlerror(); // Clear any previous dlerror
     rilUimInit =
-        (RIL_RadioFunctions *(*)(const struct RIL_Env *, int, char **))
+        (const RIL_RadioFunctions *(*)(const struct RIL_Env *, int, char **))
         dlsym(dlHandle, "RIL_SAP_Init");
     err_str = dlerror();
     if (err_str) {