Fix pointer cast into int issue for 64 bit compatibility.
authorJunfeng Dong <junfeng.dong@intel.com>
Thu, 28 Mar 2013 10:07:38 +0000 (18:07 +0800)
committerlifang <fangx.li@intel.com>
Tue, 2 Apr 2013 14:50:27 +0000 (22:50 +0800)
Change-Id: Ic39eedc5cabfba69c3fa1006537aedc8e34fbcb3

client/ClientChannel.cpp
client/Reader.cpp
client/SEService.cpp
client/Session.cpp
common/include/Message.h
server/ServerDispatcher.cpp

index b74ba0f..8caf5f6 100644 (file)
@@ -73,8 +73,8 @@ namespace smartcard_service_api
 
                                /* send message to server */
                                msg.message = Message::MSG_REQUEST_CLOSE_CHANNEL;
-                               msg.param1 = (int)handle;
-                               msg.error = (unsigned int)context; /* using error to context */
+                               msg.param1 = (unsigned long)handle;
+                               msg.error = (unsigned long)context; /* using error to context */
                                msg.caller = (void *)this;
                                msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
 
@@ -122,13 +122,12 @@ namespace smartcard_service_api
                        if (getSession()->getReader()->isSecureElementPresent() == true)
                        {
                                Message msg;
-
                                channelNum = -1;
 
                                /* send message to server */
                                msg.message = Message::MSG_REQUEST_CLOSE_CHANNEL;
-                               msg.param1 = (int)handle;
-                               msg.error = (unsigned int)context; /* using error to context */
+                               msg.param1 = (unsigned long)handle;
+                               msg.error = (unsigned long)context; /* using error to context */
                                msg.caller = (void *)this;
                                msg.callback = (void *)callback;
                                msg.userParam = userParam;
@@ -156,7 +155,6 @@ namespace smartcard_service_api
                throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
        {
                int rv = -1;
-
                if (getSession()->getReader()->isSecureElementPresent() == true)
                {
                        Message msg;
@@ -164,10 +162,10 @@ namespace smartcard_service_api
 #ifdef CLIENT_IPC_THREAD
                        /* send message to server */
                        msg.message = Message::MSG_REQUEST_TRANSMIT;
-                       msg.param1 = (int)handle;
+                       msg.param1 = (unsigned long)handle;
                        msg.param2 = 0;
                        msg.data = command;
-                       msg.error = (unsigned int)context; /* using error to context */
+                       msg.error = (unsigned long)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
 
@@ -214,10 +212,10 @@ namespace smartcard_service_api
 
                        /* send message to server */
                        msg.message = Message::MSG_REQUEST_TRANSMIT;
-                       msg.param1 = (int)handle;
+                       msg.param1 = (unsigned long)handle;
                        msg.param2 = 0;
                        msg.data = command;
-                       msg.error = (unsigned int)context; /* using error to context */
+                       msg.error = (unsigned long)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)callback;
                        msg.userParam = userParam;
index 4382de9..51115d3 100644 (file)
@@ -100,8 +100,8 @@ namespace smartcard_service_api
 #ifdef CLIENT_IPC_THREAD
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_OPEN_SESSION;
-                       msg.param1 = (unsigned int)handle;
-                       msg.error = (unsigned int)context; /* using error to context */
+                       msg.param1 = (unsigned long)handle;
+                       msg.error = (unsigned long)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
 
@@ -141,8 +141,8 @@ namespace smartcard_service_api
 
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_OPEN_SESSION;
-                       msg.param1 = (unsigned int)handle;
-                       msg.error = (unsigned int)context; /* using error to context */
+                       msg.param1 = (unsigned long)handle;
+                       msg.error = (unsigned long)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)callback;
                        msg.userParam = userData;
index 2cb27e8..9950152 100644 (file)
@@ -114,7 +114,7 @@ namespace smartcard_service_api
                        Message msg;
 
                        msg.message = Message::MSG_REQUEST_SHUTDOWN;
-                       msg.error = (unsigned int)this; /* using error to context */
+                       msg.error = (unsigned long)this; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)NULL;
 
@@ -141,7 +141,7 @@ namespace smartcard_service_api
                        Message msg;
 
                        msg.message = Message::MSG_REQUEST_SHUTDOWN;
-                       msg.error = (unsigned int)this; /* using error to context */
+                       msg.error = (unsigned long)this; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
 
