Use nullptr instead of NULL 61/209261/1
authorJunghoon Park <jh9216.park@samsung.com>
Thu, 4 Jul 2019 06:01:45 +0000 (15:01 +0900)
committerJunghoon Park <jh9216.park@samsung.com>
Thu, 4 Jul 2019 06:01:45 +0000 (15:01 +0900)
Change-Id: I5610881895900d73004be948c12d0c8aa3025da5
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
watchface-complication-provider/complication-provider.cc
watchface-complication-provider/watchface-complication-provider.cc
watchface-complication/complication-connector-implementation.h
watchface-complication/complication.cc
watchface-complication/db-manager.cc
watchface-complication/editables-container.cc
watchface-complication/editables-manager.cc
watchface-complication/watchface-complication.cc
watchface-complication/watchface-editable.cc

index bda9709..f7b65ac 100644 (file)
@@ -223,7 +223,7 @@ void ComplicationProvider::Impl::OnSignal(GDBusConnection* connection,
     GVariant* parameters) {
   LOGI("%s, %s", sender_name.c_str(), signal_name.c_str());
   SenderInfo* si = GetSenderInfo(sender_name, connection, parameters);
-  if (si == NULL)
+  if (si == nullptr)
     return;
 
   if (si->GetPrivilegeResult() == COMPLICATION_CYNARA_DENIED) {
@@ -355,7 +355,7 @@ bool ComplicationProvider::SetupReplyToEditor(std::string editor_appid, int edit
       editor_appid,
       editor_appid, -1,
       util::GetCmdStr(util::CmdType::SetupReply),
-      g_variant_new("(is)", editable_id, raw == NULL ? "" : raw));
+      g_variant_new("(is)", editable_id, raw == nullptr ? "" : raw));
   } catch (Exception &ex) {
     LOGE("%s %d", ex.what(), ex.GetErrorCode());
   }
