fix warning issue.
[platform/core/connectivity/smartcard-service.git] / client / ClientGDBus.cpp
old mode 100644 (file)
new mode 100755 (executable)
index 2eee1c5..8a3bb8b
  * limitations under the License.
  */
 
-#ifdef USE_GDBUS
 /* standard library header */
 #include <glib.h>
 
 /* SLP library header */
-#ifdef USER_SPACE_SMACK
-#include "security-server.h"
-#endif
 
 /* local header */
 #include "smartcard-types.h"
 
 using namespace std;
 
-namespace smartcard_service_api
+/* below functions will be called when dlopen or dlclose is called */
+void __attribute__ ((constructor)) lib_init()
 {
-       ByteArray ClientGDBus::cookie = ByteArray::EMPTY;
-
-       GVariant *ClientGDBus::getCookie()
-       {
-               GVariant *result;
-#ifdef USER_SPACE_SMACK
-               if (cookie.isEmpty()) {
-                       uint8_t *buffer;
-                       int len;
-
-                       len = security_server_get_cookie_size();
-                       if (len > 0) {
-                               buffer = new uint8_t[len];
-                               if (buffer != NULL) {
-                                       if (security_server_request_cookie(
-                                               (char *)buffer, len) == 0) {
-                                               cookie.assign(buffer, len);
-                                       } else {
-                                               _ERR("security_server_request_cookie failed");
-                                       }
-
-                                       delete[] buffer;
-                               } else {
-                                       _ERR("alloc failed");
-                               }
-                       } else {
-                               _ERR("security_server_get_cookie_size failed");
-                       }
-               }
+       /* remove for deprecated-declarations build warning: glib ver > 2.36 */
+#if !GLIB_CHECK_VERSION (2, 35, 0)
+       g_type_init();
 #endif
-               result = GDBusHelper::convertByteArrayToVariant(cookie);
+}
 
-               return result;
-       }
+void __attribute__ ((destructor)) lib_fini()
+{
+}
+
+namespace smartcard_service_api
+{
 } /* namespace smartcard_service_api */
-#endif