index 5bbe5a4..1a8b776 100644 (file)
@@ -79,7 +79,6 @@ namespace smartcard_service_api
        ByteArray Session::getATRSync() throw (ErrorIO &, ErrorIllegalState &)
        {
                ByteArray result;
-
                if (getReader()->isSecureElementPresent() == true)
                {
                        if (atr.isEmpty() == true)
@@ -90,8 +89,8 @@ namespace smartcard_service_api
 #ifdef CLIENT_IPC_THREAD
                                /* request channel handle from server */
                                msg.message = Message::MSG_REQUEST_GET_ATR;
-                               msg.param1 = (unsigned int)handle;
-                               msg.error = (unsigned int)context; /* using error to context */
+                               msg.param1 = (unsigned long)handle;
+                               msg.error = (unsigned long)context; /* using error to context */
                                msg.caller = (void *)this;
                                msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
 
@@ -132,10 +131,11 @@ namespace smartcard_service_api
                        {
                                Message msg;
 
-                               /* request channel handle from server */
+
+                       /* request channel handle from server */
                                msg.message = Message::MSG_REQUEST_GET_ATR;
-                               msg.param1 = (unsigned int)handle;
-                               msg.error = (unsigned int)context; /* using error to context */
+                               msg.param1 = (unsigned long)handle;
+                               msg.error = (unsigned long)context; /* using error to context */
                                msg.caller = (void *)this;
                                msg.callback = (void *)callback;
                                msg.userParam = userData;
@@ -172,8 +172,8 @@ namespace smartcard_service_api
 
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_CLOSE_SESSION;
-                       msg.param1 = (unsigned int)handle;
-                       msg.error = (unsigned int)context; /* using error to context */
+                       msg.param1 = (unsigned long)handle;
+                       msg.error = (unsigned long)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
 
@@ -208,8 +208,8 @@ namespace smartcard_service_api
 
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_CLOSE_SESSION;
-                       msg.param1 = (unsigned int)handle;
-                       msg.error = (unsigned int)context; /* using error to context */
+                       msg.param1 = (unsigned long)handle;
+                       msg.error = (unsigned long)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)callback;
                        msg.userParam = userData;
@@ -232,11 +232,12 @@ namespace smartcard_service_api
                        Message msg;
                        int rv;
 
+
 #ifdef CLIENT_IPC_THREAD
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_GET_CHANNEL_COUNT;
-                       msg.param1 = (unsigned int)handle;
-                       msg.error = (unsigned int)context; /* using error to context */
+                       msg.param1 = (unsigned long)handle;
+                       msg.error = (unsigned long)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
 
@@ -274,9 +275,10 @@ namespace smartcard_service_api
                {
                        Message msg;
 
+
                        msg.message = Message::MSG_REQUEST_GET_CHANNEL_COUNT;
-                       msg.param1 = (unsigned int)handle;
-                       msg.error = (unsigned int)context; /* using error to context */
+                       msg.param1 = (unsigned long)handle;
+                       msg.error = (unsigned long)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)callback;
                        msg.userParam = userData;
@@ -308,9 +310,9 @@ namespace smartcard_service_api
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_OPEN_CHANNEL;
                        msg.param1 = id;
-                       msg.param2 = (unsigned int)handle;
+                       msg.param2 = (unsigned long)handle;
                        msg.data = aid;
-                       msg.error = (unsigned int)context; /* using error to context */
+                       msg.error = (unsigned long)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)this; /* if callback is class instance, it means synchronized call */
 
@@ -349,9 +351,9 @@ namespace smartcard_service_api
                        /* request channel handle from server */
                        msg.message = Message::MSG_REQUEST_OPEN_CHANNEL;
                        msg.param1 = id;
-                       msg.param2 = (unsigned int)handle;
+                       msg.param2 = (unsigned long)handle;
                        msg.data = aid;
-                       msg.error = (unsigned int)context; /* using error to context */
+                       msg.error = (unsigned long)context; /* using error to context */
                        msg.caller = (void *)this;
                        msg.callback = (void *)callback;
                        msg.userParam = userData;
index a911800..2cdb2a4 100644 (file)
@@ -48,10 +48,10 @@ namespace smartcard_service_api
                static const int MSG_OPERATION_RELEASE_CLIENT = 0xC0;
 
                unsigned int message;
-               unsigned int param1;
-               unsigned int param2;
+               unsigned long param1;
+               unsigned long param2;
                ByteArray data;
-               int error;
+               long error;
                void *caller;
                void *callback;
                void *userParam;
index c502f8a..f3b3ecf 100644 (file)
@@ -101,11 +101,11 @@ namespace smartcard_service_api
                                        }
 
                                        /* create service */
-                                       if (resource->getService(socket, (unsigned int)msg->userParam) == NULL)
+                                       if (resource->getService(socket, (unsigned long)msg->userParam) == NULL)
                                        {
-                                               if (resource->createService(socket, (unsigned int)msg->userParam) == true)
+                                               if (resource->createService(socket, (unsigned long)msg->userParam) == true)
                                                {
-                                                       SCARD_DEBUG_ERR("client added : context [%d]", (unsigned int)msg->userParam);
+                                                       SCARD_DEBUG_ERR("client added : context [%d]", (unsigned long)msg->userParam);
                                                }
                                                else
                                                {