diff options
author | Jihoon Jung <jh8801.jung@samsung.com> | 2016-11-16 14:18:02 +0900 |
---|---|---|
committer | Jihoon Jung <jh8801.jung@samsung.com> | 2016-11-15 21:24:02 -0800 |
commit | f97f3c552c76bcd5ce17eb449b1f59c538095685 (patch) | |
tree | d423072acade9f75a4f824bb0305c1ad2bf36cd3 | |
parent | 3656f8d1cc47b3062c33dd181076bf280b43213e (diff) | |
download | smartcard-tizen_3.0.m2.tar.gz smartcard-tizen_3.0.m2.tar.bz2 smartcard-tizen_3.0.m2.zip |
Change some indent for Tizen 3.0 Coding rulesubmit/tizen_3.0/20161116.061842submit/tizen_3.0.m2/20170104.093749accepted/tizen/3.0/wearable/20161117.021944accepted/tizen/3.0/tv/20161117.021922accepted/tizen/3.0/mobile/20161117.021904accepted/tizen/3.0/ivi/20161117.022003accepted/tizen/3.0/common/20161117.090529accepted/tizen/3.0.m2/wearable/20170104.122758accepted/tizen/3.0.m2/tv/20170104.122410accepted/tizen/3.0.m2/mobile/20170104.121659tizen_3.0_tvtizen_3.0.m2accepted/tizen_3.0.m2_wearableaccepted/tizen_3.0.m2_tvaccepted/tizen_3.0.m2_mobile
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Change-Id: Id8ecfd79ee0aed0bcf61bcb0acf484a8f11eef7d
-rw-r--r-- | include/ClientChannel.h | 12 | ||||
-rwxr-xr-x | include/Reader.h | 8 | ||||
-rw-r--r-- | include/SEService.h | 4 | ||||
-rw-r--r-- | include/SEServiceListener.h | 2 | ||||
-rw-r--r-- | include/Session.h | 12 | ||||
-rw-r--r-- | src/ClientChannel.cpp | 32 | ||||
-rwxr-xr-x | src/ClientGDBus.cpp | 4 | ||||
-rw-r--r-- | src/Reader.cpp | 14 | ||||
-rwxr-xr-x | src/SEService.cpp | 61 | ||||
-rw-r--r-- | src/Session.cpp | 75 |
10 files changed, 79 insertions, 145 deletions
diff --git a/include/ClientChannel.h b/include/ClientChannel.h index a4e75ee..2e046f6 100644 --- a/include/ClientChannel.h +++ b/include/ClientChannel.h @@ -32,9 +32,9 @@ #ifdef __cplusplus namespace smartcard_service_api { - class ClientChannel: public Channel + class ClientChannel : public Channel { - private: +private: void *context; void *handle; void *proxy; @@ -48,11 +48,11 @@ namespace smartcard_service_api static void channel_close_cb(GObject *source_object, GAsyncResult *res, gpointer user_data); - public: +public: int close(closeChannelCallback callback, void *userParam); int transmit(const ByteArray &command, transmitCallback callback, void *userParam); - bool selectNext(){ return false; } + bool selectNext() { return false; } void closeSync() throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, @@ -61,7 +61,7 @@ namespace smartcard_service_api throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &); - void *getHandle(){ return handle; } + void *getHandle() { return handle; } friend class Session; }; @@ -75,7 +75,7 @@ extern "C" #endif /* __cplusplus */ int channel_is_basic_channel(channel_h handle, bool* is_basic_channel); -int channel_is_closed(channel_h handle, bool* is_closed ); +int channel_is_closed(channel_h handle, bool* is_closed); int channel_get_session(channel_h handle, int *session_handle); int channel_close_sync(channel_h handle); int channel_transmit_sync(channel_h handle, unsigned char *command, diff --git a/include/Reader.h b/include/Reader.h index 876d0b8..cfcfa1d 100755 --- a/include/Reader.h +++ b/include/Reader.h @@ -33,9 +33,9 @@ #ifdef __cplusplus namespace smartcard_service_api { - class Reader: public ReaderHelper + class Reader : public ReaderHelper { - private: +private: void *context; void *handle; void *proxy; @@ -47,7 +47,7 @@ namespace smartcard_service_api static void reader_open_session_cb(GObject *source_object, GAsyncResult *res, gpointer user_data); - public: +public: void closeSessions() throw(ErrorIO &, ErrorIllegalState &); @@ -56,7 +56,7 @@ namespace smartcard_service_api throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &); - void *getHandle(){ return handle; } + void *getHandle() { return handle; } friend class SEService; }; diff --git a/include/SEService.h b/include/SEService.h index e6aa87c..6a6351d 100644 --- a/include/SEService.h +++ b/include/SEService.h @@ -39,7 +39,7 @@ namespace smartcard_service_api class SEService : public SEServiceHelper { - private: +private: unsigned int handle; void *context; serviceConnected handler; @@ -80,7 +80,7 @@ namespace smartcard_service_api static void se_service_cb(GObject *source_object, GAsyncResult *res, gpointer user_data); - public: +public: SEService(void *user_data, serviceConnected handler) throw(ErrorIO &, ErrorIllegalParameter &); SEService(void *user_data, SEServiceListener *listener) diff --git a/include/SEServiceListener.h b/include/SEServiceListener.h index 9cfc01b..2cedf27 100644 --- a/include/SEServiceListener.h +++ b/include/SEServiceListener.h @@ -29,7 +29,7 @@ namespace smartcard_service_api class SEServiceListener { - public: +public: virtual void serviceConnected(SEServiceHelper *service, void *context) = 0; virtual void eventHandler(SEServiceHelper *service, diff --git a/include/Session.h b/include/Session.h index 7d530e3..59796fc 100644 --- a/include/Session.h +++ b/include/Session.h @@ -33,9 +33,9 @@ namespace smartcard_service_api { class Reader; - class Session : public SessionHelper + class Session:public SessionHelper { - private: +private: void *context; void *handle; void *proxy; @@ -44,7 +44,7 @@ namespace smartcard_service_api ~Session(); int openChannel(int id, const ByteArray &aid, openChannelCallback callback, void *userData); - + Channel *openChannelSync(int id, const ByteArray &aid) throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &); @@ -60,7 +60,7 @@ namespace smartcard_service_api static void session_close_cb(GObject *source_object, GAsyncResult *res, gpointer user_data); - public: +public: void closeChannels() throw(ErrorIO &, ErrorIllegalState &); @@ -94,7 +94,7 @@ namespace smartcard_service_api Channel *openLogicalChannelSync(const unsigned char *aid, unsigned int length) throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, - ErrorIllegalParameter &, ErrorSecurity &); + ErrorIllegalParameter &, ErrorSecurity &); Channel *openBasicChannelSync(const ByteArray &aid, unsigned char P2) throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, @@ -113,7 +113,7 @@ namespace smartcard_service_api ErrorIllegalParameter &, ErrorSecurity &); size_t getChannelCount() const; - void *getHandle(){ return handle; } + void *getHandle() { return handle; } friend class Reader; }; diff --git a/src/ClientChannel.cpp b/src/ClientChannel.cpp index c7e9dd4..b30e2e1 100644 --- a/src/ClientChannel.cpp +++ b/src/ClientChannel.cpp @@ -166,8 +166,7 @@ namespace smartcard_service_api { if (isClosed() == false) { - if (getSession()->getReader()->isSecureElementPresent() == true) - { + if (getSession()->getReader()->isSecureElementPresent() == true) { gint ret; GError *error = NULL; @@ -194,9 +193,7 @@ namespace smartcard_service_api throw ErrorIO(SCARD_ERROR_IPC_FAILED); } - } - else - { + } else { _INFO("unavailable channel"); } } @@ -206,10 +203,8 @@ namespace smartcard_service_api { int result = SCARD_ERROR_OK; - if (isClosed() == false) - { - if (getSession()->getReader()->isSecureElementPresent() == true) - { + if (isClosed() == false) { + if (getSession()->getReader()->isSecureElementPresent() == true) { CallbackParam *param = new CallbackParam(); param->instance = this; @@ -221,9 +216,7 @@ namespace smartcard_service_api GPOINTER_TO_UINT(context), GPOINTER_TO_UINT(handle), NULL, &ClientChannel::channel_close_cb, param); - } - else - { + } else { _ERR("unavailable channel"); result = SCARD_ERROR_ILLEGAL_STATE; } @@ -238,8 +231,7 @@ namespace smartcard_service_api { int rv = SCARD_ERROR_OK; - if (getSession()->getReader()->isSecureElementPresent() == true) - { + if (getSession()->getReader()->isSecureElementPresent() == true) { GVariant *var_command = NULL, *var_response = NULL; GError *error = NULL; @@ -251,7 +243,6 @@ namespace smartcard_service_api GPOINTER_TO_UINT(handle), var_command, &rv, &var_response, NULL, &error) == true) { - if (rv == SCARD_ERROR_OK) { GDBusHelper::convertVariantToByteArray(var_response, transmitResponse); result = transmitResponse; @@ -265,9 +256,7 @@ namespace smartcard_service_api throw ErrorIO(SCARD_ERROR_IPC_FAILED); } - } - else - { + } else { _ERR("unavailable channel"); throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE); } @@ -279,8 +268,7 @@ namespace smartcard_service_api { int result; - if (getSession()->getReader()->isSecureElementPresent() == true) - { + if (getSession()->getReader()->isSecureElementPresent() == true) { GVariant *var_command; CallbackParam *param = new CallbackParam(); @@ -298,9 +286,7 @@ namespace smartcard_service_api &ClientChannel::channel_transmit_cb, param); result = SCARD_ERROR_OK; - } - else - { + } else { _ERR("unavailable channel"); result = SCARD_ERROR_ILLEGAL_STATE; } diff --git a/src/ClientGDBus.cpp b/src/ClientGDBus.cpp index 8a3bb8b..8753572 100755 --- a/src/ClientGDBus.cpp +++ b/src/ClientGDBus.cpp @@ -28,7 +28,7 @@ using namespace std; /* below functions will be called when dlopen or dlclose is called */ -void __attribute__ ((constructor)) lib_init() +void __attribute__((constructor)) lib_init() { /* remove for deprecated-declarations build warning: glib ver > 2.36 */ #if !GLIB_CHECK_VERSION (2, 35, 0) @@ -36,7 +36,7 @@ void __attribute__ ((constructor)) lib_init() #endif } -void __attribute__ ((destructor)) lib_fini() +void __attribute__((destructor)) lib_fini() { } diff --git a/src/Reader.cpp b/src/Reader.cpp index 887d896..06857ed 100644 --- a/src/Reader.cpp +++ b/src/Reader.cpp @@ -96,8 +96,7 @@ namespace smartcard_service_api { Session *session = NULL; - if (isSecureElementPresent() == true) - { + if (isSecureElementPresent() == true) { gint result; GError *error = NULL; guint session_id; @@ -129,9 +128,7 @@ namespace smartcard_service_api THROW_ERROR(SCARD_ERROR_IPC_FAILED); } - } - else - { + } else { _ERR("unavailable reader"); throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE); } @@ -196,8 +193,7 @@ namespace smartcard_service_api _BEGIN(); - if (isSecureElementPresent() == true) - { + if (isSecureElementPresent() == true) { CallbackParam *param = new CallbackParam(); param->instance = this; @@ -211,9 +207,7 @@ namespace smartcard_service_api NULL, &Reader::reader_open_session_cb, param); result = SCARD_ERROR_OK; - } - else - { + } else { _ERR("unavailable reader"); result = SCARD_ERROR_ILLEGAL_STATE; } diff --git a/src/SEService.cpp b/src/SEService.cpp index 2c9baa4..a85bc22 100755 --- a/src/SEService.cpp +++ b/src/SEService.cpp @@ -118,26 +118,19 @@ namespace smartcard_service_api /* add readers */ reader = new Reader(service->context, reader_name, GUINT_TO_POINTER(reader_id)); - if (reader != NULL) - { + + if (reader != NULL) { service->readers.push_back(reader); - } - else - { + } else { _ERR("alloc failed"); } - if (service->listener != NULL) - { + if (service->listener != NULL) { service->listener->eventHandler(service, reader_name, 1, service->context); - } - else if (service->event_handler != NULL) - { + } else if (service->event_handler != NULL) { service->event_handler(reader_id, 1, service->context); - } - else - { + } else { _DBG("listener is null"); } } @@ -160,17 +153,12 @@ namespace smartcard_service_api } } - if (service->listener != NULL) - { + if (service->listener != NULL) { service->listener->eventHandler(service, reader_name, 2, service->context); - } - else if (service->event_handler != NULL) - { + } else if (service->event_handler != NULL) { service->event_handler(reader_id, 2, service->context); - } - else - { + } else { _DBG("listener is null"); } } @@ -346,14 +334,11 @@ namespace smartcard_service_api if(smartcard_service_se_service_call_se_service_sync( (SmartcardServiceSeService *)proxy, &result, &handle, &readers, NULL, &error) == true) { - if (result == SCARD_ERROR_OK) - { + if (result == SCARD_ERROR_OK) { service->connected = true; service->handle = handle; service->parseReaderInformation(readers); - } - else - { + } else { _ERR("Initialize error : %d", result); } } @@ -405,21 +390,15 @@ namespace smartcard_service_api /* request reader */ if(smartcard_service_se_service_call_se_service_sync( - (SmartcardServiceSeService *)proxy, &result, &handle, &readers, NULL, &error) == true) - { - if (result == SCARD_ERROR_OK) - { + (SmartcardServiceSeService *)proxy, &result, &handle, &readers, NULL, &error) == true) { + if (result == SCARD_ERROR_OK) { service->connected = true; service->handle = handle; service->parseReaderInformation(readers); - } - else - { + } else { throw ExceptionBase(result); } - } - else - { + } else { _ERR("smartcard_service_se_service_call_se_service failed, [%s]", error->message); g_error_free(error); @@ -671,8 +650,7 @@ EXTERN_API int se_service_get_readers(se_service_h handle, int **readers, int *c int temp = 0; temp_readers = service->getReaders(); - if(temp_readers.size() > 0) - { + if (temp_readers.size() > 0) { *readers = (int *)calloc(temp_readers.size(), sizeof(int)); if(*readers == NULL) @@ -683,16 +661,13 @@ EXTERN_API int se_service_get_readers(se_service_h handle, int **readers, int *c for (i = 0; i < temp_readers.size(); i++) { - if (temp_readers[i]->isSecureElementPresent()) - { + if (temp_readers[i]->isSecureElementPresent()) { (*readers)[i] = (long)temp_readers[i]; temp++; } } *count = temp; - } - else - { + } else { *count = 0; } diff --git a/src/Session.cpp b/src/Session.cpp index 75b48a6..5089a4b 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -82,7 +82,7 @@ namespace smartcard_service_api channels.clear(); } - void Session::closeChannels() throw (ErrorIO &, ErrorIllegalState &) + void Session::closeChannels() throw(ErrorIO &, ErrorIllegalState &) { size_t i; @@ -241,13 +241,12 @@ namespace smartcard_service_api } const ByteArray Session::getATRSync() - throw (ExceptionBase &, ErrorIO &, ErrorSecurity &, + throw(ExceptionBase &, ErrorIO &, ErrorSecurity &, ErrorIllegalState &, ErrorIllegalParameter &) { ByteArray result; - if (getReader()->isSecureElementPresent() == true) - { + if (getReader()->isSecureElementPresent() == true) { if (atr.isEmpty() == true) { gint ret; @@ -277,9 +276,7 @@ namespace smartcard_service_api } result = atr; - } - else - { + } else { _ERR("unavailable session"); throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE); } @@ -291,10 +288,8 @@ namespace smartcard_service_api { int result; - if (getReader()->isSecureElementPresent() == true) - { - if (atr.isEmpty() == true) - { + if (getReader()->isSecureElementPresent() == true) { + if (atr.isEmpty() == true) { CallbackParam *param = new CallbackParam(); param->instance = this; @@ -308,18 +303,14 @@ namespace smartcard_service_api &Session::session_get_atr_cb, param); result = SCARD_ERROR_OK; - } - else - { + } else { result = SCARD_ERROR_OK; /* TODO : invoke callback directly */ callback(atr.getBuffer(), atr.size(), 0, userData); } - } - else - { + } else { _ERR("unavailable session"); result = SCARD_ERROR_ILLEGAL_STATE; } @@ -328,7 +319,7 @@ namespace smartcard_service_api } void Session::closeSync() - throw (ExceptionBase &, ErrorIO &, ErrorSecurity &, + throw(ExceptionBase &, ErrorIO &, ErrorSecurity &, ErrorIllegalState &, ErrorIllegalParameter &) { if (isClosed() == false) @@ -389,12 +380,9 @@ namespace smartcard_service_api { size_t count = 0; - if (getReader()->isSecureElementPresent() == true) - { + if (getReader()->isSecureElementPresent() == true) { count = channels.size(); - } - else - { + } else { _ERR("unavailable session"); throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE); } @@ -402,20 +390,19 @@ namespace smartcard_service_api return count; } Channel *Session::openChannelSync(int id, const ByteArray &aid) - throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &, + throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) { return openChannelSync(id, aid, 0x00); } Channel *Session::openChannelSync(int id, const ByteArray &aid, unsigned char P2) - throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &, + throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) { Channel *channel = NULL; - if (getReader()->isSecureElementPresent() == true) - { + if (getReader()->isSecureElementPresent() == true) { gint ret; GVariant *var_aid = NULL, *var_response = NULL; guint channel_id; @@ -440,12 +427,9 @@ namespace smartcard_service_api channel = new ClientChannel(context, this, channel_number, response, GUINT_TO_POINTER(channel_id)); - if (channel != NULL) - { + if (channel != NULL) { channels.push_back(channel); - } - else - { + } else { _ERR("alloc failed"); THROW_ERROR(SCARD_ERROR_OUT_OF_MEMORY); @@ -461,9 +445,7 @@ namespace smartcard_service_api THROW_ERROR(SCARD_ERROR_IPC_FAILED); } - } - else - { + } else { _ERR("unavailable session"); throw ErrorIllegalState(SCARD_ERROR_UNAVAILABLE); @@ -476,8 +458,7 @@ namespace smartcard_service_api { int result; - if (getReader()->isSecureElementPresent() == true) - { + if (getReader()->isSecureElementPresent() == true) { GVariant *var_aid; CallbackParam *param = new CallbackParam(); @@ -496,9 +477,7 @@ namespace smartcard_service_api &Session::session_open_channel_cb, param); result = SCARD_ERROR_OK; - } - else - { + } else { _ERR("unavailable session"); result = SCARD_ERROR_ILLEGAL_STATE; } @@ -507,21 +486,21 @@ namespace smartcard_service_api } Channel *Session::openBasicChannelSync(const ByteArray &aid) - throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &, + throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) { return openChannelSync(0, aid, 0x00); } Channel *Session::openBasicChannelSync(const ByteArray &aid, unsigned char P2) - throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &, + throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) { return openChannelSync(0, aid, P2); } Channel *Session::openBasicChannelSync(const unsigned char *aid, unsigned int length) - throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &, + throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) { ByteArray temp(aid, length); @@ -530,7 +509,7 @@ namespace smartcard_service_api } Channel *Session::openBasicChannelSync(const unsigned char *aid, unsigned int length, unsigned char P2) - throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &, + throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) { ByteArray temp(aid, length); @@ -552,21 +531,21 @@ namespace smartcard_service_api } Channel *Session::openLogicalChannelSync(const ByteArray &aid) - throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &, + throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) { return openChannelSync(1, aid, 0x00); } Channel *Session::openLogicalChannelSync(const ByteArray &aid, unsigned char P2) - throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &, + throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) { return openChannelSync(1, aid, P2); } Channel *Session::openLogicalChannelSync(const unsigned char *aid, unsigned int length) - throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &, + throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) { ByteArray temp(aid, length); @@ -575,7 +554,7 @@ namespace smartcard_service_api } Channel *Session::openLogicalChannelSync(const unsigned char *aid, unsigned int length, unsigned char P2) - throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &, + throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) { ByteArray temp(aid, length); |