index 65d3de9..f802d9f 100644 (file)
@@ -139,7 +139,7 @@ extern "C" EXPORT_API int watchface_complication_provider_add_update_requested_c
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (provider_id == NULL || cb == NULL)
+  if (provider_id == nullptr || cb == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   std::string appid = DBManager::GetProviderAppId(provider_id);
@@ -181,7 +181,7 @@ extern "C" EXPORT_API int watchface_complication_provider_remove_update_requeste
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (provider_id == NULL || cb == NULL)
+  if (provider_id == nullptr || cb == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   auto cp = __providers.find(provider_id);
@@ -200,7 +200,7 @@ extern "C" EXPORT_API int watchface_complication_provider_notify_update(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (updated_provider_id == NULL)
+  if (updated_provider_id == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   auto cp = __providers.find(updated_provider_id);
@@ -232,11 +232,11 @@ extern "C" EXPORT_API int watchface_complication_provider_setup_reply_to_editor(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  char* editor_appid = NULL;
-  char* editable_id = NULL;
+  char* editor_appid = nullptr;
+  char* editable_id = nullptr;
   int ret;
   int str_len = 0;
-  bundle_raw* raw_data = NULL;
+  bundle_raw* raw_data = nullptr;
   bool emit_signal_ret = false;
 
   ret = app_control_get_extra_data(handle, SETUP_EDITOR_APPID_KEY,
@@ -277,13 +277,13 @@ extern "C" EXPORT_API int watchface_complication_provider_setup_reply_to_editor(
 
 extern "C" EXPORT_API int watchface_complication_provider_setup_is_editing(
     app_control_h handle, bool* is_editing) {
-  char* value = NULL;
+  char* value = nullptr;
   int ret;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || is_editing == NULL) {
+  if (handle == nullptr || is_editing == nullptr) {
     LOGE("Null parameter");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -304,14 +304,14 @@ extern "C" EXPORT_API int watchface_complication_provider_setup_is_editing(
 
 extern "C" EXPORT_API int watchface_complication_provider_setup_get_context(
     app_control_h handle, bundle** context) {
-  char* value = NULL;
-  bundle* data = NULL;
+  char* value = nullptr;
+  bundle* data = nullptr;
   int ret;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || context == NULL) {
+  if (handle == nullptr || context == nullptr) {
     LOGE("Null parameter");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -381,7 +381,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_type(
     bundle* shared_data, watchface_complication_type_e type) {
   char num_str[32] = {0, };
 
-  if (shared_data == NULL ||
+  if (shared_data == nullptr ||
     !util::CheckComplicationType(static_cast<int>(type))) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -399,7 +399,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_title(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (shared_data == NULL || title == NULL) {
+  if (shared_data == nullptr || title == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -426,7 +426,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_short_text(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (shared_data == NULL || text == NULL) {
+  if (shared_data == nullptr || text == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -452,7 +452,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_long_text(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (shared_data == NULL || text == NULL) {
+  if (shared_data == nullptr || text == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -477,7 +477,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_timestamp(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (shared_data == NULL) {
+  if (shared_data == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -502,7 +502,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_image_path(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (shared_data == NULL || image_path == NULL) {
+  if (shared_data == nullptr || image_path == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -528,7 +528,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_ranged_value(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (shared_data == NULL || min_value > max_value || current_value < min_value
+  if (shared_data == nullptr || min_value > max_value || current_value < min_value
       || current_value > max_value) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -568,7 +568,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_icon_path(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (shared_data == NULL || icon_path == NULL) {
+  if (shared_data == nullptr || icon_path == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -593,7 +593,7 @@ int watchface_complication_provider_data_set_extra_data(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (shared_data == NULL || extra_data == NULL) {
+  if (shared_data == nullptr || extra_data == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -607,7 +607,7 @@ int watchface_complication_provider_data_set_screen_reader_text(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (shared_data == NULL || screen_reader_text == NULL) {
+  if (shared_data == nullptr || screen_reader_text == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -620,7 +620,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_is_valid(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (shared_data == NULL || is_valid == NULL) {
+  if (shared_data == nullptr || is_valid == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -641,9 +641,9 @@ extern "C" EXPORT_API int watchface_complication_provider_data_is_valid(
 
 static int _get_value_from_touch_launch_data(app_control_h handle,
     const char* key, char** value) {
-  bundle* data = NULL;
-  char* bundle_str = NULL;
-  char* bundle_val = NULL;
+  bundle* data = nullptr;
+  char* bundle_str = nullptr;
+  char* bundle_val = nullptr;
   int ret;
 
   ret = app_control_get_extra_data(handle, TOUCH_LAUNCH_DATA_KEY, &bundle_str);
@@ -667,7 +667,7 @@ static int _get_value_from_touch_launch_data(app_control_h handle,
   }
 
   *value = strdup(bundle_val);
-  if (*value == NULL) {
+  if (*value == nullptr) {
     LOGE("Out of memory");
     bundle_free(data);
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
@@ -681,13 +681,13 @@ static int _get_value_from_touch_launch_data(app_control_h handle,
 extern "C" EXPORT_API int watchface_complication_provider_event_get_type(
     app_control_h handle, watchface_complication_event_type_e* event_type) {
   int ret;
-  char* value = NULL;
+  char* value = nullptr;
   bundle* data;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || event_type == NULL) {
+  if (handle == nullptr || event_type == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -717,7 +717,7 @@ extern "C" EXPORT_API int watchface_complication_provider_event_get_type(
   }
 
   *event_type = static_cast<watchface_complication_event_type_e>(
-                  strtol(value, NULL, 10));
+                  strtol(value, nullptr, 10));
   free(value);
 
   return WATCHFACE_COMPLICATION_ERROR_NONE;
@@ -727,12 +727,12 @@ extern "C" EXPORT_API
 int watchface_complication_provider_event_get_provider_id(
     app_control_h handle, char** provider_id) {
   int ret;
-  char* value = NULL;
+  char* value = nullptr;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || provider_id == NULL) {
+  if (handle == nullptr || provider_id == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -751,12 +751,12 @@ extern "C" EXPORT_API
 int watchface_complication_provider_event_get_complication_type(
     app_control_h handle, watchface_complication_type_e* type) {
   int ret;
-  char* value = NULL;
+  char* value = nullptr;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || type == NULL) {
+  if (handle == nullptr || type == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -766,7 +766,7 @@ int watchface_complication_provider_event_get_complication_type(
   if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
     return ret;
 
-  int comp_type = strtol(value, NULL, 10);
+  int comp_type = strtol(value, nullptr, 10);
   if (!util::CheckComplicationType(comp_type)) {
     LOGE("Invalid param");
     free(value);
@@ -782,13 +782,13 @@ extern "C" EXPORT_API
 int watchface_complication_provider_event_get_context(
     app_control_h handle, bundle** context) {
   int ret;
-  char* value = NULL;
-  bundle* ctx_data = NULL;
+  char* value = nullptr;
+  bundle* ctx_data = nullptr;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || context == NULL) {
+  if (handle == nullptr || context == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -801,7 +801,7 @@ int watchface_complication_provider_event_get_context(
   ctx_data = bundle_decode(reinterpret_cast<const bundle_raw*>(value),
     strlen(value));
   free(value);
-  if (ctx_data == NULL) {
+  if (ctx_data == nullptr) {
     LOGE("Cannot convert value to bundle !!");
     return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
   }
index a6a805f..29e1bd0 100644 (file)
@@ -50,7 +50,7 @@ class ComplicationConnector::Impl {
   Impl();
   static int PackageAppinfoCallback(const pkgmgrinfo_appinfo_h handle,
       void* user_data) {
-    char* appid = NULL;
+    char* appid = nullptr;
     int ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
     if (ret < 0) {
       LOGE("Failed to get appid");
@@ -76,7 +76,7 @@ class ComplicationConnector::Impl {
       return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
     }
     ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle,
-        PackageAppinfoCallback, NULL);
+        PackageAppinfoCallback, nullptr);
     if (ret != PMINFO_R_OK) {
       LOGE("foreach failed [%d]", ret);
       pkgmgrinfo_appinfo_filter_destroy(handle);
@@ -121,8 +121,8 @@ class ComplicationConnector::Impl {
   }
 
  private:
-  GDBusConnection* conn_ = NULL;
-  pkgmgr_client* pkgmgr_client_ = NULL;
+  GDBusConnection* conn_ = nullptr;
+  pkgmgr_client* pkgmgr_client_ = nullptr;
   std::string appid_;
 
  private:
index 10a3f79..d0320dd 100644 (file)
@@ -751,7 +751,7 @@ std::unique_ptr<Bundle>& Complication::GetContext() const {
 }
 
 int Complication::UpdateLastContext() {
-  if (impl_->context_data_.get() == NULL) {
+  if (impl_->context_data_.get() == nullptr) {
     LOGI("Empty context");
     return WATCHFACE_COMPLICATION_ERROR_NONE;
   }
index 82e991d..2dc584d 100644 (file)
@@ -44,16 +44,16 @@ DBManager::~DBManager() = default;
 sqlite3* DBManager::OpenDB() {
   int ret;
   const char* path;
-  sqlite3* db = NULL;
+  sqlite3* db = nullptr;
 
   path = GetParserDataPath();
-  if (path == NULL)
-    return NULL;
+  if (path == nullptr)
+    return nullptr;
 
-  ret = sqlite3_open_v2(path, &db, SQLITE_OPEN_READONLY, NULL);
+  ret = sqlite3_open_v2(path, &db, SQLITE_OPEN_READONLY, nullptr);
   if (ret != SQLITE_OK) {
     LOGE("open db(%s) error: %d", path, ret);
-    return NULL;
+    return nullptr;
   }
 
   return db;
@@ -84,12 +84,12 @@ std::unique_ptr<Bundle> DBManager::GetDefaultData(const char* provider_id,
     "WHERE provider_id=? AND support_type=?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return nullptr;
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return nullptr;
@@ -145,7 +145,7 @@ out:
 }
 
 int DBManager::GetProviderPeriod(std::string& provider_id, int* period) {
-  sqlite3_stmt* stmt = NULL;
+  sqlite3_stmt* stmt = nullptr;
   sqlite3* db;
   int ret;
 
@@ -153,12 +153,12 @@ int DBManager::GetProviderPeriod(std::string& provider_id, int* period) {
     "SELECT period FROM complication_provider WHERE provider_id=?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return WATCHFACE_COMPLICATION_ERROR_DB;
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return WATCHFACE_COMPLICATION_ERROR_DB;
@@ -185,7 +185,7 @@ int DBManager::GetProviderPeriod(std::string& provider_id, int* period) {
 }
 
 bool DBManager::IsProviderExist(std::string& provider_id, int support_type) {
-  sqlite3_stmt* stmt = NULL;
+  sqlite3_stmt* stmt = nullptr;
   sqlite3* db;
   bool is_exist = false;
   int trusted;
@@ -197,12 +197,12 @@ bool DBManager::IsProviderExist(std::string& provider_id, int support_type) {
     "WHERE provider_id=? AND support_type=?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return false;
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return false;
@@ -249,7 +249,7 @@ bool DBManager::IsProviderExist(std::string& provider_id, int support_type) {
 }
 
 std::string DBManager::GetProviderAppId(const char* provider_id) {
-  sqlite3_stmt* stmt = NULL;
+  sqlite3_stmt* stmt = nullptr;
   sqlite3* db;
   int trusted;
   std::string provider_app_id;
@@ -259,12 +259,12 @@ std::string DBManager::GetProviderAppId(const char* provider_id) {
     "SELECT trusted, appid FROM complication_provider WHERE provider_id=?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return std::string();
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return std::string();
@@ -308,7 +308,7 @@ DBManager::GetProviderListWithTypes(int supported_types) {
   const char* provider_id;
   int type = 0;
   sqlite3_stmt* stmt;
-  sqlite3* db = NULL;
+  sqlite3* db = nullptr;
   std::list<std::unique_ptr<DBManager::ProviderInfo>> provider_list;
   int trusted;
   std::string provider_app_id;
@@ -319,12 +319,12 @@ DBManager::GetProviderListWithTypes(int supported_types) {
     "WHERE (support_type & ?) > 0";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return provider_list;
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return provider_list;
@@ -379,12 +379,12 @@ std::list<std::string> DBManager::GetProviderListWithAppId(
     "SELECT DISTINCT provider_id FROM complication_provider WHERE appid=?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return provider_list;
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return provider_list;
@@ -426,12 +426,12 @@ int DBManager::GetSupportTypes(std::string& provider_id, int* types) {
       "WHERE provider_id = ?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return WATCHFACE_COMPLICATION_ERROR_DB;
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return WATCHFACE_COMPLICATION_ERROR_DB;
@@ -482,12 +482,12 @@ std::list<std::string> DBManager::GetRequiredPrivilegeList(
     "SELECT DISTINCT privilege FROM provider_privilege WHERE provider_id=?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return privlege_list;
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return privlege_list;
@@ -533,12 +533,12 @@ int DBManager::GetRequiredSupportEvents(
     "SELECT support_events FROM provider_support_events WHERE provider_id=?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return -1;
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return -1;
@@ -568,27 +568,27 @@ char* DBManager::GetSystemLocale() {
   char* tmp;
 
   lang = vconf_get_str(VCONFKEY_LANGSET);
-  if (lang == NULL) {
+  if (lang == nullptr) {
     locale = strdup(DEFAULT_LOCALE);
-    if (locale == NULL) {
+    if (locale == nullptr) {
       LOGE("out of memory");
-      return NULL;
+      return nullptr;
     }
     return locale;
   }
 
   tmp = strtok_r(lang, ".", &ptr);
-  if (tmp == NULL) {
+  if (tmp == nullptr) {
     LOGE("failed to get language");
     free(lang);
-    return NULL;
+    return nullptr;
   }
 
   locale = strdup(tmp);
-  if (locale == NULL) {
+  if (locale == nullptr) {
     LOGE("out of memory");
     free(lang);
-    return NULL;
+    return nullptr;
   }
 
   for (int i = 0; i < static_cast<int>(strlen(locale)); i++) {
@@ -609,7 +609,7 @@ std::string DBManager::GetLabel(const char* provider_id) {
   sqlite3_stmt *stmt;
   sqlite3* db;
   const char* lb;
-  char* locale = NULL;
+  char* locale = nullptr;
   int ret;
 
   static const char query[] =
@@ -617,19 +617,19 @@ std::string DBManager::GetLabel(const char* provider_id) {
     "WHERE provider_id=? AND locale=?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return std::string();
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return std::string();
   }
 
   locale = GetSystemLocale();
-  if (locale == NULL) {
+  if (locale == nullptr) {
     sqlite3_finalize(stmt);
     CloseDB(db);
     return std::string();
@@ -696,12 +696,12 @@ std::string DBManager::GetSetupAppId(const char* provider_id) {
     "SELECT DISTINCT setup_appid FROM provider_setup_appid WHERE provider_id=?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return std::string();
   }
 
-  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
+  if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, nullptr) != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
     return std::string();
@@ -767,13 +767,13 @@ int DBManager::GetTrustedInfo(std::string& provider_id, bool* trusted) {
       "SELECT trusted FROM complication_provider WHERE provider_id = ?";
 
   db = OpenDB();
-  if (db == NULL) {
+  if (db == nullptr) {
     LOGE("parser db not exist");
     return WATCHFACE_COMPLICATION_ERROR_DB;
   }
 
   ret = sqlite3_prepare_v2(db, query, strlen(query),
-                        &stmt, NULL);
+                        &stmt, nullptr);
   if (ret != SQLITE_OK) {
     LOGE("prepare error: %s", sqlite3_errmsg(db));
     CloseDB(db);
index 285513d..2c3fe5d 100644 (file)
@@ -68,7 +68,7 @@ void EditablesContainer::Impl::OnSignal(GDBusConnection* connection,
                                         const std::string& interface_name,
                                         const std::string& signal_name,
                                         GVariant* parameters) {
-  char* editor_id = NULL;
+  char* editor_id = nullptr;
   std::shared_ptr<const Bundle> updated_data;
 
   LOGI("signal_name: %s ,%s", signal_name.c_str(), sender_name.c_str());
@@ -158,7 +158,7 @@ void EditablesContainer::Impl::CancelEditing() {
     if (i.get()->GetState() != IEditable::Complete) {
       i.get()->SetState(IEditable::Cancel);
       i.get()->SetCurDataIdx(i.get()->GetLastDataIdx());
-      if (i.get()->GetLastContext().get() != NULL) {
+      if (i.get()->GetLastContext().get() != nullptr) {
         i.get()->SetContext(std::unique_ptr<Bundle>(
             new Bundle(i.get()->GetLastContext().get()->GetHandle())));
       } else {
index 8734a79..3a73975 100644 (file)
@@ -79,13 +79,13 @@ int EditablesManager::Init() {
 
   LOGI("db path : %s", db_path.c_str());
   ret = sqlite3_open_v2(db_path.c_str(), &tmp_impl->setting_db_, open_flags,
-                        NULL);
+                        nullptr);
   if (ret != SQLITE_OK) {
     LOGE("database creation failed with error: %d", ret);
     return WATCHFACE_COMPLICATION_ERROR_DB;
   }
   ret = sqlite3_exec(tmp_impl->setting_db_, setting_table_command.c_str(),
-      NULL, NULL, NULL);
+      nullptr, nullptr, nullptr);
   if (ret != SQLITE_OK) {
     sqlite3_close_v2(tmp_impl->setting_db_);
     LOGE("database setting table creation failed: %d", ret);
@@ -93,14 +93,14 @@ int EditablesManager::Init() {
   }
 
   ret = sqlite3_open_v2(db_path.c_str(), &tmp_impl->context_db_, open_flags,
-                        NULL);
+                        nullptr);
   if (ret != SQLITE_OK) {
     sqlite3_close_v2(tmp_impl->setting_db_);
     LOGE("database creation failed with error: %d", ret);
     return WATCHFACE_COMPLICATION_ERROR_DB;
   }
   ret = sqlite3_exec(tmp_impl->context_db_, context_table_command.c_str(),
-      NULL, NULL, NULL);
+      nullptr, nullptr, nullptr);
   if (ret != SQLITE_OK) {
     sqlite3_close_v2(tmp_impl->setting_db_);
     sqlite3_close_v2(tmp_impl->context_db_);
@@ -114,9 +114,9 @@ int EditablesManager::Init() {
 
 int EditablesManager::StoreSetting(int editable_id, bundle_raw* raw_data) {
   char query[QUERY_MAXLEN] = {0, };
-  char* error = NULL;
+  char* error = nullptr;
 
-  if (impl_->setting_db_ == NULL) {
+  if (impl_->setting_db_ == nullptr) {
     LOGE("DB is not initialized.");
     return -1;
   }
@@ -124,7 +124,7 @@ int EditablesManager::StoreSetting(int editable_id, bundle_raw* raw_data) {
   sqlite3_snprintf(QUERY_MAXLEN, query,
       "INSERT OR REPLACE INTO editable_setting(editable_id, setting_data) " \
       "VALUES (%d, %Q)", editable_id, raw_data);
-  if (sqlite3_exec(impl_->setting_db_, query, NULL, NULL, &error) != SQLITE_OK) {
+  if (sqlite3_exec(impl_->setting_db_, query, nullptr, nullptr, &error) != SQLITE_OK) {
     LOGE("sqlite3_exec error(editable_id %d, error = %s)", editable_id, error);
     sqlite3_free(error);
     return WATCHFACE_COMPLICATION_ERROR_DB;
@@ -139,7 +139,7 @@ std::unique_ptr<Bundle> EditablesManager::LoadSetting(int editable_id) {
   sqlite3_stmt* stmt;
   int ret;
 
-  if (impl_->setting_db_ == NULL) {
+  if (impl_->setting_db_ == nullptr) {
     return nullptr;
   }
 
@@ -147,7 +147,7 @@ std::unique_ptr<Bundle> EditablesManager::LoadSetting(int editable_id) {
       "SELECT setting_data FROM editable_setting WHERE " \
       "editable_id = %d ", editable_id);
   ret = sqlite3_prepare_v2(impl_->setting_db_,
-      query, strlen(query), &stmt, NULL);
+      query, strlen(query), &stmt, nullptr);
   if (ret != SQLITE_OK) {
     LOGE("sqlite3_prepare_v2 failed (editable_id : %d, error = %s)",
         editable_id, sqlite3_errmsg(impl_->setting_db_));
@@ -200,7 +200,7 @@ std::unique_ptr<Bundle> EditablesManager::LoadContext(int editable_id,
   const char* raw_data;
   sqlite3_stmt* stmt;
 
-  if (impl_->context_db_ == NULL) {
+  if (impl_->context_db_ == nullptr) {
     return nullptr;
   }
 
@@ -208,7 +208,7 @@ std::unique_ptr<Bundle> EditablesManager::LoadContext(int editable_id,
       "SELECT context_data FROM editable_context WHERE " \
       "editable_id = %d AND provider_id = %Q ", editable_id, provider_id);
   LOGI("editable context select sql : %s", query);
-  if (sqlite3_prepare_v2(impl_->context_db_, query, strlen(query), &stmt, NULL)
+  if (sqlite3_prepare_v2(impl_->context_db_, query, strlen(query), &stmt, nullptr)
       != SQLITE_OK) {
     LOGE("sqlite3_prepare fail %s", sqlite3_errmsg(impl_->context_db_));
     sqlite3_close_v2(impl_->context_db_);
@@ -237,7 +237,7 @@ int EditablesManager::DeleteContext(int editable_id,
   sqlite3_stmt* stmt;
   int ret;
 
-  if (impl_->context_db_ == NULL)
+  if (impl_->context_db_ == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_DB;
 
   sqlite3_snprintf(QUERY_MAXLEN, query,
@@ -245,7 +245,7 @@ int EditablesManager::DeleteContext(int editable_id,
       "editable_id = %d AND provider_id = %Q ", editable_id, provider_id);
   LOGI("editable context delete : (%d)(%s)", editable_id, provider_id);
   ret = sqlite3_prepare_v2(impl_->context_db_, query, strlen(query), &stmt,
-      NULL);
+      nullptr);
   if (ret != SQLITE_OK) {
     LOGE("sqlite3_prepare fail %s", sqlite3_errmsg(impl_->context_db_));
     sqlite3_close_v2(impl_->context_db_);
index 415634f..25168e7 100644 (file)
@@ -78,7 +78,7 @@ class CallbackInfo {
               ComplicationType type, const std::unique_ptr<Bundle>& data) {
     cb_(complication_id,
         provider_id.c_str(), static_cast<watchface_complication_type_e>(type),
-        data.get() == NULL ? NULL : data.get()->GetHandle(), user_data_);
+        data.get() == nullptr ? nullptr : data.get()->GetHandle(), user_data_);
   }
 
   void InvokeErrorCallback(int complication_id,
@@ -183,7 +183,7 @@ extern "C" EXPORT_API int watchface_complication_add_updated_cb(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || cb == NULL || error_cb == NULL)
+  if (handle == nullptr || cb == nullptr || error_cb == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   static cynara_result pcr = COMPLICATION_CYNARA_UNKNOWN;
@@ -209,7 +209,7 @@ extern "C" EXPORT_API int watchface_complication_remove_updated_cb(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || cb == NULL)
+  if (handle == nullptr || cb == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
@@ -223,7 +223,7 @@ extern "C" EXPORT_API int watchface_complication_send_update_request(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL)
+  if (handle == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   LOGI("update call!!");
@@ -265,12 +265,12 @@ extern "C" EXPORT_API int watchface_complication_create(int complication_id,
   }
 
   if (default_type != WATCHFACE_COMPLICATION_TYPE_NO_DATA
-       && default_provider_id == NULL) {
+       && default_provider_id == nullptr) {
       LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
 
-  if (created_handle == NULL)
+  if (created_handle == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   try {
@@ -300,7 +300,7 @@ extern "C" EXPORT_API int watchface_complication_destroy(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL)
+  if (handle == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
@@ -314,7 +314,7 @@ extern "C" EXPORT_API int watchface_complication_get_current_provider_id(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || cur_provider_id == NULL)
+  if (handle == nullptr || cur_provider_id == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   char* tmp;
@@ -325,7 +325,7 @@ extern "C" EXPORT_API int watchface_complication_get_current_provider_id(
 
   LOGI("provider id : %s", ptr.get()->GetCurProviderId().c_str());
   tmp = strdup(ptr.get()->GetCurProviderId().c_str());
-  if (tmp == NULL)
+  if (tmp == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
 
   *cur_provider_id = tmp;
@@ -338,7 +338,7 @@ extern "C" EXPORT_API int watchface_complication_get_current_type(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || cur_type == NULL)
+  if (handle == nullptr || cur_type == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
@@ -357,13 +357,13 @@ extern "C" EXPORT_API int watchface_complication_get_current_type(
 
 extern "C" EXPORT_API int watchface_complication_data_get_type(
     const bundle* data, watchface_complication_type_e* type) {
-  char* type_str = NULL;
+  char* type_str = nullptr;
   int ret;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (data == NULL || type == NULL) {
+  if (data == nullptr || type == nullptr) {
     LOGE("Invalid param !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -374,7 +374,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_type(
     return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
   }
 
-  int comp_type = strtol(type_str, NULL, 10);
+  int comp_type = strtol(type_str, nullptr, 10);
   if (!util::CheckComplicationType(comp_type)) {
     LOGE("Invalid param : type_str(%s)", type_str);
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -385,10 +385,10 @@ extern "C" EXPORT_API int watchface_complication_data_get_type(
 
 static int __get_complication_data(const bundle* data, const char* key,
     char** text) {
-  char* value = NULL;
+  char* value = nullptr;
   int ret;
 
-  if (key == NULL) {
+  if (key == nullptr) {
     LOGE("Invalid param !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -400,7 +400,7 @@ static int __get_complication_data(const bundle* data, const char* key,
   }
 
   *text = strdup(value);
-  if (*text == NULL) {
+  if (*text == nullptr) {
     LOGE("Out of memory");
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
   }
@@ -413,7 +413,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_short_text(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (data == NULL || short_text == NULL) {
+  if (data == nullptr || short_text == nullptr) {
     LOGE("Invalid param !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -426,7 +426,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_long_text(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (data == NULL || long_text == NULL) {
+  if (data == nullptr || long_text == nullptr) {
     LOGE("Invalid param !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -439,7 +439,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_title(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (data == NULL || title == NULL) {
+  if (data == nullptr || title == nullptr) {
     LOGE("Invalid param !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -450,12 +450,12 @@ extern "C" EXPORT_API int watchface_complication_data_get_title(
 extern "C" EXPORT_API int watchface_complication_data_get_timestamp(
     const bundle* data, long* timestamp) {
   int ret;
-  char* time_str = NULL;
+  char* time_str = nullptr;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (data == NULL || timestamp == NULL) {
+  if (data == nullptr || timestamp == nullptr) {
     LOGE("Invalid param !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -465,14 +465,14 @@ extern "C" EXPORT_API int watchface_complication_data_get_timestamp(
     LOGE("failed to get time %d", ret);
     return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
   }
-  *timestamp = strtol(time_str, NULL, 10);
+  *timestamp = strtol(time_str, nullptr, 10);
 
   return WATCHFACE_COMPLICATION_ERROR_NONE;
 }
 
 extern "C" EXPORT_API int watchface_complication_data_get_image_path(
     const bundle* data, char** image_path) {
-  if (data == NULL || image_path == NULL) {
+  if (data == nullptr || image_path == nullptr) {
     LOGE("Invalid param !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -484,15 +484,15 @@ extern "C" EXPORT_API int watchface_complication_data_get_ranged_value(
     const bundle* data, double* current_value, double* min_value,
     double* max_value) {
   int ret;
-  char* current_value_str = NULL;
-  char* min_value_str = NULL;
-  char* max_value_str = NULL;
+  char* current_value_str = nullptr;
+  char* min_value_str = nullptr;
+  char* max_value_str = nullptr;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (data == NULL || current_value == NULL || min_value == NULL
-      || max_value == NULL) {
+  if (data == nullptr || current_value == nullptr || min_value == nullptr
+      || max_value == nullptr) {
     LOGE("Invalid param !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -518,16 +518,16 @@ extern "C" EXPORT_API int watchface_complication_data_get_ranged_value(
     return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
   }
 
-  *current_value = strtod(current_value_str, NULL);
-  *min_value = strtod(min_value_str, NULL);
-  *max_value = strtod(max_value_str, NULL);
+  *current_value = strtod(current_value_str, nullptr);
+  *min_value = strtod(min_value_str, nullptr);
+  *max_value = strtod(max_value_str, nullptr);
 
   return WATCHFACE_COMPLICATION_ERROR_NONE;
 }
 
 extern "C" EXPORT_API int watchface_complication_data_get_icon_path(
     const bundle* data, char** icon_path) {
-  if (data == NULL || icon_path == NULL) {
+  if (data == nullptr || icon_path == nullptr) {
     LOGE("Invalid param !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -540,7 +540,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_extra_data(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (data == NULL || extra_data == NULL) {
+  if (data == nullptr || extra_data == nullptr) {
     LOGE("Invalid param !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -553,7 +553,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_screen_reader_text(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (data == NULL || screen_reader_text == NULL) {
+  if (data == nullptr || screen_reader_text == nullptr) {
     LOGE("Invalid data !!");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -566,7 +566,7 @@ extern "C" EXPORT_API int watchface_complication_transfer_event(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL ||
+  if (handle == nullptr ||
       !(event_type == WATCHFACE_COMPLICATION_EVENT_TAP
         || event_type == WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP))
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -591,19 +591,19 @@ static void __free_provider_info(gpointer data) {
 
 extern "C" EXPORT_API int watchface_complication_allowed_list_create(
     complication_allowed_list_h* handle) {
-  complication_allowed_list_h h = NULL;
+  complication_allowed_list_h h = nullptr;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL) {
+  if (handle == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
 
   h = (complication_allowed_list_h)calloc(1,
       sizeof(struct complication_allowed_list_));
-  if (h == NULL) {
+  if (h == nullptr) {
     LOGE("Out of memory");
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
   }
@@ -618,7 +618,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_destroy(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL) {
+  if (handle == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -633,7 +633,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_destroy(
 static gint __provider_info_cmp(gconstpointer a, gconstpointer b) {
   provider_info* data = (provider_info*)a;
   const char* provider_id = (const char*)b;
-  if (data == NULL || data->provider_id == NULL)
+  if (data == nullptr || data->provider_id == nullptr)
     return -1;
   return strcmp(data->provider_id, provider_id);
 }
@@ -643,7 +643,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_add(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || provider_id == NULL) {
+  if (handle == nullptr || provider_id == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -657,12 +657,12 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_add(
 
   provider_info* info = reinterpret_cast<provider_info*>(calloc(1,
                             sizeof(provider_info)));
-  if (info == NULL) {
+  if (info == nullptr) {
     LOGE("Out of memory");
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
   }
   info->provider_id = strdup(provider_id);
-  if (info->provider_id == NULL) {
+  if (info->provider_id == nullptr) {
     LOGE("Out of memory");
     free(info);
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
@@ -678,7 +678,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_delete(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || provider_id == NULL || handle->allowed_list == NULL) {
+  if (handle == nullptr || provider_id == nullptr || handle->allowed_list == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -703,8 +703,8 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_get_nth(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || provider_id == NULL || types == NULL ||
-      handle->allowed_list == NULL ||
+  if (handle == nullptr || provider_id == nullptr || types == nullptr ||
+      handle->allowed_list == nullptr ||
       index >= static_cast<int>(g_list_length(handle->allowed_list)) ||
       index < 0) {
     LOGE("Invalid param");
@@ -713,12 +713,12 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_get_nth(
   provider_info* info =
     reinterpret_cast<provider_info*>(g_list_nth_data(handle->allowed_list,
                     index));
-  if (info == NULL || info->provider_id == NULL) {
+  if (info == nullptr || info->provider_id == nullptr) {
     LOGE("fail to get provider id");
     return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
   }
   char* id = strdup(info->provider_id);
-  if (id == NULL) {
+  if (id == nullptr) {
     LOGE("Out of memory");
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
   }
@@ -733,7 +733,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_apply(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || list_handle == NULL || list_handle->allowed_list == NULL
+  if (handle == nullptr || list_handle == nullptr || list_handle->allowed_list == nullptr
       || g_list_length(list_handle->allowed_list) == 0) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -747,7 +747,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_apply(
     provider_info* info =
       reinterpret_cast<provider_info*>(g_list_nth_data(
                     list_handle->allowed_list, i));
-    if (info == NULL || info->provider_id == NULL)
+    if (info == nullptr || info->provider_id == nullptr)
       continue;
     try {
       allowed_list.emplace_back(std::unique_ptr<Complication::ProviderInfo>(
@@ -767,7 +767,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_clear(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL) {
+  if (handle == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
index 798c3ff..172c0a5 100644 (file)
@@ -186,8 +186,8 @@ extern "C" EXPORT_API int watchface_editable_add_design_element(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || list_handle == NULL || editable_name == NULL ||
-    list_handle->candidates_list == NULL)
+  if (handle == nullptr || list_handle == nullptr || editable_name == nullptr ||
+    list_handle->candidates_list == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   if (cur_data_idx < 0 &&
@@ -247,7 +247,7 @@ extern "C" EXPORT_API int watchface_editable_add_complication(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || comp == NULL)
+  if (handle == nullptr || comp == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   EditablesContainerStub* ec = static_cast<EditablesContainerStub*>(handle);
@@ -287,7 +287,7 @@ extern "C" EXPORT_API int watchface_editable_request_edit(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || cb == NULL)
+  if (handle == nullptr || cb == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   static cynara_result pcr = COMPLICATION_CYNARA_UNKNOWN;
@@ -348,7 +348,7 @@ extern "C" EXPORT_API int watchface_editable_remove_edit_ready_cb(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (cb == NULL || __container == NULL)
+  if (cb == nullptr || __container == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   return __container->RemoveReadyCallbackInfo(cb);
@@ -359,7 +359,7 @@ extern "C" EXPORT_API int watchface_editable_get_current_data_idx(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || idx == NULL)
+  if (handle == nullptr || idx == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   IEditable* ie = static_cast<IEditable*>(handle);
@@ -372,16 +372,16 @@ extern "C" EXPORT_API int watchface_editable_get_current_data(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || cur_data == NULL)
+  if (handle == nullptr || cur_data == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   IEditable* ie = static_cast<IEditable*>(handle);
   shared_ptr<Bundle> data = ie->GetCurData();
   if (data.get() == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
-  if (data->GetHandle() != NULL) {
+  if (data->GetHandle() != nullptr) {
     *cur_data = bundle_dup(data->GetHandle());
-    if (*cur_data == NULL)
+    if (*cur_data == nullptr)
       return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
   } else {
     return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
@@ -394,16 +394,16 @@ extern "C" EXPORT_API int watchface_editable_get_nth_data(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || nth_data == NULL)
+  if (handle == nullptr || nth_data == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   IEditable* ie = static_cast<IEditable*>(handle);
   shared_ptr<Bundle> data = ie->GetNthData(nth);
   if (data.get() == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
-  if (data->GetHandle() != NULL) {
+  if (data->GetHandle() != nullptr) {
     *nth_data = bundle_dup(data->GetHandle());
-    if (*nth_data == NULL)
+    if (*nth_data == nullptr)
       return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
   } else {
     return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
@@ -416,7 +416,7 @@ extern "C" EXPORT_API int watchface_editable_get_editable_id(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || editable_id == NULL)
+  if (handle == nullptr || editable_id == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   IEditable* ie = static_cast<IEditable*>(handle);
@@ -430,13 +430,13 @@ extern "C" EXPORT_API int watchface_editable_get_editable_name(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || editable_name == NULL)
+  if (handle == nullptr || editable_name == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   IEditable* ie = static_cast<IEditable*>(handle);
   if (!ie->GetLabel().empty()) {
     *editable_name = strdup(ie->GetLabel().c_str());
-    if (*editable_name == NULL) {
+    if (*editable_name == nullptr) {
       LOGE("Out of memory");
       return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
     }
@@ -451,7 +451,7 @@ extern "C" EXPORT_API int watchface_editable_set_editable_name(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || editable_name == NULL)
+  if (handle == nullptr || editable_name == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   IEditable* ie = static_cast<IEditable*>(handle);
@@ -464,7 +464,7 @@ extern "C" EXPORT_API int watchface_editable_load_current_data(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (selected_data == NULL)
+  if (selected_data == nullptr)
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
 
   std::unique_ptr<Bundle> setting_data;
@@ -488,12 +488,12 @@ extern "C" EXPORT_API int watchface_editable_load_current_data(
 
 extern "C" EXPORT_API int watchface_editable_candidates_list_create(
     complication_candidates_list_h* handle) {
-  complication_candidates_list_h h = NULL;
+  complication_candidates_list_h h = nullptr;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL) {
+  if (handle == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -501,7 +501,7 @@ extern "C" EXPORT_API int watchface_editable_candidates_list_create(
   h = (complication_candidates_list_h)calloc(1,
       sizeof(struct complication_candidates_list_));
 
-  if (h == NULL) {
+  if (h == nullptr) {
     LOGE("Out of memory");
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
   }
@@ -516,13 +516,13 @@ extern "C" EXPORT_API int watchface_editable_candidates_list_add(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || candidate == NULL) {
+  if (handle == nullptr || candidate == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
 
   bundle* dup_candidate = bundle_dup(candidate);
-  if (dup_candidate == NULL) {
+  if (dup_candidate == nullptr) {
     LOGE("Out of memory");
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
   }
@@ -542,7 +542,7 @@ extern "C" EXPORT_API int watchface_editable_candidates_list_destroy(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL) {
+  if (handle == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -559,12 +559,12 @@ extern "C" EXPORT_API int watchface_editable_container_get(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (container == NULL) {
+  if (container == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
 
-  if (__container == NULL) {
+  if (__container == nullptr) {
     LOGE("Container is not ready yet");
     return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
   }
@@ -577,12 +577,12 @@ extern "C" EXPORT_API int watchface_editable_container_get(
 extern "C" EXPORT_API int watchface_editable_highlight_create(
     watchface_editable_highlight_h* handle,
     watchface_editable_shape_type_e shape) {
-  watchface_editable_highlight_h h = NULL;
+  watchface_editable_highlight_h h = nullptr;
 
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || shape < WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE ||
+  if (handle == nullptr || shape < WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE ||
       WATCHFACE_EDITABLE_SHAPE_TYPE_RECT < shape) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -591,7 +591,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_create(
   h = (watchface_editable_highlight_h)calloc(1,
       sizeof(struct editable_highlight_));
 
-  if (h == NULL) {
+  if (h == nullptr) {
     LOGE("Out of memory");
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
   }
@@ -610,7 +610,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_set_geometry(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || x < 0 || y < 0 || w < 0 || h < 0) {
+  if (handle == nullptr || x < 0 || y < 0 || w < 0 || h < 0) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -628,7 +628,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_get_geometry(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || x == NULL || y == NULL || w == NULL || h == NULL) {
+  if (handle == nullptr || x == nullptr || y == nullptr || w == nullptr || h == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -646,7 +646,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_set_shape_type(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL
+  if (handle == nullptr
         || shape < WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE
         || shape > WATCHFACE_EDITABLE_SHAPE_TYPE_RECT) {
     LOGE("Invalid param");
@@ -663,7 +663,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_get_shape_type(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || shape == NULL) {
+  if (handle == nullptr || shape == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -677,7 +677,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_destroy(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL) {
+  if (handle == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -692,7 +692,7 @@ extern "C" EXPORT_API int watchface_editable_get_highlight(
   if (!watchface_complication::util::CheckWatchFeatureEnabled())
     return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
 
-  if (handle == NULL || highlight == NULL) {
+  if (handle == nullptr || highlight == nullptr) {
     LOGE("Invalid param");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
@@ -700,14 +700,14 @@ extern "C" EXPORT_API int watchface_editable_get_highlight(
   IEditable* ie = static_cast<IEditable*>(handle);
   IEditable::Highlight* info = ie->GetHighlight();
 
-  if (info == NULL) {
+  if (info == nullptr) {
     LOGE("editor do not have highlight data");
     return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
   }
 
   watchface_editable_highlight_h hi = (watchface_editable_highlight_h)
       calloc(1, sizeof(struct editable_highlight_));
-  if (hi == NULL) {
+  if (hi == nullptr) {
     LOGE("Out of Memory");
     return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
   }