From: Junfeng Dong Date: Thu, 28 Mar 2013 10:07:38 +0000 (+0800) Subject: Fix pointer cast into int issue for 64 bit compatibility. X-Git-Tag: 2.1b_release~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67ff1f4c03429ede059c2db14305e54a6ff3a0b3;p=platform%2Fcore%2Fconnectivity%2Fsmartcard-service.git Fix pointer cast into int issue for 64 bit compatibility. Change-Id: Ic39eedc5cabfba69c3fa1006537aedc8e34fbcb3 --- diff --git a/client/ClientChannel.cpp b/client/ClientChannel.cpp index b74ba0f..8caf5f6 100644 --- a/client/ClientChannel.cpp +++ b/client/ClientChannel.cpp @@ -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; diff --git a/client/Reader.cpp b/client/Reader.cpp index 4382de9..51115d3 100644 --- a/client/Reader.cpp +++ b/client/Reader.cpp @@ -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; diff --git a/client/SEService.cpp b/client/SEService.cpp index 2cb27e8..9950152 100644 --- a/client/SEService.cpp +++ b/client/SEService.cpp @@ -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 */ diff --git a/client/Session.cpp b/client/Session.cpp index 5bbe5a4..1a8b776 100644 --- a/client/Session.cpp +++ b/client/Session.cpp @@ -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; diff --git a/common/include/Message.h b/common/include/Message.h index a911800..2cdb2a4 100644 --- a/common/include/Message.h +++ b/common/include/Message.h @@ -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; diff --git a/server/ServerDispatcher.cpp b/server/ServerDispatcher.cpp index c502f8a..f3b3ecf 100644 --- a/server/ServerDispatcher.cpp +++ b/server/ServerDispatcher.cpp @@ -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 {