diff options
author | Ickhee Woo <ickhee.woo@samsung.com> | 2016-04-14 08:54:16 +0900 |
---|---|---|
committer | Ickhee Woo <ickhee.woo@samsung.com> | 2016-04-14 08:54:16 +0900 |
commit | d382ad9bc09a06d67571433b71b3c97ace5369c7 (patch) | |
tree | 65f5c4271743d6ec449dd10ffa52ca9aea70bdc2 | |
parent | 9df1e48d63f69fb80719b45db973d448eb540b82 (diff) | |
download | sync-manager-accepted/tizen_ivi.tar.gz sync-manager-accepted/tizen_ivi.tar.bz2 sync-manager-accepted/tizen_ivi.zip |
updated coding conventionsubmit/tizen/20160414.075433accepted/tizen/wearable/20160414.092345accepted/tizen/mobile/20160414.092442accepted/tizen/ivi/20160414.092408accepted/tizen/common/20160414.143019accepted/tizen_ivi
Change-Id: Ibdb29d173d6c44814e9c501b07057263d9ed6301
Signed-off-by: Ickhee Woo <ickhee.woo@samsung.com>
51 files changed, 391 insertions, 752 deletions
diff --git a/src/sync-service/SyncManager_BatteryStatusListener.cpp b/src/sync-service/SyncManager_BatteryStatusListener.cpp index 69cf20d..90af56a 100644 --- a/src/sync-service/SyncManager_BatteryStatusListener.cpp +++ b/src/sync-service/SyncManager_BatteryStatusListener.cpp @@ -33,8 +33,7 @@ /* LCOV_EXCL_START */ -void OnBatteryStatusChanged(keynode_t* pKey, void* pData) -{ +void OnBatteryStatusChanged(keynode_t* pKey, void* pData) { LOG_LOGD("OnBatteryStatusChanged Starts"); BatteryStatus value = static_cast<BatteryStatus> (vconf_keynode_get_int(pKey)); @@ -46,29 +45,25 @@ void OnBatteryStatusChanged(keynode_t* pKey, void* pData) /* LCOV_EXCL_STOP */ -BatteryStatusListener::BatteryStatusListener(void) -{ +BatteryStatusListener::BatteryStatusListener(void) { } /* LCOV_EXCL_START */ -BatteryStatusListener::~BatteryStatusListener(void) -{ +BatteryStatusListener::~BatteryStatusListener(void) { } /* LCOV_EXCL_STOP */ int -BatteryStatusListener::RegisterBatteryStatusListener(void) -{ +BatteryStatusListener::RegisterBatteryStatusListener(void) { return(vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, OnBatteryStatusChanged, NULL)); } /* LCOV_EXCL_START */ int -BatteryStatusListener::DeRegisterBatteryStatusListener(void) -{ +BatteryStatusListener::DeRegisterBatteryStatusListener(void) { LOG_LOGD("DeRegisterBatteryStatusListener"); return(vconf_ignore_key_changed(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, OnBatteryStatusChanged)); diff --git a/src/sync-service/SyncManager_BatteryStatusListener.h b/src/sync-service/SyncManager_BatteryStatusListener.h index 3ffc417..91d894f 100644 --- a/src/sync-service/SyncManager_BatteryStatusListener.h +++ b/src/sync-service/SyncManager_BatteryStatusListener.h @@ -28,8 +28,7 @@ { */ -class BatteryStatusListener -{ +class BatteryStatusListener { public: BatteryStatusListener(void); diff --git a/src/sync-service/SyncManager_CapabilityInfo.cpp b/src/sync-service/SyncManager_CapabilityInfo.cpp index dbd8df4..12a898f 100644 --- a/src/sync-service/SyncManager_CapabilityInfo.cpp +++ b/src/sync-service/SyncManager_CapabilityInfo.cpp @@ -31,13 +31,11 @@ /* LCOV_EXCL_START */ -CapabilityInfo::CapabilityInfo(void) -{ +CapabilityInfo::CapabilityInfo(void) { } -CapabilityInfo::~CapabilityInfo(void) -{ +CapabilityInfo::~CapabilityInfo(void) { /* for (unsigned int i=0; i<periodicSyncList.size(); i++) { delete periodicSyncList[i]; @@ -47,21 +45,18 @@ CapabilityInfo::~CapabilityInfo(void) CapabilityInfo::CapabilityInfo(string capability) - : __capability(capability) -{ + : __capability(capability) { } void -CapabilityInfo::AddPeriodicSyncJob(int account_id, PeriodicSyncJob* pJob) -{ +CapabilityInfo::AddPeriodicSyncJob(int account_id, PeriodicSyncJob* pJob) { __periodicSyncList.insert(pair<int, PeriodicSyncJob*> (account_id, pJob)); } void -CapabilityInfo::RemovePeriodicSyncJob(PeriodicSyncJob* pJob) -{ +CapabilityInfo::RemovePeriodicSyncJob(PeriodicSyncJob* pJob) { /* int acc_id; int ret = account_get_account_id(pJob->accountHandle, &acc_id); @@ -73,23 +68,20 @@ CapabilityInfo::RemovePeriodicSyncJob(PeriodicSyncJob* pJob) bool -CapabilityInfo::RequestAlreadyExists(int account_id, PeriodicSyncJob* pJob) -{ +CapabilityInfo::RequestAlreadyExists(int account_id, PeriodicSyncJob* pJob) { map<int, PeriodicSyncJob*>::iterator it = __periodicSyncList.find(account_id); - if (it == __periodicSyncList.end()) { + if (it == __periodicSyncList.end()) return false; - } + PeriodicSyncJob* pSyncJob = it->second; - if (*pSyncJob == *pJob) { + if (*pSyncJob == *pJob) return true; - } else return false; } -CapabilityInfo::CapabilityInfo(const CapabilityInfo& capabilityInfo) -{ +CapabilityInfo::CapabilityInfo(const CapabilityInfo& capabilityInfo) { this->__capability = capabilityInfo.__capability; map<int, PeriodicSyncJob*>::const_iterator endItr = capabilityInfo.__periodicSyncList.end(); @@ -103,8 +95,7 @@ CapabilityInfo::CapabilityInfo(const CapabilityInfo& capabilityInfo) } -CapabilityInfo& CapabilityInfo::operator =(const CapabilityInfo& capabilityInfo) -{ +CapabilityInfo& CapabilityInfo::operator =(const CapabilityInfo& capabilityInfo) { this->__capability = capabilityInfo.__capability; map<int, PeriodicSyncJob*>::const_iterator endItr = capabilityInfo.__periodicSyncList.end(); diff --git a/src/sync-service/SyncManager_CapabilityInfo.h b/src/sync-service/SyncManager_CapabilityInfo.h index 0edecf3..7a19c0a 100644 --- a/src/sync-service/SyncManager_CapabilityInfo.h +++ b/src/sync-service/SyncManager_CapabilityInfo.h @@ -34,8 +34,7 @@ using namespace std; -class CapabilityInfo -{ +class CapabilityInfo { public: CapabilityInfo(void); diff --git a/src/sync-service/SyncManager_CurrentSyncContext.cpp b/src/sync-service/SyncManager_CurrentSyncContext.cpp index deb3b91..f7f8d09 100644 --- a/src/sync-service/SyncManager_CurrentSyncContext.cpp +++ b/src/sync-service/SyncManager_CurrentSyncContext.cpp @@ -32,16 +32,14 @@ /* LCOV_EXCL_START */ -CurrentSyncContext::CurrentSyncContext(SyncJob* pSyncJob) -{ +CurrentSyncContext::CurrentSyncContext(SyncJob* pSyncJob) { __pCurrentSyncJob = pSyncJob; __startTime = 0; __timerId = -1; } -CurrentSyncContext::CurrentSyncContext(const CurrentSyncContext& currContext) -{ +CurrentSyncContext::CurrentSyncContext(const CurrentSyncContext& currContext) { __startTime = currContext.GetStartTime(); __timerId = currContext.GetTimerId(); __pCurrentSyncJob = currContext.GetSyncJob(); @@ -49,35 +47,30 @@ CurrentSyncContext::CurrentSyncContext(const CurrentSyncContext& currContext) } -CurrentSyncContext::~CurrentSyncContext(void) -{ +CurrentSyncContext::~CurrentSyncContext(void) { } SyncJob* -CurrentSyncContext::GetSyncJob() const -{ +CurrentSyncContext::GetSyncJob() const { return __pCurrentSyncJob; } long -CurrentSyncContext::GetStartTime() const -{ +CurrentSyncContext::GetStartTime() const { return __startTime; } long -CurrentSyncContext::GetTimerId() const -{ +CurrentSyncContext::GetTimerId() const { return __timerId; } void -CurrentSyncContext::SetTimerId(long id) -{ +CurrentSyncContext::SetTimerId(long id) { __timerId = id; } /* LCOV_EXCL_STOP */ diff --git a/src/sync-service/SyncManager_CurrentSyncContext.h b/src/sync-service/SyncManager_CurrentSyncContext.h index 159df97..33ce992 100644 --- a/src/sync-service/SyncManager_CurrentSyncContext.h +++ b/src/sync-service/SyncManager_CurrentSyncContext.h @@ -31,8 +31,7 @@ { */ -class CurrentSyncContext -{ +class CurrentSyncContext { public: CurrentSyncContext(SyncJob *pSyncJob); CurrentSyncContext(const CurrentSyncContext &job); diff --git a/src/sync-service/SyncManager_CurrentSyncJobQueue.cpp b/src/sync-service/SyncManager_CurrentSyncJobQueue.cpp index 274aa6b..006c407 100644 --- a/src/sync-service/SyncManager_CurrentSyncJobQueue.cpp +++ b/src/sync-service/SyncManager_CurrentSyncJobQueue.cpp @@ -35,22 +35,17 @@ using namespace std; {*/ -CurrentSyncJobQueue::CurrentSyncJobQueue(void) -{ - //Empty +CurrentSyncJobQueue::CurrentSyncJobQueue(void) { } /* LCOV_EXCL_START */ -CurrentSyncJobQueue::~CurrentSyncJobQueue(void) -{ - //Empty +CurrentSyncJobQueue::~CurrentSyncJobQueue(void) { } int -CurrentSyncJobQueue::AddSyncJobToCurrentSyncQueue(SyncJob* syncJob) -{ +CurrentSyncJobQueue::AddSyncJobToCurrentSyncQueue(SyncJob* syncJob) { LOG_LOGD("Active Sync Jobs Queue size : Before = [%d]", __currentSyncJobQueue.size()); map<const string, CurrentSyncContext*>::iterator it; @@ -59,8 +54,7 @@ CurrentSyncJobQueue::AddSyncJobToCurrentSyncQueue(SyncJob* syncJob) if (it != __currentSyncJobQueue.end()) { LOG_LOGD("Sync already in progress"); return SYNC_ERROR_ALREADY_IN_PROGRESS; - } - else { + } else { LOG_LOGD("Create a Sync context"); CurrentSyncContext* pCurrentSyncContext = new (std::nothrow) CurrentSyncContext(syncJob); @@ -87,8 +81,7 @@ CurrentSyncJobQueue::AddSyncJobToCurrentSyncQueue(SyncJob* syncJob) int -CurrentSyncJobQueue::OnTimerExpired(void* data) -{ +CurrentSyncJobQueue::OnTimerExpired(void* data) { LOG_LOGD("CurrentSyncJobQueue::onTimerExpired Starts"); CurrentSyncContext* pSyncContext = static_cast<CurrentSyncContext*>(data); @@ -99,12 +92,10 @@ CurrentSyncJobQueue::OnTimerExpired(void* data) SyncManager::GetInstance()->CloseCurrentSyncContext(pSyncContext); SyncManager::GetInstance()->SendSyncCompletedOrCancelledMessage(pJob, SYNC_STATUS_CANCELLED); LOG_LOGD("CurrentSyncJobQueue::onTimerExpired sending sync-cancelled message end"); - } - else { + } else { LOG_LOGD("Failed to get SyncJob"); } - } - else { + } else { LOG_LOGD("context null"); } @@ -115,8 +106,7 @@ CurrentSyncJobQueue::OnTimerExpired(void* data) list<CurrentSyncContext*> -CurrentSyncJobQueue::GetOperations(void) -{ +CurrentSyncJobQueue::GetOperations(void) { list<CurrentSyncContext*> opsList; map<const string, CurrentSyncContext*>::iterator it; for (it = __currentSyncJobQueue.begin(); it != __currentSyncJobQueue.end(); it++) { @@ -129,8 +119,7 @@ CurrentSyncJobQueue::GetOperations(void) bool -CurrentSyncJobQueue::IsJobActive(CurrentSyncContext *pCurrSync) -{ +CurrentSyncJobQueue::IsJobActive(CurrentSyncContext *pCurrSync) { LOG_LOGD("CurrentSyncJobQueue::IsJobActive() Starts"); LOG_LOGD("job q size [%d]", __currentSyncJobQueue.size()); @@ -157,8 +146,7 @@ CurrentSyncJobQueue::IsJobActive(CurrentSyncContext *pCurrSync) int -CurrentSyncJobQueue::RemoveSyncContextFromCurrentSyncQueue(CurrentSyncContext* pSyncContext) -{ +CurrentSyncJobQueue::RemoveSyncContextFromCurrentSyncQueue(CurrentSyncContext* pSyncContext) { LOG_LOGD("Remove sync job from Active Sync Jobs queue"); if (pSyncContext == NULL) { @@ -180,8 +168,7 @@ CurrentSyncJobQueue::RemoveSyncContextFromCurrentSyncQueue(CurrentSyncContext* p string -CurrentSyncJobQueue::ToKey(account_h account, string capability) -{ +CurrentSyncJobQueue::ToKey(account_h account, string capability) { int ret = ACCOUNT_ERROR_NONE; string key; char* pName; @@ -204,8 +191,7 @@ CurrentSyncJobQueue::ToKey(account_h account, string capability) CurrentSyncContext* -CurrentSyncJobQueue::DoesAccAuthExist(account_h account, string auth) -{ +CurrentSyncJobQueue::DoesAccAuthExist(account_h account, string auth) { if (account == NULL) { LOG_LOGD("CurrentSyncJobQueue::DoesAccAuthExist account is null"); return NULL; @@ -228,8 +214,7 @@ CurrentSyncJobQueue::DoesAccAuthExist(account_h account, string auth) CurrentSyncContext* -CurrentSyncJobQueue::GetCurrJobfromKey(string key) -{ +CurrentSyncJobQueue::GetCurrJobfromKey(string key) { map<const string, CurrentSyncContext*>::iterator it; it = __currentSyncJobQueue.find(key); if (it == __currentSyncJobQueue.end()) { diff --git a/src/sync-service/SyncManager_CurrentSyncJobQueue.h b/src/sync-service/SyncManager_CurrentSyncJobQueue.h index 5779407..612a552 100644 --- a/src/sync-service/SyncManager_CurrentSyncJobQueue.h +++ b/src/sync-service/SyncManager_CurrentSyncJobQueue.h @@ -35,8 +35,7 @@ using namespace std; -class CurrentSyncJobQueue -{ +class CurrentSyncJobQueue { public: CurrentSyncJobQueue(void); diff --git a/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp b/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp index 895efa3..67f1553 100644 --- a/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp +++ b/src/sync-service/SyncManager_DataChangeSyncScheduler.cpp @@ -34,8 +34,7 @@ /* LCOV_EXCL_START */ #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) -void OnCalendarBookChanged(const char* view_uri, void* user_data) -{ +void OnCalendarBookChanged(const char* view_uri, void* user_data) { LOG_LOGD("On Calendar Book Changed"); DataChangeSyncScheduler* pDCScheduler = (DataChangeSyncScheduler*) (user_data); @@ -43,8 +42,7 @@ void OnCalendarBookChanged(const char* view_uri, void* user_data) } -void OnCalendarEventChanged(const char* view_uri, void* user_data) -{ +void OnCalendarEventChanged(const char* view_uri, void* user_data) { LOG_LOGD("On Calendar Event Changed"); DataChangeSyncScheduler* pDCScheduler = (DataChangeSyncScheduler*) (user_data); @@ -52,8 +50,7 @@ void OnCalendarEventChanged(const char* view_uri, void* user_data) } -void OnCalendarTodoChanged(const char* view_uri, void* user_data) -{ +void OnCalendarTodoChanged(const char* view_uri, void* user_data) { LOG_LOGD("On Calendar TODO Changed"); DataChangeSyncScheduler* pDCScheduler = (DataChangeSyncScheduler*) (user_data); @@ -61,8 +58,7 @@ void OnCalendarTodoChanged(const char* view_uri, void* user_data) } -void OnContactsDataChanged(const char* view_uri, void* user_data) -{ +void OnContactsDataChanged(const char* view_uri, void* user_data) { LOG_LOGD("On Contacts Data Changed"); DataChangeSyncScheduler* pDCScheduler = (DataChangeSyncScheduler*) (user_data); @@ -71,8 +67,7 @@ void OnContactsDataChanged(const char* view_uri, void* user_data) #endif -void OnMediaContentDataChanged(media_content_error_e error, int pid, media_content_db_update_item_type_e update_item, media_content_db_update_type_e update_type, media_content_type_e media_type, char *uuid, char *path, char *mime_type, void *user_data) -{ +void OnMediaContentDataChanged(media_content_error_e error, int pid, media_content_db_update_item_type_e update_item, media_content_db_update_type_e update_type, media_content_type_e media_type, char *uuid, char *path, char *mime_type, void *user_data) { LOG_LOGD("On Media Content Data Changed"); DataChangeSyncScheduler* pDCScheduler = (DataChangeSyncScheduler*) (user_data); @@ -109,8 +104,7 @@ void OnMediaContentDataChanged(media_content_error_e error, int pid, media_conte /* LCOV_EXCL_STOP */ -DataChangeSyncScheduler::DataChangeSyncScheduler(void) -{ +DataChangeSyncScheduler::DataChangeSyncScheduler(void) { calendar_subscription_started = false; contacts_subscription_started = false; media_content_subscription_started = false; @@ -118,16 +112,14 @@ DataChangeSyncScheduler::DataChangeSyncScheduler(void) /* LCOV_EXCL_START */ -DataChangeSyncScheduler::~DataChangeSyncScheduler(void) -{ +DataChangeSyncScheduler::~DataChangeSyncScheduler(void) { } /* LCOV_EXCL_STOP */ #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) int -DataChangeSyncScheduler::SubscribeCalendarCallback(void) -{ +DataChangeSyncScheduler::SubscribeCalendarCallback(void) { SYNC_LOGE_RET_RES(!calendar_subscription_started, SYNC_ERROR_NONE, "Calendar Callback Already Subscribed"); int err = VALUE_UNDEFINED; @@ -181,8 +173,7 @@ DataChangeSyncScheduler::SubscribeCalendarCallback(void) int -DataChangeSyncScheduler::SubscribeContactsCallback(void) -{ +DataChangeSyncScheduler::SubscribeContactsCallback(void) { SYNC_LOGE_RET_RES(!contacts_subscription_started, SYNC_ERROR_NONE, "Contacts Callback Already Subscribed"); int err = VALUE_UNDEFINED; @@ -208,8 +199,7 @@ DataChangeSyncScheduler::SubscribeContactsCallback(void) int -DataChangeSyncScheduler::SubscribeMediaContentCallback(void) -{ +DataChangeSyncScheduler::SubscribeMediaContentCallback(void) { SYNC_LOGE_RET_RES(!media_content_subscription_started, SYNC_ERROR_NONE, "Media Content Callback Already Subscribed"); int err = VALUE_UNDEFINED; @@ -238,8 +228,7 @@ DataChangeSyncScheduler::SubscribeMediaContentCallback(void) /* LCOV_EXCL_START */ #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) int -DataChangeSyncScheduler::UnSubscribeCalendarCallback(void) -{ +DataChangeSyncScheduler::UnSubscribeCalendarCallback(void) { SYNC_LOGE_RET_RES(calendar_subscription_started, SYNC_ERROR_NONE, "Calendar Callback Already UnSubscribed"); calendar_db_remove_changed_cb(_calendar_book._uri, OnCalendarBookChanged, NULL); @@ -254,8 +243,7 @@ DataChangeSyncScheduler::UnSubscribeCalendarCallback(void) int -DataChangeSyncScheduler::UnSubscribeContactsCallback(void) -{ +DataChangeSyncScheduler::UnSubscribeContactsCallback(void) { SYNC_LOGE_RET_RES(contacts_subscription_started, SYNC_ERROR_NONE, "Contacts Callback Already UnSubscribed"); contacts_db_remove_changed_cb(_contacts_contact._uri, OnContactsDataChanged, NULL); @@ -269,8 +257,7 @@ DataChangeSyncScheduler::UnSubscribeContactsCallback(void) int -DataChangeSyncScheduler::UnSubscribeMediaContentCallback(void) -{ +DataChangeSyncScheduler::UnSubscribeMediaContentCallback(void) { SYNC_LOGE_RET_RES(media_content_subscription_started, SYNC_ERROR_NONE, "Media Content Callback Already UnSubscribed"); media_content_unset_db_updated_cb(); @@ -284,8 +271,7 @@ DataChangeSyncScheduler::UnSubscribeMediaContentCallback(void) int -DataChangeSyncScheduler::RegisterDataChangeListeners(void) -{ +DataChangeSyncScheduler::RegisterDataChangeListeners(void) { int err = SYNC_ERROR_NONE; #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) @@ -322,8 +308,7 @@ DataChangeSyncScheduler::RegisterDataChangeListeners(void) /* LCOV_EXCL_START */ int -DataChangeSyncScheduler::DeRegisterDataChangeListeners(void) -{ +DataChangeSyncScheduler::DeRegisterDataChangeListeners(void) { int err = VALUE_UNDEFINED; #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) @@ -353,8 +338,7 @@ DataChangeSyncScheduler::DeRegisterDataChangeListeners(void) void -DataChangeSyncScheduler::HandleDataChangeEvent(const char* pSyncCapability) -{ +DataChangeSyncScheduler::HandleDataChangeEvent(const char* pSyncCapability) { LOG_LOGD("DataChangeSyncScheduler::HandleDataChangeEvent() Starts"); pair<std::multimap<string, DataSyncJob*>::iterator, std::multimap<string, DataSyncJob*>::iterator> ret; @@ -374,8 +358,7 @@ DataChangeSyncScheduler::HandleDataChangeEvent(const char* pSyncCapability) /* capability can be called as syncJobName in SyncManager */ int -DataChangeSyncScheduler::AddDataSyncJob(string capability, DataSyncJob* dataSyncJob) -{ +DataChangeSyncScheduler::AddDataSyncJob(string capability, DataSyncJob* dataSyncJob) { __dataChangeSyncJobs.insert(make_pair(capability, dataSyncJob)); return SYNC_ERROR_NONE; @@ -383,8 +366,7 @@ DataChangeSyncScheduler::AddDataSyncJob(string capability, DataSyncJob* dataSync void -DataChangeSyncScheduler::RemoveDataSyncJob(DataSyncJob* dataSyncJob) -{ +DataChangeSyncScheduler::RemoveDataSyncJob(DataSyncJob* dataSyncJob) { typedef multimap<string, DataSyncJob*>::iterator iterator; std::pair<iterator, iterator> iterpair = __dataChangeSyncJobs.equal_range(dataSyncJob->__capability); diff --git a/src/sync-service/SyncManager_DataChangeSyncScheduler.h b/src/sync-service/SyncManager_DataChangeSyncScheduler.h index 3976e30..424d3af 100644 --- a/src/sync-service/SyncManager_DataChangeSyncScheduler.h +++ b/src/sync-service/SyncManager_DataChangeSyncScheduler.h @@ -25,8 +25,7 @@ #include "SyncManager_DataSyncJob.h" #include <map> -class DataChangeSyncScheduler -{ +class DataChangeSyncScheduler { public: bool calendar_subscription_started; bool contacts_subscription_started; diff --git a/src/sync-service/SyncManager_DataSyncJob.cpp b/src/sync-service/SyncManager_DataSyncJob.cpp index 6fb95b3..36d3638 100644 --- a/src/sync-service/SyncManager_DataSyncJob.cpp +++ b/src/sync-service/SyncManager_DataSyncJob.cpp @@ -26,22 +26,19 @@ {*/ -DataSyncJob::~DataSyncJob(void) -{ +DataSyncJob::~DataSyncJob(void) { } DataSyncJob::DataSyncJob(const string appId, const string syncJobName, int accountId, bundle* pUserData, int syncOption, int syncJobId, SyncType type, string capability) - : SyncJob(appId, syncJobName, accountId, pUserData, syncOption, syncJobId, type) - , __capability(capability) -{ + : SyncJob(appId, syncJobName, accountId, pUserData, syncOption, syncJobId, type) + , __capability(capability) { } /* LCOV_EXCL_START */ DataSyncJob::DataSyncJob(const DataSyncJob& other) - : SyncJob(other) -{ + : SyncJob(other) { /* this->__accountHandle = other.__accountHandle; this->__capability = other.__capability; @@ -53,8 +50,7 @@ DataSyncJob::DataSyncJob(const DataSyncJob& other) DataSyncJob& -DataSyncJob::operator= (const DataSyncJob& other) -{ +DataSyncJob::operator= (const DataSyncJob& other) { /* this->__accountHandle = other.__accountHandle; this->__capability = other.__capability; @@ -68,8 +64,7 @@ DataSyncJob::operator= (const DataSyncJob& other) void -DataSyncJob::Reset(int accountId, bundle* pUserData, int syncOption, string capability) -{ +DataSyncJob::Reset(int accountId, bundle* pUserData, int syncOption, string capability) { SyncJob::Reset(accountId, pUserData, syncOption); __capability = capability; } diff --git a/src/sync-service/SyncManager_DataSyncJob.h b/src/sync-service/SyncManager_DataSyncJob.h index c680c30..b796e42 100644 --- a/src/sync-service/SyncManager_DataSyncJob.h +++ b/src/sync-service/SyncManager_DataSyncJob.h @@ -35,8 +35,7 @@ using namespace std; class DataSyncJob - : public SyncJob -{ + : public SyncJob { public: ~DataSyncJob(void); diff --git a/src/sync-service/SyncManager_ISyncJob.h b/src/sync-service/SyncManager_ISyncJob.h index a00b4aa..dd20e68 100644 --- a/src/sync-service/SyncManager_ISyncJob.h +++ b/src/sync-service/SyncManager_ISyncJob.h @@ -43,8 +43,7 @@ enum SyncType { }; -class ISyncJob -{ +class ISyncJob { public: ISyncJob() : __syncJobId(-1), __syncType(SYNC_TYPE_UNKNOWN) {} diff --git a/src/sync-service/SyncManager_ManageIdleState.cpp b/src/sync-service/SyncManager_ManageIdleState.cpp index 62a4eb4..c9825e8 100644 --- a/src/sync-service/SyncManager_ManageIdleState.cpp +++ b/src/sync-service/SyncManager_ManageIdleState.cpp @@ -32,15 +32,13 @@ {*/ -ManageIdleState::ManageIdleState(void) -{ +ManageIdleState::ManageIdleState(void) { __termTimerId = -1; } /* LCOV_EXCL_START */ -ManageIdleState::~ManageIdleState(void) -{ +ManageIdleState::~ManageIdleState(void) { } /* LCOV_EXCL_STOP */ @@ -48,8 +46,7 @@ ManageIdleState::~ManageIdleState(void) void terminate_service(void); int -ManageIdleState::OnTermTimerExpired(gpointer) -{ +ManageIdleState::OnTermTimerExpired(gpointer) { LOG_LOGD("Sync service auto-termination timer is expired"); terminate_service(); @@ -58,34 +55,31 @@ ManageIdleState::OnTermTimerExpired(gpointer) void -ManageIdleState::SetTermTimerId(long timerId) -{ +ManageIdleState::SetTermTimerId(long timerId) { __termTimerId = timerId; } long -ManageIdleState::GetTermTimerId() const -{ +ManageIdleState::GetTermTimerId() const { return __termTimerId; } void -ManageIdleState::SetTermTimer() -{ +ManageIdleState::SetTermTimer() { if (GetTermTimerId() == -1) { guint termTimer = SYNC_TERM_SEC * 1000; SetTermTimerId(g_timeout_add(termTimer, ManageIdleState::OnTermTimerExpired, NULL)); LOG_LOGD("Sync service auto-termination timer is Set as [%d] sec", SYNC_TERM_SEC); - } else + } else { ResetTermTimer(); + } } void -ManageIdleState::UnsetTermTimer() -{ +ManageIdleState::UnsetTermTimer() { if (GetTermTimerId() != -1) { LOG_LOGD("Sync service auto-termination timer is Unset"); g_source_remove((guint)GetTermTimerId()); @@ -95,8 +89,7 @@ ManageIdleState::UnsetTermTimer() void -ManageIdleState::ResetTermTimer() -{ +ManageIdleState::ResetTermTimer() { if (GetTermTimerId() != -1) { LOG_LOGD("Sync service auto-termination timer is Reset"); g_source_remove((guint)GetTermTimerId()); diff --git a/src/sync-service/SyncManager_ManageIdleState.h b/src/sync-service/SyncManager_ManageIdleState.h index b9d1183..1a9e4a2 100644 --- a/src/sync-service/SyncManager_ManageIdleState.h +++ b/src/sync-service/SyncManager_ManageIdleState.h @@ -30,8 +30,7 @@ using namespace std; -class ManageIdleState -{ +class ManageIdleState { public: ManageIdleState(void); diff --git a/src/sync-service/SyncManager_NetworkChangeListener.cpp b/src/sync-service/SyncManager_NetworkChangeListener.cpp index cc6085b..c7a43e2 100644 --- a/src/sync-service/SyncManager_NetworkChangeListener.cpp +++ b/src/sync-service/SyncManager_NetworkChangeListener.cpp @@ -29,8 +29,7 @@ /* LCOV_EXCL_START */ -void OnConnectionChanged(connection_type_e type, void *user_data) -{ +void OnConnectionChanged(connection_type_e type, void *user_data) { LOG_LOGD("Network connection changed %d", type); switch (type) { @@ -60,8 +59,7 @@ void OnConnectionChanged(connection_type_e type, void *user_data) NetworkChangeListener::NetworkChangeListener(void) - : connection(NULL) -{ + : connection(NULL) { int ret = connection_create(&connection); if (ret != CONNECTION_ERROR_NONE) { LOG_LOGD("Create connection failed %d, %s", ret, get_error_message(ret)); /* LCOV_EXCL_LINE */ @@ -70,8 +68,7 @@ NetworkChangeListener::NetworkChangeListener(void) /* LCOV_EXCL_START */ -NetworkChangeListener::~NetworkChangeListener(void) -{ +NetworkChangeListener::~NetworkChangeListener(void) { if (connection) { connection_destroy(connection); } @@ -80,8 +77,7 @@ NetworkChangeListener::~NetworkChangeListener(void) bool -NetworkChangeListener::IsWifiConnected() -{ +NetworkChangeListener::IsWifiConnected() { int ret; connection_wifi_state_e state = CONNECTION_WIFI_STATE_DEACTIVATED; ret = connection_get_wifi_state(connection, &state); @@ -94,8 +90,7 @@ NetworkChangeListener::IsWifiConnected() bool -NetworkChangeListener::IsDataConnectionPresent() -{ +NetworkChangeListener::IsDataConnectionPresent() { int ret; connection_cellular_state_e state = CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE; ret = connection_get_cellular_state(connection, &state); @@ -110,8 +105,7 @@ NetworkChangeListener::IsDataConnectionPresent() int -NetworkChangeListener::RegisterNetworkChangeListener(void) -{ +NetworkChangeListener::RegisterNetworkChangeListener(void) { int ret = CONNECTION_ERROR_NONE; ret = connection_set_type_changed_cb(connection, OnConnectionChanged, NULL); if (ret != CONNECTION_ERROR_NONE) { @@ -124,8 +118,7 @@ NetworkChangeListener::RegisterNetworkChangeListener(void) /* LCOV_EXCL_START */ int -NetworkChangeListener::DeRegisterNetworkChangeListener(void) -{ +NetworkChangeListener::DeRegisterNetworkChangeListener(void) { LOG_LOGD("Removing network change listener"); int ret; diff --git a/src/sync-service/SyncManager_NetworkChangeListener.h b/src/sync-service/SyncManager_NetworkChangeListener.h index 8a8354b..75c6868 100644 --- a/src/sync-service/SyncManager_NetworkChangeListener.h +++ b/src/sync-service/SyncManager_NetworkChangeListener.h @@ -30,8 +30,7 @@ { */ -class NetworkChangeListener -{ +class NetworkChangeListener { public: NetworkChangeListener(void); diff --git a/src/sync-service/SyncManager_PeriodicSyncJob.cpp b/src/sync-service/SyncManager_PeriodicSyncJob.cpp index 9245a08..7dfae8b 100644 --- a/src/sync-service/SyncManager_PeriodicSyncJob.cpp +++ b/src/sync-service/SyncManager_PeriodicSyncJob.cpp @@ -26,22 +26,19 @@ {*/ -PeriodicSyncJob::~PeriodicSyncJob(void) -{ +PeriodicSyncJob::~PeriodicSyncJob(void) { } PeriodicSyncJob::PeriodicSyncJob(const string appId, const string syncJobName, int accountId, bundle* pUserData, int syncOption, int syncJobId, SyncType type, long frequency) - : SyncJob(appId, syncJobName, accountId, pUserData, syncOption, syncJobId, type) - , __period(frequency) -{ + : SyncJob(appId, syncJobName, accountId, pUserData, syncOption, syncJobId, type) + , __period(frequency) { } /* LCOV_EXCL_START */ PeriodicSyncJob::PeriodicSyncJob(const PeriodicSyncJob& other) - : SyncJob(other), __period(other.__period) -{ + : SyncJob(other), __period(other.__period) { /* this->__accountHandle = other.__accountHandle; this->__capability = other.__capability; @@ -53,8 +50,7 @@ PeriodicSyncJob::PeriodicSyncJob(const PeriodicSyncJob& other) PeriodicSyncJob& -PeriodicSyncJob::operator = (const PeriodicSyncJob& other) -{ +PeriodicSyncJob::operator = (const PeriodicSyncJob& other) { /* this->__accountHandle = other.__accountHandle; this->__capability = other.__capability; @@ -68,8 +64,7 @@ PeriodicSyncJob::operator = (const PeriodicSyncJob& other) bool -PeriodicSyncJob::operator==(const PeriodicSyncJob& other) -{ +PeriodicSyncJob::operator==(const PeriodicSyncJob& other) { /* if ((SyncManager::GetInstance())->AreAccountsEqual(this->__accountHandle, other.__accountHandle) && (this->__capability).compare(other.__capability) == 0 @@ -85,8 +80,7 @@ PeriodicSyncJob::operator==(const PeriodicSyncJob& other) bool -PeriodicSyncJob::IsExtraEqual(PeriodicSyncJob* pJob) -{ +PeriodicSyncJob::IsExtraEqual(PeriodicSyncJob* pJob) { /* bundle* pExtra1 = this->__pExtras; bundle* pExtra2 = pJob->__pExtras; @@ -144,8 +138,7 @@ PeriodicSyncJob::IsExtraEqual(PeriodicSyncJob* pJob) void -PeriodicSyncJob::Reset(int accountId, bundle* pUserData, int syncOption, long frequency) -{ +PeriodicSyncJob::Reset(int accountId, bundle* pUserData, int syncOption, long frequency) { SyncJob::Reset(accountId, pUserData, syncOption); __period = frequency; } diff --git a/src/sync-service/SyncManager_PeriodicSyncJob.h b/src/sync-service/SyncManager_PeriodicSyncJob.h index e740dd1..b4db747 100644 --- a/src/sync-service/SyncManager_PeriodicSyncJob.h +++ b/src/sync-service/SyncManager_PeriodicSyncJob.h @@ -36,8 +36,7 @@ using namespace std; class PeriodicSyncJob - : public SyncJob -{ + : public SyncJob { public: ~PeriodicSyncJob(void); diff --git a/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp b/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp index 5e1ef3e..5e71c99 100644 --- a/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp +++ b/src/sync-service/SyncManager_PeriodicSyncScheduler.cpp @@ -31,20 +31,17 @@ #include "SyncManager_SyncManager.h" -PeriodicSyncScheduler::PeriodicSyncScheduler(void) -{ +PeriodicSyncScheduler::PeriodicSyncScheduler(void) { } /* LCOV_EXCL_START */ -PeriodicSyncScheduler::~PeriodicSyncScheduler(void) -{ +PeriodicSyncScheduler::~PeriodicSyncScheduler(void) { } int -PeriodicSyncScheduler::OnAlarmExpired(alarm_id_t alarm_id, void *user_param) -{ +PeriodicSyncScheduler::OnAlarmExpired(alarm_id_t alarm_id, void *user_param) { LOG_LOGD("Alarm id %d", alarm_id); PeriodicSyncScheduler* pPeriodicSyncScheduler = (PeriodicSyncScheduler*) user_param; @@ -71,8 +68,7 @@ PeriodicSyncScheduler::OnAlarmExpired(alarm_id_t alarm_id, void *user_param) int -PeriodicSyncScheduler::RemoveAlarmForPeriodicSyncJob(PeriodicSyncJob* pSyncJob) -{ +PeriodicSyncScheduler::RemoveAlarmForPeriodicSyncJob(PeriodicSyncJob* pSyncJob) { LOG_LOGD("Removing alarm for periodic sync job"); string jobKey = pSyncJob->__key; @@ -86,8 +82,7 @@ PeriodicSyncScheduler::RemoveAlarmForPeriodicSyncJob(PeriodicSyncJob* pSyncJob) __activeAlarmList.erase(iter); __activePeriodicSyncJobs.erase(alarm); LOG_LOGD("Removed alarm for [%s], [%d]", jobKey.c_str(), alarm); - } - else { + } else { LOG_LOGD("No active alarm found for [%s]", jobKey.c_str()); } @@ -96,8 +91,7 @@ PeriodicSyncScheduler::RemoveAlarmForPeriodicSyncJob(PeriodicSyncJob* pSyncJob) int -PeriodicSyncScheduler::SchedulePeriodicSyncJob(PeriodicSyncJob* periodicSyncJob) -{ +PeriodicSyncScheduler::SchedulePeriodicSyncJob(PeriodicSyncJob* periodicSyncJob) { string jobKey = periodicSyncJob->__key; //Remove previous alarms, if set already @@ -112,8 +106,7 @@ PeriodicSyncScheduler::SchedulePeriodicSyncJob(PeriodicSyncJob* periodicSyncJob) __activePeriodicSyncJobs.insert(make_pair<int, PeriodicSyncJob*> (alarm_id, periodicSyncJob)); __activeAlarmList.insert(make_pair(jobKey, alarm_id)); - } - else { + } else { LOG_LOGD("Failed to add Alarm for %ld min, ret %d", periodicSyncJob->__period, ret); /* LCOV_EXCL_LINE */ return SYNC_ERROR_SYSTEM; } diff --git a/src/sync-service/SyncManager_PeriodicSyncScheduler.h b/src/sync-service/SyncManager_PeriodicSyncScheduler.h index c05e122..6671f53 100644 --- a/src/sync-service/SyncManager_PeriodicSyncScheduler.h +++ b/src/sync-service/SyncManager_PeriodicSyncScheduler.h @@ -26,8 +26,7 @@ #include <map> #include "SyncManager_PeriodicSyncJob.h" -class PeriodicSyncScheduler -{ +class PeriodicSyncScheduler { public: PeriodicSyncScheduler(void); diff --git a/src/sync-service/SyncManager_RepositoryEngine.cpp b/src/sync-service/SyncManager_RepositoryEngine.cpp index 82bcf69..2374664 100644 --- a/src/sync-service/SyncManager_RepositoryEngine.cpp +++ b/src/sync-service/SyncManager_RepositoryEngine.cpp @@ -120,8 +120,7 @@ RepositoryEngine* RepositoryEngine::__pInstance = NULL; RepositoryEngine* -RepositoryEngine::GetInstance(void) -{ +RepositoryEngine::GetInstance(void) { if (!__pInstance) { __pInstance = new (std::nothrow) RepositoryEngine(); if (__pInstance == NULL) { @@ -137,15 +136,13 @@ RepositoryEngine::GetInstance(void) /* LCOV_EXCL_START */ -RepositoryEngine::~RepositoryEngine(void) -{ +RepositoryEngine::~RepositoryEngine(void) { pthread_mutex_destroy(&__capabilityInfoMutex); } /* LCOV_EXCL_STOP */ -RepositoryEngine::RepositoryEngine(void) -{ +RepositoryEngine::RepositoryEngine(void) { if (pthread_mutex_init(&__capabilityInfoMutex, NULL) != 0) { LOG_LOGD("\n __syncJobQueueMutex init failed\n"); /* LCOV_EXCL_LINE */ return; @@ -154,8 +151,7 @@ RepositoryEngine::RepositoryEngine(void) void -RepositoryEngine::OnBooting() -{ +RepositoryEngine::OnBooting() { ReadSyncAdapters(); ReadSyncJobsData(); } @@ -172,8 +168,7 @@ bndl_iterator_test(const char* pKey, const char* pVal, void* pData) void -RepositoryEngine::ReadSyncJobsData(void) -{ +RepositoryEngine::ReadSyncJobsData(void) { LOG_LOGD("Reading Sync jobs"); //Parse the Xml file @@ -208,8 +203,7 @@ RepositoryEngine::ReadSyncJobsData(void) xmlFreeDoc(doc); return; /* LCOV_EXCL_STOP */ - } - else { + } else { xmlChar* pTotalJobsCount = xmlGetProp(cur, XML_ATTR_JOBS_COUNT); int totalcount = (pTotalJobsCount == NULL) ? 0 : atoi((char*)pTotalJobsCount); LOG_LOGD("Total Sync jobs [%d]", totalcount); @@ -273,8 +267,7 @@ RepositoryEngine::ReadSyncJobsData(void) void -RepositoryEngine::ReadSyncAdapters(void) -{ +RepositoryEngine::ReadSyncAdapters(void) { LOG_LOGD("Reading sync adapters"); //Parse the Xml file @@ -309,8 +302,7 @@ RepositoryEngine::ReadSyncAdapters(void) xmlFreeDoc(doc); return; /* LCOV_EXCL_STOP */ - } - else { + } else { xmlChar* pSACount; pSACount = xmlGetProp(cur, XML_ATTR_COUNT); @@ -341,8 +333,7 @@ RepositoryEngine::ReadSyncAdapters(void) /* LCOV_EXCL_START */ static void -bndl_iterator(const char* pKey, const char* pVal, void* pData) -{ +bndl_iterator(const char* pKey, const char* pVal, void* pData) { xmlNodePtr parentNode = *((xmlNodePtr*)pData); xmlNodePtr extraNode = xmlNewChild(parentNode, NULL, XML_NODE_SYNC_EXTRA, NULL); @@ -353,8 +344,7 @@ bndl_iterator(const char* pKey, const char* pVal, void* pData) void -RepositoryEngine::WriteSyncJobsData(void) -{ +RepositoryEngine::WriteSyncJobsData(void) { LOG_LOGD("Writing sync jobs"); xmlDocPtr doc; @@ -454,8 +444,7 @@ RepositoryEngine::WriteSyncJobsData(void) void -RepositoryEngine::WriteSyncAdapters(void) -{ +RepositoryEngine::WriteSyncAdapters(void) { LOG_LOGD("Writing sync adapters"); xmlDocPtr doc; @@ -502,8 +491,7 @@ RepositoryEngine::WriteSyncAdapters(void) /* LCOV_EXCL_START */ void -RepositoryEngine::ParseExtras(xmlNodePtr cur, bundle* pExtra) -{ +RepositoryEngine::ParseExtras(xmlNodePtr cur, bundle* pExtra) { xmlChar* pKey = xmlGetProp(cur, XML_ATTR_SYNC_EXTRA_KEY); xmlChar* pVal = xmlGetProp(cur, XML_ATTR_SYNC_EXTRA_VALUE); @@ -516,8 +504,7 @@ RepositoryEngine::ParseExtras(xmlNodePtr cur, bundle* pExtra) void -RepositoryEngine::ParseSyncJobsN(xmlNodePtr cur, xmlChar* pPackage) -{ +RepositoryEngine::ParseSyncJobsN(xmlNodePtr cur, xmlChar* pPackage) { //xmlChar* pAppId = xmlGetProp(cur, XML_ATTR_JOB_APP_ID); xmlChar* pAccId = xmlGetProp(cur, XML_ATTR_JOB_ACCOUNT_ID); xmlChar* pJobId = xmlGetProp(cur, XML_ATTR_JOB_ID); @@ -569,8 +556,7 @@ RepositoryEngine::ParseSyncJobsN(xmlNodePtr cur, xmlChar* pPackage) void -RepositoryEngine::SaveCurrentState(void) -{ +RepositoryEngine::SaveCurrentState(void) { LOG_LOGD("saving states during shutdown"); pthread_mutex_lock(&__capabilityInfoMutex); WriteSyncJobsData(); @@ -581,8 +567,7 @@ RepositoryEngine::SaveCurrentState(void) /* LCOV_EXCL_START */ void -RepositoryEngine::SaveCurrentSyncAdapter(void) -{ +RepositoryEngine::SaveCurrentSyncAdapter(void) { LOG_LOGD("saving states after adding sync adapter"); pthread_mutex_lock(&__capabilityInfoMutex); WriteSyncAdapters(); @@ -591,8 +576,7 @@ RepositoryEngine::SaveCurrentSyncAdapter(void) void -RepositoryEngine::SaveCurrentSyncJob(void) -{ +RepositoryEngine::SaveCurrentSyncJob(void) { LOG_LOGD("saving states after adding sync job"); pthread_mutex_lock(&__capabilityInfoMutex); WriteSyncJobsData(); diff --git a/src/sync-service/SyncManager_RepositoryEngine.h b/src/sync-service/SyncManager_RepositoryEngine.h index d40faef..f37efc2 100644 --- a/src/sync-service/SyncManager_RepositoryEngine.h +++ b/src/sync-service/SyncManager_RepositoryEngine.h @@ -49,8 +49,7 @@ using namespace std; class SyncJobQueue; class SyncJob; -class RepositoryEngine -{ +class RepositoryEngine { friend class CapabilityInfo; public: diff --git a/src/sync-service/SyncManager_ServiceInterface.cpp b/src/sync-service/SyncManager_ServiceInterface.cpp index 615620f..4e69ffa 100644 --- a/src/sync-service/SyncManager_ServiceInterface.cpp +++ b/src/sync-service/SyncManager_ServiceInterface.cpp @@ -26,14 +26,12 @@ #endif -API int sync_service_initialise(void) -{ +API int sync_service_initialise(void) { return SyncService::GetInstance()->StartService(); } -API int sync_service_finalise(void) -{ +API int sync_service_finalise(void) { SyncService::GetInstance()->HandleShutdown(); SyncManager::Destroy(); SyncService::Destroy(); diff --git a/src/sync-service/SyncManager_ServiceInterface.h b/src/sync-service/SyncManager_ServiceInterface.h index 58d51c7..31f4e07 100644 --- a/src/sync-service/SyncManager_ServiceInterface.h +++ b/src/sync-service/SyncManager_ServiceInterface.h @@ -23,8 +23,7 @@ */ #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif int sync_service_initialise(void); diff --git a/src/sync-service/SyncManager_Singleton.h b/src/sync-service/SyncManager_Singleton.h index b6e9441..01309d2 100644 --- a/src/sync-service/SyncManager_Singleton.h +++ b/src/sync-service/SyncManager_Singleton.h @@ -26,8 +26,7 @@ */ template < typename TYPE > -class Singleton -{ +class Singleton { public: static TYPE* GetInstance(void) { if (__pInstance == NULL) { diff --git a/src/sync-service/SyncManager_StorageChangeListener.cpp b/src/sync-service/SyncManager_StorageChangeListener.cpp index b2a715d..f1abd70 100644 --- a/src/sync-service/SyncManager_StorageChangeListener.cpp +++ b/src/sync-service/SyncManager_StorageChangeListener.cpp @@ -33,36 +33,31 @@ /* LCOV_EXCL_START */ -void OnMemoryStatusChanged(keynode_t* pKey, void* pData) -{ +void OnMemoryStatusChanged(keynode_t* pKey, void* pData) { MemoryStatus value = static_cast<MemoryStatus> (vconf_keynode_get_int(pKey)); SyncManager::GetInstance()->OnStorageStatusChanged(value); } -StorageChangeListener::~StorageChangeListener(void) -{ +StorageChangeListener::~StorageChangeListener(void) { } /* LCOV_EXCL_STOP */ -StorageChangeListener::StorageChangeListener(void) -{ +StorageChangeListener::StorageChangeListener(void) { } int -StorageChangeListener::RegisterStorageChangeListener(void) -{ +StorageChangeListener::RegisterStorageChangeListener(void) { return( vconf_notify_key_changed(VCONFKEY_SYSMAN_LOW_MEMORY, OnMemoryStatusChanged, NULL) ); } /* LCOV_EXCL_START */ int -StorageChangeListener::DeRegisterStorageChangeListener(void) -{ +StorageChangeListener::DeRegisterStorageChangeListener(void) { LOG_LOGD("Remove storage listener"); return(vconf_ignore_key_changed(VCONFKEY_SYSMAN_LOW_MEMORY, OnMemoryStatusChanged)); diff --git a/src/sync-service/SyncManager_StorageChangeListener.h b/src/sync-service/SyncManager_StorageChangeListener.h index 90f34f1..b3d27e9 100644 --- a/src/sync-service/SyncManager_StorageChangeListener.h +++ b/src/sync-service/SyncManager_StorageChangeListener.h @@ -27,8 +27,7 @@ { */ -class StorageChangeListener -{ +class StorageChangeListener { public: StorageChangeListener(void); diff --git a/src/sync-service/SyncManager_SyncAdapterAggregator.cpp b/src/sync-service/SyncManager_SyncAdapterAggregator.cpp index c6e6cf6..bb704ec 100644 --- a/src/sync-service/SyncManager_SyncAdapterAggregator.cpp +++ b/src/sync-service/SyncManager_SyncAdapterAggregator.cpp @@ -39,21 +39,18 @@ using namespace std; -SyncAdapterAggregator::SyncAdapterAggregator(void) -{ +SyncAdapterAggregator::SyncAdapterAggregator(void) { } /* LCOV_EXCL_START */ -SyncAdapterAggregator::~SyncAdapterAggregator(void) -{ +SyncAdapterAggregator::~SyncAdapterAggregator(void) { } /* LCOV_EXCL_STOP */ void -SyncAdapterAggregator::AddSyncAdapter(const char* pPackageId, const char* pServiceAppId) -{ +SyncAdapterAggregator::AddSyncAdapter(const char* pPackageId, const char* pServiceAppId) { if (HasSyncAdapter(pPackageId)) { LOG_LOGD("Sync adapter already registered for package [%s]", pPackageId); /* LCOV_EXCL_LINE */ } else { @@ -64,8 +61,7 @@ SyncAdapterAggregator::AddSyncAdapter(const char* pPackageId, const char* pServi void -SyncAdapterAggregator::dumpSyncAdapters() -{ +SyncAdapterAggregator::dumpSyncAdapters() { /* for (multimap<string, SyncAdapter*>::iterator it = __syncAdapterList.begin(); it != __syncAdapterList.end(); ++it) { @@ -77,8 +73,7 @@ SyncAdapterAggregator::dumpSyncAdapters() const char* -SyncAdapterAggregator::GetSyncAdapter(const char* pAppId) -{ +SyncAdapterAggregator::GetSyncAdapter(const char* pAppId) { string PkgId(pAppId); if (PkgId.empty()) { //PkgId = SyncManager::GetInstance()->GetPkgIdByCommandline(pAppId); @@ -99,8 +94,7 @@ SyncAdapterAggregator::GetSyncAdapter(const char* pAppId) /* LCOV_EXCL_START */ bool -SyncAdapterAggregator::HasServiceAppId(const char* pAccountProviderId) -{ +SyncAdapterAggregator::HasServiceAppId(const char* pAccountProviderId) { bool result = false; /* pair<multimap<string, SyncAdapter*>::iterator, multimap<string, SyncAdapter*>::iterator> ret; @@ -119,8 +113,7 @@ SyncAdapterAggregator::HasServiceAppId(const char* pAccountProviderId) bool -SyncAdapterAggregator::HasSyncAdapter(const char* pPackageId) -{ +SyncAdapterAggregator::HasSyncAdapter(const char* pPackageId) { map<string, string>::iterator it = __syncAdapterList.find(pPackageId); return it != __syncAdapterList.end(); } @@ -128,8 +121,7 @@ SyncAdapterAggregator::HasSyncAdapter(const char* pPackageId) /* LCOV_EXCL_START */ void -SyncAdapterAggregator::HandlePackageUninstalled(const char* pPackageId) -{ +SyncAdapterAggregator::HandlePackageUninstalled(const char* pPackageId) { LOG_LOGD("Removing sync adapter for package [%s]", pPackageId); __syncAdapterList.erase(pPackageId); } @@ -137,8 +129,7 @@ SyncAdapterAggregator::HandlePackageUninstalled(const char* pPackageId) void -SyncAdapterAggregator::RemoveSyncAdapter(const char* pPackageId) -{ +SyncAdapterAggregator::RemoveSyncAdapter(const char* pPackageId) { __syncAdapterList.erase(pPackageId); } diff --git a/src/sync-service/SyncManager_SyncAdapterAggregator.h b/src/sync-service/SyncManager_SyncAdapterAggregator.h index 6562c67..52dd5a9 100644 --- a/src/sync-service/SyncManager_SyncAdapterAggregator.h +++ b/src/sync-service/SyncManager_SyncAdapterAggregator.h @@ -49,8 +49,7 @@ class SyncAdapter; using namespace std; -class SyncAdapterAggregator -{ +class SyncAdapterAggregator { public: void AddSyncAdapter(const char* pPackageId, const char* pServiceAppId); diff --git a/src/sync-service/SyncManager_SyncDefines.h b/src/sync-service/SyncManager_SyncDefines.h index ac82b4d..106abe6 100644 --- a/src/sync-service/SyncManager_SyncDefines.h +++ b/src/sync-service/SyncManager_SyncDefines.h @@ -179,8 +179,7 @@ enum SyncSource { }; -class BackOffMode -{ +class BackOffMode { public: static long NOT_IN_BACKOFF_MODE; }; diff --git a/src/sync-service/SyncManager_SyncJob.cpp b/src/sync-service/SyncManager_SyncJob.cpp index fae5edf..1f178c4 100644 --- a/src/sync-service/SyncManager_SyncJob.cpp +++ b/src/sync-service/SyncManager_SyncJob.cpp @@ -36,8 +36,7 @@ extern "C" { -SyncJob::~SyncJob(void) -{ +SyncJob::~SyncJob(void) { if (__pExtras) { bundle_free(__pExtras); } @@ -47,8 +46,7 @@ SyncJob::~SyncJob(void) /* LCOV_EXCL_START */ -SyncJob::SyncJob(const SyncJob& job) -{ +SyncJob::SyncJob(const SyncJob& job) { __appId = job.__appId; __accountId = job.__accountId; __syncJobName = job.__syncJobName; @@ -61,8 +59,7 @@ SyncJob::SyncJob(const SyncJob& job) SyncJob& -SyncJob::operator = (const SyncJob& job) -{ +SyncJob::operator = (const SyncJob& job) { __appId = job.__appId; __accountId = job.__accountId; __syncJobName = job.__syncJobName; @@ -77,21 +74,19 @@ SyncJob::operator = (const SyncJob& job) void -SyncJob::CleanBundle(bundle* pData) -{ +SyncJob::CleanBundle(bundle* pData) { } /* LCOV_EXCL_STOP */ SyncJob::SyncJob(const string appId, const string syncJobName, int account, bundle* pExtras, int syncOption, int syncJobId, SyncType syncType) - : ISyncJob(syncJobId, syncType) - , __appId(appId) - , __syncJobName(syncJobName) - , __accountId(account) - , __pExtras(NULL) - , __isExpedited(syncOption & SYNC_OPTION_EXPEDITED) - , __noRetry(syncOption & SYNC_OPTION_NO_RETRY) -{ + : ISyncJob(syncJobId, syncType) + , __appId(appId) + , __syncJobName(syncJobName) + , __accountId(account) + , __pExtras(NULL) + , __isExpedited(syncOption & SYNC_OPTION_EXPEDITED) + , __noRetry(syncOption & SYNC_OPTION_NO_RETRY) { LOG_LOGD("syncOption: %d", syncOption); LOG_LOGD("__isExpedited: %d", __isExpedited); @@ -103,31 +98,27 @@ SyncJob::SyncJob(const string appId, const string syncJobName, int account, bund bool -SyncJob::IsExpedited(void) -{ +SyncJob::IsExpedited(void) { return __isExpedited; } /* LCOV_EXCL_START */ bool -SyncJob::IsNoRetry(void) -{ +SyncJob::IsNoRetry(void) { return __noRetry; } void -SyncJob::IncrementWaitCounter() -{ +SyncJob::IncrementWaitCounter() { __waitCounter++; } /* LCOV_EXCL_STOP */ string -SyncJob::ToKey(void) -{ +SyncJob::ToKey(void) { LOG_LOGD("Generating key"); string key; @@ -141,16 +132,14 @@ SyncJob::ToKey(void) /* LCOV_EXCL_START */ static void -bndl_iterator(const char* pKey, const char* pVal, void* pData) -{ +bndl_iterator(const char* pKey, const char* pVal, void* pData) { string str = *((string*)pData); str.append(pKey).append("=").append(pVal).append(" "); } string -SyncJob::GetExtrasInfo(bundle* pData) -{ +SyncJob::GetExtrasInfo(bundle* pData) { string str; if (pData == NULL) { @@ -167,8 +156,7 @@ SyncJob::GetExtrasInfo(bundle* pData) void -SyncJob::Reset(int accountId, bundle* pUserData, int syncOption) -{ +SyncJob::Reset(int accountId, bundle* pUserData, int syncOption) { __accountId = accountId; __noRetry = syncOption & SYNC_OPTION_NO_RETRY; __isExpedited = syncOption & SYNC_OPTION_EXPEDITED; diff --git a/src/sync-service/SyncManager_SyncJob.h b/src/sync-service/SyncManager_SyncJob.h index 2f36f57..4576d98 100644 --- a/src/sync-service/SyncManager_SyncJob.h +++ b/src/sync-service/SyncManager_SyncJob.h @@ -43,8 +43,7 @@ extern "C" { using namespace std; class SyncJob - : public ISyncJob -{ + : public ISyncJob { public: ~SyncJob(void); diff --git a/src/sync-service/SyncManager_SyncJobDispatcher.cpp b/src/sync-service/SyncManager_SyncJobDispatcher.cpp index c0dce1a..247466a 100644 --- a/src/sync-service/SyncManager_SyncJobDispatcher.cpp +++ b/src/sync-service/SyncManager_SyncJobDispatcher.cpp @@ -55,20 +55,17 @@ using namespace std; {*/ -SyncJobDispatcher::SyncJobDispatcher(void) -{ +SyncJobDispatcher::SyncJobDispatcher(void) { } /* LCOV_EXCL_START */ -SyncJobDispatcher::~SyncJobDispatcher(void) -{ +SyncJobDispatcher::~SyncJobDispatcher(void) { } int -SyncJobDispatcher::DispatchSyncJob(SyncJob* syncJob) -{ +SyncJobDispatcher::DispatchSyncJob(SyncJob* syncJob) { int ret = SYNC_ERROR_NONE; LOG_LOGD("Dispatching sync job [%s], [%s]", syncJob->__appId.c_str(), syncJob->__syncJobName.c_str()); @@ -89,8 +86,7 @@ SyncJobDispatcher::DispatchSyncJob(SyncJob* syncJob) void -SyncJobDispatcher::HandleJobCompletedOrCancelledLocked(SyncStatus res, SyncJob *pJob) -{ +SyncJobDispatcher::HandleJobCompletedOrCancelledLocked(SyncStatus res, SyncJob *pJob) { LOG_LOGD("Starts"); switch (res) { @@ -122,8 +118,7 @@ SyncJobDispatcher::HandleJobCompletedOrCancelledLocked(SyncStatus res, SyncJob * void -SyncJobDispatcher::OnEventReceived(Message msg) -{ +SyncJobDispatcher::OnEventReceived(Message msg) { LOG_LOGD("0. Sync Job dispatcher starts"); if (!SyncManager::GetInstance()->__isSyncPermitted) { @@ -176,15 +171,13 @@ SyncJobDispatcher::OnEventReceived(Message msg) /* LCOV_EXCL_START */ bool -sortFunc(const SyncJob* pJob1, const SyncJob* pJob2) -{ +sortFunc(const SyncJob* pJob1, const SyncJob* pJob2) { return false; } void -SyncJobDispatcher::TryStartingNextJobLocked() -{ +SyncJobDispatcher::TryStartingNextJobLocked() { if (SyncManager::GetInstance()->__isWifiConnectionPresent == false && SyncManager::GetInstance()->__isSimDataConnectionPresent == false) { LOG_LOGD("No network available: Skipping sync"); return; diff --git a/src/sync-service/SyncManager_SyncJobDispatcher.h b/src/sync-service/SyncManager_SyncJobDispatcher.h index 52666fc..29252d9 100644 --- a/src/sync-service/SyncManager_SyncJobDispatcher.h +++ b/src/sync-service/SyncManager_SyncJobDispatcher.h @@ -36,8 +36,7 @@ class CurrentSyncContext; class SyncJobDispatcher - :public ISyncWorkerResultListener -{ + :public ISyncWorkerResultListener { public: SyncJobDispatcher(void); diff --git a/src/sync-service/SyncManager_SyncJobQueue.cpp b/src/sync-service/SyncManager_SyncJobQueue.cpp index 766107b..36e0d68 100644 --- a/src/sync-service/SyncManager_SyncJobQueue.cpp +++ b/src/sync-service/SyncManager_SyncJobQueue.cpp @@ -40,44 +40,38 @@ extern "C" { /* LCOV_EXCL_START */ SyncJobQueue::SyncJobQueue(void) - : __pSyncRepositoryEngine(NULL) -{ + : __pSyncRepositoryEngine(NULL) { //Empty } /* LCOV_EXCL_STOP */ -SyncJobQueue::SyncJobQueue(RepositoryEngine* pSyncRepositoryEngine) -{ +SyncJobQueue::SyncJobQueue(RepositoryEngine* pSyncRepositoryEngine) { __pSyncRepositoryEngine = pSyncRepositoryEngine; } /* LCOV_EXCL_START */ -SyncJobQueue::~SyncJobQueue(void) -{ +SyncJobQueue::~SyncJobQueue(void) { //Empty } list< SyncJob* >& -SyncJobQueue::GetSyncJobQueue(void) -{ +SyncJobQueue::GetSyncJobQueue(void) { return __syncJobsQueue; } list< SyncJob* >& -SyncJobQueue::GetPrioritySyncJobQueue(void) -{ +SyncJobQueue::GetPrioritySyncJobQueue(void) { return __prioritySyncJobsQueue; } /* LCOV_EXCL_STOP */ int -SyncJobQueue::AddSyncJob(SyncJob* pSyncJob) -{ +SyncJobQueue::AddSyncJob(SyncJob* pSyncJob) { SyncJob* pSyncJobEntry = dynamic_cast< SyncJob* > (pSyncJob); SYNC_LOGE_RET_RES(pSyncJobEntry != NULL, SYNC_ERROR_SYSTEM, "Failed to get sync job"); @@ -85,8 +79,7 @@ SyncJobQueue::AddSyncJob(SyncJob* pSyncJob) LOG_LOGD("Priority SyncJob Queue size, before = [%d]", __prioritySyncJobsQueue.size()); __prioritySyncJobsQueue.push_back(pSyncJob); LOG_LOGD("Priority SyncJob Queue size, after = [%d]", __prioritySyncJobsQueue.size()); - } - else { + } else { LOG_LOGD("SyncJob Queue size, before = [%d]", __syncJobsQueue.size()); __syncJobsQueue.push_back(pSyncJob); LOG_LOGD("SyncJob Queue size, after = [%d]", __syncJobsQueue.size()); @@ -97,14 +90,12 @@ SyncJobQueue::AddSyncJob(SyncJob* pSyncJob) int -SyncJobQueue::RemoveSyncJob(SyncJob* pSyncJob) -{ +SyncJobQueue::RemoveSyncJob(SyncJob* pSyncJob) { if (pSyncJob ->IsExpedited()) { LOG_LOGD("Priority SyncJob Queue size, before = [%d]", __prioritySyncJobsQueue.size()); __prioritySyncJobsQueue.remove(pSyncJob); LOG_LOGD("Priority SyncJob Queue size, after = [%d]", __prioritySyncJobsQueue.size()); - } - else { + } else { LOG_LOGD("SyncJob Queue size, before = [%d]", __syncJobsQueue.size()); __syncJobsQueue.remove(pSyncJob); LOG_LOGD("SyncJob Queue size, after = [%d]", __syncJobsQueue.size()); @@ -116,8 +107,7 @@ SyncJobQueue::RemoveSyncJob(SyncJob* pSyncJob) /* LCOV_EXCL_START */ void -SyncJobQueue::UpdateAgeCount() -{ +SyncJobQueue::UpdateAgeCount() { list< SyncJob* >::iterator itr = __syncJobsQueue.begin(); while (itr != __syncJobsQueue.end()) { (*itr)->IncrementWaitCounter(); diff --git a/src/sync-service/SyncManager_SyncJobQueue.h b/src/sync-service/SyncManager_SyncJobQueue.h index 5a80e53..6ad5e3b 100644 --- a/src/sync-service/SyncManager_SyncJobQueue.h +++ b/src/sync-service/SyncManager_SyncJobQueue.h @@ -45,8 +45,7 @@ using namespace std; class SyncJob; -class SyncJobQueue -{ +class SyncJobQueue { public: SyncJobQueue(void); diff --git a/src/sync-service/SyncManager_SyncJobsAggregator.cpp b/src/sync-service/SyncManager_SyncJobsAggregator.cpp index 860a5e4..b063aa6 100644 --- a/src/sync-service/SyncManager_SyncJobsAggregator.cpp +++ b/src/sync-service/SyncManager_SyncJobsAggregator.cpp @@ -37,14 +37,12 @@ */ -SyncJobsAggregator::SyncJobsAggregator(void) -{ +SyncJobsAggregator::SyncJobsAggregator(void) { } /* LCOV_EXCL_START */ -SyncJobsAggregator::~SyncJobsAggregator(void) -{ +SyncJobsAggregator::~SyncJobsAggregator(void) { } @@ -63,8 +61,7 @@ SyncJobsAggregator::GetOrCreateSyncJob(const char* pPackageId, const char* pSync bool -SyncJobsAggregator::HasSyncJob(const char* pPackageId, const char* pSyncJobName) -{ +SyncJobsAggregator::HasSyncJob(const char* pPackageId, const char* pSyncJobName) { ISyncJob* pSyncJob = GetSyncJob(pPackageId, pSyncJobName); return pSyncJob != NULL; } @@ -72,8 +69,7 @@ SyncJobsAggregator::HasSyncJob(const char* pPackageId, const char* pSyncJobName) int -SyncJobsAggregator::GenerateSyncJobId(const char* pPackageId) -{ +SyncJobsAggregator::GenerateSyncJobId(const char* pPackageId) { int id = -1; map<string, SyncJobsInfo*>::iterator itr = __syncJobsContainer.find(pPackageId); if (itr != __syncJobsContainer.end()) { @@ -92,8 +88,7 @@ SyncJobsAggregator::GenerateSyncJobId(const char* pPackageId) void -SyncJobsAggregator::AddSyncJob(const char* pPackageId, const char* pSyncJobName, ISyncJob* pSyncJob) -{ +SyncJobsAggregator::AddSyncJob(const char* pPackageId, const char* pSyncJobName, ISyncJob* pSyncJob) { map<string, SyncJobsInfo*>::iterator itr = __syncJobsContainer.find(pPackageId); if (itr != __syncJobsContainer.end()) { LOG_LOGD("Sync Jobs info found for package %s", pPackageId); @@ -111,8 +106,7 @@ SyncJobsAggregator::AddSyncJob(const char* pPackageId, const char* pSyncJobName, int -SyncJobsAggregator::RemoveSyncJob(const char* pPackageId, int syncJobId) -{ +SyncJobsAggregator::RemoveSyncJob(const char* pPackageId, int syncJobId) { map<string, SyncJobsInfo*>::iterator itr = __syncJobsContainer.find(pPackageId); if (itr != __syncJobsContainer.end()) { SyncJobsInfo* pPackageSyncJobsInfo = itr->second; @@ -130,8 +124,7 @@ SyncJobsAggregator::RemoveSyncJob(const char* pPackageId, int syncJobId) /* LCOV_EXCL_START */ int -SyncJobsAggregator::RemoveSyncJob(const char* pPackageId, const char* pSyncJobName) -{ +SyncJobsAggregator::RemoveSyncJob(const char* pPackageId, const char* pSyncJobName) { map<string, SyncJobsInfo*>::iterator itr = __syncJobsContainer.find(pPackageId); if (itr != __syncJobsContainer.end()) { SyncJobsInfo* pPackageSyncJobsInfo = itr->second; @@ -141,8 +134,7 @@ SyncJobsAggregator::RemoveSyncJob(const char* pPackageId, const char* pSyncJobNa __syncJobsContainer.erase(itr); } return ret; - } - else { + } else { LOG_LOGD("Sync jobs for package %s are not found", pPackageId); } @@ -151,8 +143,7 @@ SyncJobsAggregator::RemoveSyncJob(const char* pPackageId, const char* pSyncJobNa int -SyncJobsAggregator::GetSyncJobId(const char* pPackageId, const char* pSyncJobName) -{ +SyncJobsAggregator::GetSyncJobId(const char* pPackageId, const char* pSyncJobName) { ISyncJob* pSyncJob = GetSyncJob(pPackageId, pSyncJobName); int id = (pSyncJob == NULL) ? -1 : pSyncJob->GetSyncJobId(); @@ -162,8 +153,7 @@ SyncJobsAggregator::GetSyncJobId(const char* pPackageId, const char* pSyncJobNam ISyncJob* -SyncJobsAggregator::GetSyncJob(const char* pPackageId, const char* pSyncJobName) -{ +SyncJobsAggregator::GetSyncJob(const char* pPackageId, const char* pSyncJobName) { ISyncJob* pSyncJob = NULL; map<string, SyncJobsInfo*>::iterator itr = __syncJobsContainer.find(pPackageId); if (itr != __syncJobsContainer.end()) { @@ -177,15 +167,13 @@ SyncJobsAggregator::GetSyncJob(const char* pPackageId, const char* pSyncJobName) /* LCOV_EXCL_START */ void -SyncJobsAggregator::HandlePackageUninstalled(const char* pPackageId) -{ +SyncJobsAggregator::HandlePackageUninstalled(const char* pPackageId) { map<string, SyncJobsInfo*>::iterator itr = __syncJobsContainer.find(pPackageId); if (itr != __syncJobsContainer.end()) { SyncJobsInfo* pPackageSyncJobsInfo = itr->second; pPackageSyncJobsInfo->RemoveAllSyncJobs(); __syncJobsContainer.erase(pPackageId); - } - else { + } else { LOG_LOGD("Sync jobs for package %s are not found", pPackageId); } } @@ -193,15 +181,13 @@ SyncJobsAggregator::HandlePackageUninstalled(const char* pPackageId) ISyncJob* -SyncJobsAggregator::GetSyncJob(const char* pPackageId, int syncJobId) -{ +SyncJobsAggregator::GetSyncJob(const char* pPackageId, int syncJobId) { ISyncJob* pSyncJob = NULL; map<string, SyncJobsInfo*>::iterator itr = __syncJobsContainer.find(pPackageId); if (itr != __syncJobsContainer.end()) { SyncJobsInfo* pPackageSyncJobsInfo = itr->second; pSyncJob = pPackageSyncJobsInfo->GetSyncJob(syncJobId); - } - else { + } else { LOG_LOGD("Sync jobs for package %s are not found", pPackageId); /* LCOV_EXCL_LINE */ } return pSyncJob; @@ -210,8 +196,7 @@ SyncJobsAggregator::GetSyncJob(const char* pPackageId, int syncJobId) /* LCOV_EXCL_START */ vector< int > -SyncJobsAggregator::GetSyncJobIDList(const char* pPackageId) -{ +SyncJobsAggregator::GetSyncJobIDList(const char* pPackageId) { vector<int> list; map<string, SyncJobsInfo*>::iterator itr = __syncJobsContainer.find(pPackageId); if (itr != __syncJobsContainer.end()) { @@ -224,8 +209,7 @@ SyncJobsAggregator::GetSyncJobIDList(const char* pPackageId) SyncJobsInfo* -SyncJobsAggregator::GetSyncJobsInfo(const char* pPackageId) -{ +SyncJobsAggregator::GetSyncJobsInfo(const char* pPackageId) { map<string, SyncJobsInfo*>::iterator itr = __syncJobsContainer.find(pPackageId); if (itr != __syncJobsContainer.end()) { return itr->second; @@ -236,8 +220,7 @@ SyncJobsAggregator::GetSyncJobsInfo(const char* pPackageId) map<string, SyncJobsInfo*>& -SyncJobsAggregator::GetAllSyncJobs() -{ +SyncJobsAggregator::GetAllSyncJobs() { return __syncJobsContainer; } diff --git a/src/sync-service/SyncManager_SyncJobsAggregator.h b/src/sync-service/SyncManager_SyncJobsAggregator.h index 65e564d..1a8de82 100644 --- a/src/sync-service/SyncManager_SyncJobsAggregator.h +++ b/src/sync-service/SyncManager_SyncJobsAggregator.h @@ -42,8 +42,7 @@ class SyncJobsInfo; using namespace std; -class SyncJobsAggregator -{ +class SyncJobsAggregator { public: void AddSyncJob(const char* pPackageId, const char* pSyncJobName, ISyncJob* pSyncJob); diff --git a/src/sync-service/SyncManager_SyncJobsInfo.cpp b/src/sync-service/SyncManager_SyncJobsInfo.cpp index fdda19e..69f4128 100644 --- a/src/sync-service/SyncManager_SyncJobsInfo.cpp +++ b/src/sync-service/SyncManager_SyncJobsInfo.cpp @@ -31,14 +31,12 @@ {*/ -SyncJobsInfo::~SyncJobsInfo(void) -{ +SyncJobsInfo::~SyncJobsInfo(void) { } SyncJobsInfo::SyncJobsInfo(string packageId) - : __packageId(packageId) -{ + : __packageId(packageId) { for (int i = 0; i < SYNC_JOB_LIMIT; i++) { __syncJobId[i] = false; } @@ -46,8 +44,7 @@ SyncJobsInfo::SyncJobsInfo(string packageId) int -SyncJobsInfo::AddSyncJob(string syncJobName, ISyncJob* pSyncJob) -{ +SyncJobsInfo::AddSyncJob(string syncJobName, ISyncJob* pSyncJob) { __syncJobsList.insert(make_pair(syncJobName, pSyncJob)); __syncIdList.insert(make_pair(pSyncJob->GetSyncJobId(), pSyncJob)); __syncJobId[pSyncJob->GetSyncJobId()] = true; @@ -57,8 +54,7 @@ SyncJobsInfo::AddSyncJob(string syncJobName, ISyncJob* pSyncJob) ISyncJob* -SyncJobsInfo::GetSyncJob(string syncJobName) -{ +SyncJobsInfo::GetSyncJob(string syncJobName) { map<string, ISyncJob*>::iterator itr = __syncJobsList.find(syncJobName); if (itr != __syncJobsList.end()) { return itr->second; @@ -68,8 +64,7 @@ SyncJobsInfo::GetSyncJob(string syncJobName) ISyncJob* -SyncJobsInfo::GetSyncJob(int syncJobId) -{ +SyncJobsInfo::GetSyncJob(int syncJobId) { map<int, ISyncJob*>::iterator itr = __syncIdList.find(syncJobId); if (itr != __syncIdList.end()) { LOG_LOGD("Found sync job for id [%d]", syncJobId); @@ -81,8 +76,7 @@ SyncJobsInfo::GetSyncJob(int syncJobId) int -SyncJobsInfo::RemoveSyncJob(int syncJobId) -{ +SyncJobsInfo::RemoveSyncJob(int syncJobId) { map<int, ISyncJob*>::iterator itr = __syncIdList.find(syncJobId); if (itr != __syncIdList.end()) { SyncJob* syncJob = dynamic_cast< SyncJob* > (itr->second); @@ -96,8 +90,7 @@ SyncJobsInfo::RemoveSyncJob(int syncJobId) int -SyncJobsInfo::RemoveSyncJob(string syncJobname) -{ +SyncJobsInfo::RemoveSyncJob(string syncJobname) { map<string, ISyncJob*>::iterator itr = __syncJobsList.find(syncJobname); if (itr != __syncJobsList.end()) { ISyncJob* pSyncJob = itr->second; @@ -108,8 +101,7 @@ SyncJobsInfo::RemoveSyncJob(string syncJobname) delete pSyncJob; __syncJobsList.erase(itr); __syncIdList.erase(syncJobId); - } - else { + } else { LOG_LOGD("Sync job name doesnt exists in package [%s] for job name [%s]", __packageId.c_str(), syncJobname.c_str()); /* LCOV_EXCL_LINE */ } @@ -119,8 +111,7 @@ SyncJobsInfo::RemoveSyncJob(string syncJobname) /* LCOV_EXCL_START */ void -SyncJobsInfo::RemoveAllSyncJobs() -{ +SyncJobsInfo::RemoveAllSyncJobs() { LOG_LOGD("Removing Sync jobs for package [%s]. Count [%d] ", __packageId.c_str(), __syncIdList.size()); map<int, ISyncJob*>::iterator itr = __syncIdList.begin(); @@ -133,8 +124,7 @@ SyncJobsInfo::RemoveAllSyncJobs() int -SyncJobsInfo::GetNextSyncJobId() -{ +SyncJobsInfo::GetNextSyncJobId() { int value = -1; int idx; @@ -155,8 +145,7 @@ SyncJobsInfo::GetNextSyncJobId() /* LCOV_EXCL_START */ vector <int> -SyncJobsInfo::GetSyncJobIdList() -{ +SyncJobsInfo::GetSyncJobIdList() { vector<int> idList; int idx; @@ -171,15 +160,13 @@ SyncJobsInfo::GetSyncJobIdList() map<int, ISyncJob*>& -SyncJobsInfo::GetAllSyncJobs() -{ +SyncJobsInfo::GetAllSyncJobs() { return __syncIdList; } int -SyncJobsInfo::GetSyncJobsCount() -{ +SyncJobsInfo::GetSyncJobsCount() { return __syncJobsList.size(); } diff --git a/src/sync-service/SyncManager_SyncJobsInfo.h b/src/sync-service/SyncManager_SyncJobsInfo.h index d0b7c31..d939ca7 100644 --- a/src/sync-service/SyncManager_SyncJobsInfo.h +++ b/src/sync-service/SyncManager_SyncJobsInfo.h @@ -28,13 +28,15 @@ #include "SyncManager_ISyncJob.h" #include "SyncManager_SyncDefines.h" + /*namespace _SyncManager { */ + using namespace std; -class SyncJobsInfo -{ + +class SyncJobsInfo { public: ~SyncJobsInfo(void); diff --git a/src/sync-service/SyncManager_SyncManager.cpp b/src/sync-service/SyncManager_SyncManager.cpp index fc0c86e..a6bc2f6 100644 --- a/src/sync-service/SyncManager_SyncManager.cpp +++ b/src/sync-service/SyncManager_SyncManager.cpp @@ -53,8 +53,7 @@ int DELAY_RETRY_SYNC_IN_PROGRESS_IN_SECONDS = 10; void -SyncManager::SetSyncSetting(bool enable) -{ +SyncManager::SetSyncSetting(bool enable) { bool wasSuspended = (__isSyncPermitted == false); __isSyncPermitted = enable; if (wasSuspended && __isSyncPermitted) { @@ -65,16 +64,14 @@ SyncManager::SetSyncSetting(bool enable) /* LCOV_EXCL_START */ bool -SyncManager::GetSyncSetting() -{ +SyncManager::GetSyncSetting() { return __isSyncPermitted; } /* LCOV_EXCL_STOP */ int -SyncManager::AddOnDemandSync(string pPackageId, const char* syncJobName, int accountId, bundle* pExtras, int syncOption, int syncJobId) -{ +SyncManager::AddOnDemandSync(string pPackageId, const char* syncJobName, int accountId, bundle* pExtras, int syncOption, int syncJobId) { const char* pSyncAdapterApp = __pSyncAdapterAggregator->GetSyncAdapter(pPackageId.c_str()); SYNC_LOGE_RET_RES(pSyncAdapterApp != NULL, SYNC_ERROR_SYNC_ADAPTER_NOT_FOUND, "Sync adapter cannot be found for package %s", pPackageId.c_str()); @@ -97,8 +94,7 @@ SyncManager::AddOnDemandSync(string pPackageId, const char* syncJobName, int acc int -SyncManager::CancelSync(SyncJob* pSyncJob) -{ +SyncManager::CancelSync(SyncJob* pSyncJob) { LOG_LOGD("SyncManager::CancelSync Starts"); ClearScheduledSyncJobs(pSyncJob); @@ -111,8 +107,7 @@ SyncManager::CancelSync(SyncJob* pSyncJob) int -SyncManager::AddPeriodicSyncJob(string pPackageId, const char* syncJobName, int accountId, bundle* pExtras, int syncOption, int syncJobId, long period) -{ +SyncManager::AddPeriodicSyncJob(string pPackageId, const char* syncJobName, int accountId, bundle* pExtras, int syncOption, int syncJobId, long period) { if (period < 1800) { /* LCOV_EXCL_START */ LOG_LOGD("Requested period %d is less than minimum, rounding up to 30 mins", period); @@ -148,8 +143,7 @@ SyncManager::AddPeriodicSyncJob(string pPackageId, const char* syncJobName, int int -SyncManager::AddDataSyncJob(string pPackageId, const char* syncJobName, int accountId, bundle* pExtras, int syncOption, int syncJobId, const char* pCapability) -{ +SyncManager::AddDataSyncJob(string pPackageId, const char* syncJobName, int accountId, bundle* pExtras, int syncOption, int syncJobId, const char* pCapability) { const char* pSyncAdapterApp = __pSyncAdapterAggregator->GetSyncAdapter(pPackageId.c_str()); SYNC_LOGE_RET_RES(pSyncAdapterApp != NULL, SYNC_ERROR_SYNC_ADAPTER_NOT_FOUND, "Sync adapter cannot be found for package %s", pPackageId.c_str()); LOG_LOGD("Found sync adapter [%s]", pSyncAdapterApp); @@ -175,8 +169,7 @@ SyncManager::AddDataSyncJob(string pPackageId, const char* syncJobName, int acco int -SyncManager::RemoveSyncJob(string packageId, int syncJobId) -{ +SyncManager::RemoveSyncJob(string packageId, int syncJobId) { LOG_LOGD("Starts"); int ret = SYNC_ERROR_NONE; @@ -189,8 +182,7 @@ SyncManager::RemoveSyncJob(string packageId, int syncJobId) SYNC_LOGE_RET_RES(dataSyncJob != NULL, SYNC_ERROR_SYSTEM, "Failed to cast %d", syncJobId); __pDataChangeSyncScheduler->RemoveDataSyncJob(dataSyncJob); - } - else if (syncType == SYNC_TYPE_PERIODIC) { + } else if (syncType == SYNC_TYPE_PERIODIC) { PeriodicSyncJob* periodicSyncJob = dynamic_cast< PeriodicSyncJob* > (pSyncJob); SYNC_LOGE_RET_RES(periodicSyncJob != NULL, SYNC_ERROR_SYSTEM, "Failed to cast %d", syncJobId); @@ -211,15 +203,13 @@ SyncManager::RemoveSyncJob(string packageId, int syncJobId) /* LCOV_EXCL_START */ SyncJobQueue* -SyncManager::GetSyncJobQueue(void) const -{ +SyncManager::GetSyncJobQueue(void) const { return __pSyncJobQueue; } int -SyncManager::AddToSyncQueue(SyncJob* pJob) -{ +SyncManager::AddToSyncQueue(SyncJob* pJob) { //No need to add mutex here, will be called during startup only return __pSyncJobQueue->AddSyncJob(pJob); } @@ -227,16 +217,14 @@ SyncManager::AddToSyncQueue(SyncJob* pJob) void -SyncManager::AddRunningAccount(int account_id, int pid) -{ +SyncManager::AddRunningAccount(int account_id, int pid) { __runningAccounts.insert(make_pair(account_id, pid)); } /* LCOV_EXCL_START */ int -SyncManager::GetAccountPid(int account_id) -{ +SyncManager::GetAccountPid(int account_id) { map<int, int>::iterator it = __runningAccounts.find(account_id); if (it != __runningAccounts.end()) { return it->second; @@ -246,8 +234,7 @@ SyncManager::GetAccountPid(int account_id) } -bool accountCb(account_h account, void* pUserData) -{ +bool accountCb(account_h account, void* pUserData) { int account_id = -1; int ret = account_get_account_id(account, &account_id); if (ret == ACCOUNT_ERROR_NONE) { @@ -259,8 +246,7 @@ bool accountCb(account_h account, void* pUserData) void -SyncManager::UpdateRunningAccounts(void) -{ +SyncManager::UpdateRunningAccounts(void) { #if !defined(_SEC_FEATURE_CONTAINER_ENABLE) __runningAccounts.clear(); if (account_foreach_account_from_db(accountCb, this) < 0) { @@ -271,8 +257,7 @@ SyncManager::UpdateRunningAccounts(void) #if !defined(_SEC_FEATURE_CONTAINER_ENABLE) -bool OnAccountUpdated(const char* pEventType, int acountId, void* pUserData) -{ +bool OnAccountUpdated(const char* pEventType, int acountId, void* pUserData) { //TODO: will go in enhancements SyncManager* pSyncManager = (SyncManager*)pUserData; pSyncManager->UpdateRunningAccounts(); @@ -285,8 +270,7 @@ bool OnAccountUpdated(const char* pEventType, int acountId, void* pUserData) void -SyncManager::OnDNetStatusChanged(bool connected) -{ +SyncManager::OnDNetStatusChanged(bool connected) { LOG_LOGD("Data network change detected %d", connected); //bool wasConnected = __isSimDataConnectionPresent; @@ -298,8 +282,7 @@ SyncManager::OnDNetStatusChanged(bool connected) void -SyncManager::OnWifiStatusChanged(bool connected) -{ +SyncManager::OnWifiStatusChanged(bool connected) { LOG_LOGD("Wifi network change detected %d", connected); //bool wasConnected = __isWifiConnectionPresent; @@ -311,15 +294,13 @@ SyncManager::OnWifiStatusChanged(bool connected) void -SyncManager::OnBluetoothStatusChanged(bool connected) -{ +SyncManager::OnBluetoothStatusChanged(bool connected) { LOG_LOGD("Bluetooth status %d", connected); } void -SyncManager::OnStorageStatusChanged(int value) -{ +SyncManager::OnStorageStatusChanged(int value) { LOG_LOGD("Storage status changed %d", value); switch (value) { case LOW_MEMORY_NORMAL: @@ -336,15 +317,13 @@ SyncManager::OnStorageStatusChanged(int value) void -SyncManager::OnUPSModeChanged(bool enable) -{ +SyncManager::OnUPSModeChanged(bool enable) { __isUPSModeEnabled = enable; } void -SyncManager::OnBatteryStatusChanged(int value) -{ +SyncManager::OnBatteryStatusChanged(int value) { LOG_LOGD("SyncManager::OnBatteryStatusChanged Starts"); switch (value) { @@ -366,8 +345,7 @@ SyncManager::OnBatteryStatusChanged(int value) } -static int OnPackageUninstalled(unsigned int userId, int reqId, const char* pPkgType, const char* pPkgId, const char* pKey, const char* pVal, const void* pMsg, void* pData) -{ +static int OnPackageUninstalled(unsigned int userId, int reqId, const char* pPkgType, const char* pPkgId, const char* pKey, const char* pVal, const void* pMsg, void* pData) { LOG_LOGD("OnPackageUninstalled [type %s] type [pkdId:%s]", pPkgType, pPkgId); if (!strcmp("end", pKey) && !strcmp("ok", pVal)) { SyncManager::GetInstance()->GetSyncAdapterAggregator()->HandlePackageUninstalled(pPkgId); @@ -380,8 +358,7 @@ static int OnPackageUninstalled(unsigned int userId, int reqId, const char* pPkg string -SyncManager::GetPkgIdByAppId(const char* pAppId) -{ +SyncManager::GetPkgIdByAppId(const char* pAppId) { pkgmgrinfo_appinfo_h handle; string pkgId; @@ -392,13 +369,11 @@ SyncManager::GetPkgIdByAppId(const char* pAppId) result = pkgmgrinfo_appinfo_get_pkgid(handle, &pPkgId); if (result == PMINFO_R_OK) { pkgId.append(pPkgId); - } - else { + } else { LOG_LOGD("Failed to get Pkg ID from App Id [%s]", pAppId); /* LCOV_EXCL_LINE */ } pkgmgrinfo_appinfo_destroy_appinfo(handle); - } - else { + } else { LOG_LOGD("Failed to get pkgmgr AppInfoHandle from App Id [%s]", pAppId); /* LCOV_EXCL_LINE */ } @@ -408,8 +383,7 @@ SyncManager::GetPkgIdByAppId(const char* pAppId) /* LCOV_EXCL_START */ string -SyncManager::GetPkgIdByCommandline(const char* pCommandLine) -{ +SyncManager::GetPkgIdByCommandline(const char* pCommandLine) { string pkgId; if (pCommandLine != NULL) { char cmd[100]; @@ -439,13 +413,11 @@ SyncManager::GetPkgIdByCommandline(const char* pCommandLine) void -SyncManager::RegisterForNetworkChange(void) -{ +SyncManager::RegisterForNetworkChange(void) { if (__pNetworkChangeListener) { if(!__pNetworkChangeListener->RegisterNetworkChangeListener()) { LOG_LOGD("Network listener : Success"); - } - else { + } else { LOG_LOGD("Network listener : Failed"); /* LCOV_EXCL_LINE */ } } @@ -454,8 +426,7 @@ SyncManager::RegisterForNetworkChange(void) /* LCOV_EXCL_START */ int -SyncManager::DeRegisterForNetworkChange(void) -{ +SyncManager::DeRegisterForNetworkChange(void) { if (__pNetworkChangeListener) { return(__pNetworkChangeListener->DeRegisterNetworkChangeListener()); } @@ -463,8 +434,7 @@ SyncManager::DeRegisterForNetworkChange(void) } -void OnUPSModeChangedCb(keynode_t* pKey, void* pData) -{ +void OnUPSModeChangedCb(keynode_t* pKey, void* pData) { int value = vconf_keynode_get_int(pKey); bool enabled = (value == SETTING_PSMODE_EMERGENCY); LOG_LOGD("UPS mode status %d , value %d", enabled, value); @@ -475,12 +445,10 @@ void OnUPSModeChangedCb(keynode_t* pKey, void* pData) void -SyncManager::RegisterForUPSModeChange(void) -{ +SyncManager::RegisterForUPSModeChange(void) { if(vconf_notify_key_changed(VCONFKEY_SETAPPL_PSMODE, OnUPSModeChangedCb, NULL) == 0) { LOG_LOGD("UPS mode listener : Success"); - } - else { + } else { LOG_LOGD("UPS mode listener : Failed"); /* LCOV_EXCL_LINE */ } } @@ -488,8 +456,7 @@ SyncManager::RegisterForUPSModeChange(void) /* LCOV_EXCL_START */ int -SyncManager::DeRegisterForUPSModeChange(void) -{ +SyncManager::DeRegisterForUPSModeChange(void) { LOG_LOGD("De Registering UPS mode listener"); return vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE, OnUPSModeChangedCb); @@ -498,13 +465,11 @@ SyncManager::DeRegisterForUPSModeChange(void) void -SyncManager::RegisterForStorageChange(void) -{ +SyncManager::RegisterForStorageChange(void) { if (__pStorageListener) { if (__pStorageListener->RegisterStorageChangeListener() == 0) { LOG_LOGD("Storage listener : Success"); - } - else { + } else { LOG_LOGD("Storage listener : Failed"); /* LCOV_EXCL_LINE */ } } @@ -513,8 +478,7 @@ SyncManager::RegisterForStorageChange(void) /* LCOV_EXCL_START */ int -SyncManager::DeRegisterForStorageChange(void) -{ +SyncManager::DeRegisterForStorageChange(void) { if (__pStorageListener) { return(__pStorageListener->DeRegisterStorageChangeListener()); } @@ -524,13 +488,11 @@ SyncManager::DeRegisterForStorageChange(void) void -SyncManager::RegisterForBatteryStatus(void) -{ +SyncManager::RegisterForBatteryStatus(void) { if (__pBatteryStatusListener) { if(__pBatteryStatusListener->RegisterBatteryStatusListener() == 0) { LOG_LOGD("Battery listener : Success"); - } - else { + } else { LOG_LOGD("Battery listener : Failed"); /* LCOV_EXCL_LINE */ } } @@ -539,8 +501,7 @@ SyncManager::RegisterForBatteryStatus(void) /* LCOV_EXCL_START */ int -SyncManager::DeRegisterForBatteryStatus(void) -{ +SyncManager::DeRegisterForBatteryStatus(void) { if (__pBatteryStatusListener) { return(__pBatteryStatusListener->DeRegisterBatteryStatusListener()); } @@ -549,13 +510,11 @@ SyncManager::DeRegisterForBatteryStatus(void) /* LCOV_EXCL_STOP */ -void SyncManager::RegisterForDataChange(void) -{ +void SyncManager::RegisterForDataChange(void) { if (__pDataChangeSyncScheduler) { if(!__pDataChangeSyncScheduler->RegisterDataChangeListeners()) { LOG_LOGD("Data listener : Success"); - } - else { + } else { LOG_LOGD("Data listener : Failed"); /* LCOV_EXCL_LINE */ } } @@ -563,8 +522,7 @@ void SyncManager::RegisterForDataChange(void) /* LCOV_EXCL_START */ -int SyncManager::DeRegisterForDataChange(void) -{ +int SyncManager::DeRegisterForDataChange(void) { if (__pDataChangeSyncScheduler) { return (__pDataChangeSyncScheduler->DeRegisterDataChangeListeners()); } @@ -575,8 +533,7 @@ int SyncManager::DeRegisterForDataChange(void) int -SyncManager::SetPkgMgrClientStatusChangedListener(void) -{ +SyncManager::SetPkgMgrClientStatusChangedListener(void) { int eventType = PKGMGR_CLIENT_STATUS_UNINSTALL; if (pkgmgr_client_set_status_type(__pPkgmgrClient, eventType) != PKGMGR_R_OK) { @@ -603,16 +560,14 @@ SyncManager::SetPkgMgrClientStatusChangedListener(void) /* LCOV_EXCL_START */ RepositoryEngine* -SyncManager::GetSyncRepositoryEngine(void) -{ +SyncManager::GetSyncRepositoryEngine(void) { return __pSyncRepositoryEngine; } /* LCOV_EXCL_STOP */ void -SyncManager::ClearScheduledSyncJobs(SyncJob* pSyncJob) -{ +SyncManager::ClearScheduledSyncJobs(SyncJob* pSyncJob) { pthread_mutex_lock(&__syncJobQueueMutex); __pSyncJobQueue->RemoveSyncJob(pSyncJob); pthread_mutex_unlock(&__syncJobQueueMutex); @@ -620,8 +575,7 @@ SyncManager::ClearScheduledSyncJobs(SyncJob* pSyncJob) void -SyncManager::CancelActiveSyncJob(SyncJob* pSyncJob) -{ +SyncManager::CancelActiveSyncJob(SyncJob* pSyncJob) { pthread_mutex_lock(&__currJobQueueMutex); CurrentSyncContext *pCurrSyncContext = __pCurrentSyncJobQueue->GetCurrJobfromKey(pSyncJob->__key); pthread_mutex_unlock(&__currJobQueueMutex); @@ -652,14 +606,12 @@ SyncManager::SyncManager(void) , __pSyncJobDispatcher(NULL) , __pSyncAdapterAggregator(NULL) , __pCurrentSyncJobQueue(NULL) - , __accountSubscriptionHandle(NULL) -{ + , __accountSubscriptionHandle(NULL) { } bool -SyncManager::Construct(void) -{ +SyncManager::Construct(void) { //interface=org.freedesktop.systemd1.Manager Signal=StartupFinished - bootcomplete dbus signal LOG_LOGD("Sync manager initialization begins"); @@ -757,8 +709,7 @@ SyncManager::Construct(void) /* LCOV_EXCL_START */ -SyncManager::~SyncManager(void) -{ +SyncManager::~SyncManager(void) { LOG_LOGD("SyncManager::~SyncManager() Starts"); pthread_mutex_destroy(&__syncJobQueueMutex); @@ -796,8 +747,7 @@ SyncManager::~SyncManager(void) bool -SyncManager::AreAccountsEqual(account_h account1, account_h account2) -{ +SyncManager::AreAccountsEqual(account_h account1, account_h account2) { bool isEqual = false; int id1, id2; if (account_get_account_id(account1, &id1) < 0) { @@ -825,8 +775,7 @@ SyncManager::AreAccountsEqual(account_h account1, account_h account2) bool -SyncManager::IsActiveAccount(vector<account_h> accounts, account_h account) -{ +SyncManager::IsActiveAccount(vector<account_h> accounts, account_h account) { return true; //TODO: uncomment while implementing __running accounts logic /* @@ -845,29 +794,25 @@ SyncManager::IsActiveAccount(vector<account_h> accounts, account_h account) SyncAdapterAggregator* -SyncManager::GetSyncAdapterAggregator() -{ +SyncManager::GetSyncAdapterAggregator() { return __pSyncAdapterAggregator; } SyncJobsAggregator* -SyncManager::GetSyncJobsAggregator() -{ +SyncManager::GetSyncJobsAggregator() { return __pSyncJobsAggregator; } ManageIdleState* -SyncManager::GetManageIdleState() -{ +SyncManager::GetManageIdleState() { return __pManageIdleState; } void -SyncManager::HandleShutdown(void) -{ +SyncManager::HandleShutdown(void) { pthread_mutex_lock(&__syncJobQueueMutex); __pSyncRepositoryEngine->SaveCurrentState(); pthread_mutex_unlock(&__syncJobQueueMutex); @@ -876,8 +821,7 @@ SyncManager::HandleShutdown(void) /* LCOV_EXCL_START */ void -SyncManager::RecordSyncAdapter(void) -{ +SyncManager::RecordSyncAdapter(void) { pthread_mutex_lock(&__syncJobQueueMutex); __pSyncRepositoryEngine->SaveCurrentSyncAdapter(); pthread_mutex_unlock(&__syncJobQueueMutex); @@ -885,8 +829,7 @@ SyncManager::RecordSyncAdapter(void) void -SyncManager::RecordSyncJob(void) -{ +SyncManager::RecordSyncJob(void) { pthread_mutex_lock(&__syncJobQueueMutex); __pSyncRepositoryEngine->SaveCurrentSyncJob(); pthread_mutex_unlock(&__syncJobQueueMutex); @@ -895,8 +838,7 @@ SyncManager::RecordSyncJob(void) bool -SyncManager::GetSyncSupport(int accountId) -{ +SyncManager::GetSyncSupport(int accountId) { account_h accountHandle = NULL; int ret = account_create(&accountHandle); LOG_LOGE_BOOL(ret == ACCOUNT_ERROR_NONE, "account access failed [%d]", ret); @@ -923,8 +865,7 @@ SyncManager::GetSyncSupport(int accountId) /* LCOV_EXCL_START */ void -SyncManager::SendCancelSyncsMessage(SyncJob* pJob) -{ +SyncManager::SendCancelSyncsMessage(SyncJob* pJob) { LOG_LOGD("SyncManager::SendCancelSyncsMessage :sending MESSAGE_CANCEL"); Message msg; msg.type = SYNC_CANCEL; @@ -934,8 +875,7 @@ SyncManager::SendCancelSyncsMessage(SyncJob* pJob) void -SyncManager::OnResultReceived(SyncStatus res, string appId, string packageId, const char* syncJobName) -{ +SyncManager::OnResultReceived(SyncStatus res, string appId, string packageId, const char* syncJobName) { string key; key.append("id:").append(appId).append(syncJobName); @@ -946,8 +886,7 @@ SyncManager::OnResultReceived(SyncStatus res, string appId, string packageId, co pthread_mutex_unlock(&__currJobQueueMutex); if (pCurrSyncContext == NULL) { LOG_LOGD("Sync context cant be found for %s", key.c_str()); - } - else { + } else { g_source_remove(pCurrSyncContext->GetTimerId()); SyncJob* pJob = pCurrSyncContext->GetSyncJob(); SendSyncCompletedOrCancelledMessage(pJob, res); @@ -962,8 +901,7 @@ SyncManager::OnResultReceived(SyncStatus res, string appId, string packageId, co void -SyncManager::CloseCurrentSyncContext(CurrentSyncContext *activeSyncContext) -{ +SyncManager::CloseCurrentSyncContext(CurrentSyncContext *activeSyncContext) { if (activeSyncContext == NULL) { LOG_LOGD("Invalid Parameter"); return; @@ -975,8 +913,7 @@ SyncManager::CloseCurrentSyncContext(CurrentSyncContext *activeSyncContext) void -SyncManager::SendSyncCompletedOrCancelledMessage(SyncJob *pJob, int result) -{ +SyncManager::SendSyncCompletedOrCancelledMessage(SyncJob *pJob, int result) { LOG_LOGD("SyncManager::SendSyncCompletedOrCancelledMessage"); Message msg; msg.res = (SyncStatus)result; @@ -987,15 +924,13 @@ SyncManager::SendSyncCompletedOrCancelledMessage(SyncJob *pJob, int result) void -SyncManager::AlertForChange() -{ +SyncManager::AlertForChange() { SendSyncCheckAlarmMessage(); } void -SyncManager::SendSyncAlarmMessage() -{ +SyncManager::SendSyncAlarmMessage() { LOG_LOGD("Fire SYNC_ALARM"); Message msg; msg.type = SYNC_ALARM; @@ -1005,8 +940,7 @@ SyncManager::SendSyncAlarmMessage() void -SyncManager::SendSyncCheckAlarmMessage() -{ +SyncManager::SendSyncCheckAlarmMessage() { LOG_LOGD("Fire SYNC_CHECK_ALARM"); Message msg; msg.type = SYNC_CHECK_ALARM; @@ -1017,8 +951,7 @@ SyncManager::SendSyncCheckAlarmMessage() /* LCOV_EXCL_START */ bool -SyncManager::GetBundleVal(const char* pVal) -{ +SyncManager::GetBundleVal(const char* pVal) { if (pVal == NULL) { return false; } @@ -1027,8 +960,7 @@ SyncManager::GetBundleVal(const char* pVal) } -bool get_capability_all_cb(const char* capability_type, account_capability_state_e capability_state, void *user_data) -{ +bool get_capability_all_cb(const char* capability_type, account_capability_state_e capability_state, void *user_data) { set<string>* pSsncableCapabilities = (set<string>*)user_data; if (capability_state == ACCOUNT_CAPABILITY_ENABLED) { @@ -1041,8 +973,7 @@ bool get_capability_all_cb(const char* capability_type, account_capability_state void -SyncManager::ScheduleSyncJob(SyncJob* pJob, bool fireCheckAlarm) -{ +SyncManager::ScheduleSyncJob(SyncJob* pJob, bool fireCheckAlarm) { int err; pthread_mutex_lock(&__syncJobQueueMutex); err = __pSyncJobQueue->AddSyncJob(pJob); @@ -1053,12 +984,9 @@ SyncManager::ScheduleSyncJob(SyncJob* pJob, bool fireCheckAlarm) LOG_LOGD("Added sync job [%s] to Main queue, Initiating dispatch sequence", pJob->__key.c_str()); SendSyncCheckAlarmMessage(); } - } - /* LCOV_EXCL_START */ - else if (err == SYNC_ERROR_ALREADY_IN_PROGRESS) { + } /* LCOV_EXCL_START */ else if (err == SYNC_ERROR_ALREADY_IN_PROGRESS) { LOG_LOGD("Duplicate sync job [%s], No need to enqueue", pJob->__key.c_str()); - } - else { + } else { LOG_LOGD("Failed to add into sync job list"); } /* LCOV_EXCL_STOP */ @@ -1067,8 +995,7 @@ SyncManager::ScheduleSyncJob(SyncJob* pJob, bool fireCheckAlarm) /* LCOV_EXCL_START */ void -SyncManager::TryToRescheduleJob(SyncStatus syncResult, SyncJob* pJob) -{ +SyncManager::TryToRescheduleJob(SyncStatus syncResult, SyncJob* pJob) { if (pJob == NULL) { LOG_LOGD("Invalid parameter"); return; @@ -1084,8 +1011,7 @@ SyncManager::TryToRescheduleJob(SyncStatus syncResult, SyncJob* pJob) bool -SyncManager::IsJobActive(CurrentSyncContext *pCurrSync) -{ +SyncManager::IsJobActive(CurrentSyncContext *pCurrSync) { if (pCurrSync == NULL) { LOG_LOGD("Invalid parameter"); return false; diff --git a/src/sync-service/SyncManager_SyncManager.h b/src/sync-service/SyncManager_SyncManager.h index 95afe32..58f47d1 100644 --- a/src/sync-service/SyncManager_SyncManager.h +++ b/src/sync-service/SyncManager_SyncManager.h @@ -61,8 +61,7 @@ class SyncJobsAggregator; using namespace std; class SyncManager - : public SyncWorker, public Singleton < SyncManager > -{ + : public SyncWorker, public Singleton < SyncManager > { public: void SetSyncSetting(bool enable); diff --git a/src/sync-service/SyncManager_SyncService.cpp b/src/sync-service/SyncManager_SyncService.cpp index 81d366c..f3e6de3 100644 --- a/src/sync-service/SyncManager_SyncService.cpp +++ b/src/sync-service/SyncManager_SyncService.cpp @@ -80,8 +80,7 @@ string sa_app_id; static guint signal_id = -1; -void convert_to_path(char app_id[]) -{ +void convert_to_path(char app_id[]) { int i = 0; while (app_id[i] != '\0') { if (app_id[i] == '.' || app_id[i] == '-') { @@ -93,8 +92,7 @@ void convert_to_path(char app_id[]) int -SyncService::StartService() -{ +SyncService::StartService() { __pSyncManagerInstance = SyncManager::GetInstance(); if (__pSyncManagerInstance == NULL) { /* LCOV_EXCL_START */ @@ -126,8 +124,7 @@ SyncService::StartService() TizenSyncAdapter* adapter; -GDBusErrorEntry _sync_errors[] = -{ +GDBusErrorEntry _sync_errors[] = { {SYNC_ERROR_NONE, SYNC_ERROR_PREFIX".NoError"}, {SYNC_ERROR_OUT_OF_MEMORY, SYNC_ERROR_PREFIX".OutOfMemory"}, {SYNC_ERROR_IO_ERROR, SYNC_ERROR_PREFIX".IOError"}, @@ -143,8 +140,7 @@ GDBusErrorEntry _sync_errors[] = static GQuark -_sync_error_quark(void) -{ +_sync_error_quark(void) { static volatile gsize quark_volatile = 0; g_dbus_error_register_error_domain(SYNC_ERROR_DOMAIN, @@ -157,8 +153,7 @@ _sync_error_quark(void) static guint -get_caller_pid(GDBusMethodInvocation* pMethodInvocation) -{ +get_caller_pid(GDBusMethodInvocation* pMethodInvocation) { guint pid = -1; const char *name = NULL; name = g_dbus_method_invocation_get_sender(pMethodInvocation); @@ -190,8 +185,7 @@ get_caller_pid(GDBusMethodInvocation* pMethodInvocation) static int -__get_data_for_checking_privilege(GDBusMethodInvocation *invocation, char **client, char **session, char **user) -{ +__get_data_for_checking_privilege(GDBusMethodInvocation *invocation, char **client, char **session, char **user) { GDBusConnection *gdbus_conn = NULL; char *sender = NULL; int ret = CYNARA_API_SUCCESS; @@ -244,8 +238,7 @@ __get_data_for_checking_privilege(GDBusMethodInvocation *invocation, char **clie static int -__check_privilege_by_cynara(const char *client, const char *session, const char *user, const char *privilege) -{ +__check_privilege_by_cynara(const char *client, const char *session, const char *user, const char *privilege) { int ret = CYNARA_API_ACCESS_ALLOWED; char err_buf[128] = {0, }; @@ -268,8 +261,7 @@ __check_privilege_by_cynara(const char *client, const char *session, const char int -_check_privilege(GDBusMethodInvocation *invocation, const char *privilege) -{ +_check_privilege(GDBusMethodInvocation *invocation, const char *privilege) { int ret = SYNC_ERROR_NONE; char *client = NULL; char *session = NULL; @@ -308,21 +300,18 @@ _check_privilege(GDBusMethodInvocation *invocation, const char *privilege) } -int _check_privilege_alarm_set(GDBusMethodInvocation *invocation) -{ +int _check_privilege_alarm_set(GDBusMethodInvocation *invocation) { return _check_privilege(invocation, PRIV_ALARM_SET); } #if defined(_SEC_FEATURE_CALENDAR_CONTACTS_ENABLE) -int _check_privilege_calendar_read(GDBusMethodInvocation *invocation) -{ +int _check_privilege_calendar_read(GDBusMethodInvocation *invocation) { return _check_privilege(invocation, PRIV_CALENDAR_READ); } -int _check_privilege_contact_read(GDBusMethodInvocation *invocation) -{ +int _check_privilege_contact_read(GDBusMethodInvocation *invocation) { return _check_privilege(invocation, PRIV_CONTACT_READ); } #endif @@ -330,8 +319,7 @@ int _check_privilege_contact_read(GDBusMethodInvocation *invocation) /* LCOV_EXCL_START */ int -SyncService::TriggerStartSync(const char* appId, int accountId, const char* syncJobName, bool isDataSync, bundle* pExtras) -{ +SyncService::TriggerStartSync(const char* appId, int accountId, const char* syncJobName, bool isDataSync, bundle* pExtras) { LOG_LOGD("appId [%s] jobname [%s]", appId, syncJobName); app_control_h app_control; @@ -386,8 +374,7 @@ SyncService::TriggerStartSync(const char* appId, int accountId, const char* sync } return SYNC_ERROR_SYSTEM; } - } - else { + } else { bool isRunning = false; app_manager_is_running(appId, &isRunning); if (!isRunning) { @@ -405,8 +392,7 @@ SyncService::TriggerStartSync(const char* appId, int accountId, const char* sync sa_app_id.clear(); ret = app_control_send_launch_request(app_control, NULL, NULL); SYNC_LOGE_RET_RES(ret == APP_CONTROL_ERROR_NONE, SYNC_ERROR_SYSTEM, "app control launch request failed %d", ret); - } - else { + } else { LOG_LOGD("app is already running"); } @@ -417,8 +403,7 @@ SyncService::TriggerStartSync(const char* appId, int accountId, const char* sync if (pSyncAdapter) { GVariant* pBundle = marshal_bundle(pExtras); tizen_sync_adapter_emit_start_sync(pSyncAdapter, accountId, syncJobName, isDataSync, pBundle); - } - else { + } else { LOG_LOGD("Sync adapter entry not found"); return SYNC_ERROR_SYSTEM; } @@ -428,8 +413,7 @@ SyncService::TriggerStartSync(const char* appId, int accountId, const char* sync void -SyncService::TriggerStopSync(const char* appId, int accountId, const char* syncJobName, bool isDataSync, bundle* pExtras) -{ +SyncService::TriggerStopSync(const char* appId, int accountId, const char* syncJobName, bool isDataSync, bundle* pExtras) { LOG_LOGD("Trigger stop sync %s", appId); //int id = -1; @@ -446,8 +430,7 @@ SyncService::TriggerStopSync(const char* appId, int accountId, const char* syncJ int -SyncService::RequestOnDemandSync(const char* pPackageId, const char* pSyncJobName, int accountId, bundle* pExtras, int syncOption, int* pSyncJobId) -{ +SyncService::RequestOnDemandSync(const char* pPackageId, const char* pSyncJobName, int accountId, bundle* pExtras, int syncOption, int* pSyncJobId) { int ret = SYNC_ERROR_NONE; int syncJobId = -1; @@ -463,8 +446,7 @@ SyncService::RequestOnDemandSync(const char* pPackageId, const char* pSyncJobNam pSyncJobEntry->Reset(accountId, pExtras, syncOption); LOG_LOGD("sync parameters are updated with new parameters", pSyncJobName); - } - else { + } else { syncJobId = pSyncJobsAggregator->GenerateSyncJobId(pPackageId); SYNC_LOGE_RET_RES(syncJobId <= SYNC_JOB_LIMIT, SYNC_ERROR_QUOTA_EXCEEDED, "Sync job quota exceeded"); @@ -481,8 +463,7 @@ SyncService::RequestOnDemandSync(const char* pPackageId, const char* pSyncJobNam int -SyncService::RequestPeriodicSync(const char* pPackageId, const char* pSyncJobName, int accountId, bundle* pExtras, int syncOption, unsigned long pollFrequency, int* pSyncJobId) -{ +SyncService::RequestPeriodicSync(const char* pPackageId, const char* pSyncJobName, int accountId, bundle* pExtras, int syncOption, unsigned long pollFrequency, int* pSyncJobId) { int ret = SYNC_ERROR_NONE; SyncJobsAggregator* pSyncJobsAggregator = __pSyncManagerInstance->GetSyncJobsAggregator(); int syncJobId = -1; @@ -519,8 +500,7 @@ SyncService::RequestPeriodicSync(const char* pPackageId, const char* pSyncJobNam int -SyncService::RequestDataSync(const char* pPackageId, const char* pSyncJobName, int accountId, bundle* pExtras, int syncOption, const char* pCapability, int* pSyncJobId) -{ +SyncService::RequestDataSync(const char* pPackageId, const char* pSyncJobName, int accountId, bundle* pExtras, int syncOption, const char* pCapability, int* pSyncJobId) { int ret = SYNC_ERROR_NONE; SyncJobsAggregator* pSyncJobsAggregator = __pSyncManagerInstance->GetSyncJobsAggregator(); int syncJobId = -1; @@ -540,8 +520,7 @@ SyncService::RequestDataSync(const char* pPackageId, const char* pSyncJobName, i LOG_LOGD("sync request with priority. Adding sync job with Sync job name [%s] Sync job id [%d]", pSyncJobName, syncJobId); SyncManager::GetInstance()->ScheduleSyncJob(pSyncJobEntry); } - } - else { + } else { syncJobId = pSyncJobsAggregator->GenerateSyncJobId(pPackageId); SYNC_LOGE_RET_RES(syncJobId <= SYNC_JOB_LIMIT, SYNC_ERROR_QUOTA_EXCEEDED, "Sync job quota exceeded"); @@ -557,8 +536,7 @@ SyncService::RequestDataSync(const char* pPackageId, const char* pSyncJobName, i void -SyncService::HandleShutdown(void) -{ +SyncService::HandleShutdown(void) { LOG_LOGD("Shutdown Starts"); cynara_finish(pCynara); @@ -571,8 +549,7 @@ SyncService::HandleShutdown(void) /* LCOV_EXCL_START */ int -get_service_name_by_pid(guint pid, char** pAppId) -{ +get_service_name_by_pid(guint pid, char** pAppId) { GError* error = NULL; GVariant *unit = NULL; unit = g_dbus_connection_call_sync(gdbusConnection, "org.freedesktop.systemd1", @@ -630,17 +607,16 @@ get_service_name_by_pid(guint pid, char** pAppId) int -get_num_of_sync_jobs(string pkgId) -{ +get_num_of_sync_jobs(string pkgId) { if (!pkgId.empty()) { SyncJobsAggregator* pSyncJobsAggregator = SyncManager::GetInstance()->GetSyncJobsAggregator(); SyncJobsInfo* pPackageSyncJobs = pSyncJobsAggregator->GetSyncJobsInfo(pkgId.c_str()); if (pPackageSyncJobs != NULL) { map<int, ISyncJob*>& allSyncJobs = pPackageSyncJobs->GetAllSyncJobs(); - if (!allSyncJobs.empty()) + if (!allSyncJobs.empty()) { LOG_LOGD("Package ID [%s], it has [%d] sync job", pkgId.c_str(), allSyncJobs.size()); - else { + } else { LOG_LOGD("Package ID [%s], doesn't have any sync job", pkgId.c_str()); return 0; } @@ -661,8 +637,7 @@ gboolean sync_adapter_handle_send_result(TizenSyncAdapter* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine, gint sync_result, - const gchar* sync_job_name) -{ + const gchar* sync_job_name) { LOG_LOGD("Received sync job result"); guint pid = get_caller_pid(pInvocation); @@ -671,8 +646,7 @@ sync_adapter_handle_send_result(TizenSyncAdapter* pObject, GDBusMethodInvocation int ret = app_manager_get_app_id(pid, &pAppId); if (ret == APP_MANAGER_ERROR_NONE) { pkgIdStr = SyncManager::GetInstance()->GetPkgIdByAppId(pAppId); - } - else { + } else { ret = get_service_name_by_pid(pid, &pAppId); LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); @@ -697,8 +671,7 @@ sync_adapter_handle_send_result(TizenSyncAdapter* pObject, GDBusMethodInvocation gboolean -sync_adapter_handle_init_complete(TizenSyncAdapter* pObject, GDBusMethodInvocation* pInvocation) -{ +sync_adapter_handle_init_complete(TizenSyncAdapter* pObject, GDBusMethodInvocation* pInvocation) { guint pid = get_caller_pid(pInvocation); char* pAppId = NULL; @@ -727,8 +700,7 @@ sync_manager_add_on_demand_job(TizenSyncManager* pObject, GDBusMethodInvocation* gint accountId, const gchar* pSyncJobName, gint sync_option, - GVariant* pSyncJobUserData) -{ + GVariant* pSyncJobUserData) { LOG_LOGD("Received On-Demand Sync request"); guint pid = get_caller_pid(pInvocation); @@ -738,8 +710,7 @@ sync_manager_add_on_demand_job(TizenSyncManager* pObject, GDBusMethodInvocation* if (ret == APP_MANAGER_ERROR_NONE) { pkgIdStr = SyncManager::GetInstance()->GetPkgIdByAppId(pAppId); free(pAppId); - } - else { + } else { /* LCOV_EXCL_START */ LOG_LOGD("Request seems to be from app-id less/command line based request %s", pCommandLine); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); @@ -753,8 +724,7 @@ sync_manager_add_on_demand_job(TizenSyncManager* pObject, GDBusMethodInvocation* SyncManager::GetInstance()->AddRunningAccount(accountId, pid); ret = SyncService::GetInstance()->RequestOnDemandSync(pkgIdStr.c_str(), pSyncJobName, accountId, pBundle, sync_option, &sync_job_id); bundle_free(pBundle); - } - else { + } else { LOG_LOGD("Failed to get package id"); /* LCOV_EXCL_LINE */ ret = SYNC_ERROR_SYSTEM; } @@ -779,8 +749,7 @@ sync_manager_add_on_demand_job(TizenSyncManager* pObject, GDBusMethodInvocation* gboolean -sync_manager_remove_job(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine, gint sync_job_id) -{ +sync_manager_remove_job(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine, gint sync_job_id) { LOG_LOGD("Request to remove sync job %d", sync_job_id); guint pid = get_caller_pid(pInvocation); @@ -792,8 +761,7 @@ sync_manager_remove_job(TizenSyncManager* pObject, GDBusMethodInvocation* pInvoc if (ret == APP_MANAGER_ERROR_NONE) { pkgIdStr = SyncManager::GetInstance()->GetPkgIdByAppId(pAppId); free(pAppId); - } - else { + } else { /* LCOV_EXCL_START */ LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); @@ -834,8 +802,7 @@ sync_manager_add_periodic_job(TizenSyncManager* pObject, GDBusMethodInvocation* const gchar* pSyncJobName, gint sync_interval, gint sync_option, - GVariant* pSyncJobUserData) -{ + GVariant* pSyncJobUserData) { LOG_LOGD("Received Period Sync request"); int ret = SYNC_ERROR_NONE; @@ -859,8 +826,7 @@ sync_manager_add_periodic_job(TizenSyncManager* pObject, GDBusMethodInvocation* if (ret == APP_MANAGER_ERROR_NONE) { pkgIdStr = SyncManager::GetInstance()->GetPkgIdByAppId(pAppId); free(pAppId); - } - else { + } else { /* LCOV_EXCL_START */ LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); @@ -904,8 +870,7 @@ sync_manager_add_data_change_job(TizenSyncManager* pObject, GDBusMethodInvocatio gint accountId, const gchar* pCapabilityArg, gint sync_option, - GVariant* pSyncJobUserData) -{ + GVariant* pSyncJobUserData) { LOG_LOGD("Received data change Sync request"); int ret = SYNC_ERROR_NONE; @@ -944,8 +909,7 @@ sync_manager_add_data_change_job(TizenSyncManager* pObject, GDBusMethodInvocatio if (ret == APP_MANAGER_ERROR_NONE) { pkgIdStr = SyncManager::GetInstance()->GetPkgIdByAppId(pAppId); free(pAppId); - } - else { + } else { /* LCOV_EXCL_START */ LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); @@ -986,8 +950,7 @@ sync_manager_add_data_change_job(TizenSyncManager* pObject, GDBusMethodInvocatio static bool -is_service_app(pid_t pid) -{ +is_service_app(pid_t pid) { char *current_app_id = NULL; int ret = app_manager_get_app_id(pid, ¤t_app_id); if (ret != APP_MANAGER_ERROR_NONE) { @@ -1015,13 +978,11 @@ is_service_app(pid_t pid) free(current_app_id); return false; /* LCOV_EXCL_STOP */ - } - else { + } else { if (!strcmp(current_app_type, "svcapp")) { LOG_LOGD("Current application type : %s", current_app_type); pkgmgrinfo_appinfo_destroy_appinfo(current_app_info); - } - else { + } else { /* LCOV_EXCL_START */ LOG_LOGD("Current app is not a service application : %s", current_app_type); pkgmgrinfo_appinfo_destroy_appinfo(current_app_info); @@ -1037,8 +998,7 @@ is_service_app(pid_t pid) } -static inline int __read_proc(const char *path, char *buf, int size) -{ +static inline int __read_proc(const char *path, char *buf, int size) { int fd; int ret; @@ -1055,7 +1015,8 @@ static inline int __read_proc(const char *path, char *buf, int size) if (ret <= 0) { close(fd); return -1; - } else + } + else buf[ret] = 0; close(fd); @@ -1065,8 +1026,7 @@ static inline int __read_proc(const char *path, char *buf, int size) gboolean -sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine) -{ +sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine) { LOG_LOGD("Received sync adapter registration request"); guint pid = get_caller_pid(pInvocation); @@ -1086,8 +1046,7 @@ sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* ret = app_manager_get_app_id(pid, &pAppId); if (ret == APP_MANAGER_ERROR_NONE) { pkgIdStr = SyncManager::GetInstance()->GetPkgIdByAppId(pAppId); - } - else { + } else { /* LCOV_EXCL_START */ ret = get_service_name_by_pid(pid, &pAppId); LOG_LOGD("Request seems to be from app-id less/command line based request"); @@ -1114,8 +1073,7 @@ sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* g_dbus_method_invocation_return_gerror(pInvocation, error); g_clear_error(&error); return false; - } - else { + } else { check_jobs = true; // Probably sync service may have started this service. Alert sync manager for scheduling pending jobs. /* LCOV_EXCL_STOP */ } @@ -1137,16 +1095,13 @@ sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* g_hash_table_insert(g_hash_table, strdup(pAppId), syncAdapterObj); ret = SYNC_ERROR_NONE; - } - else { + } else { LOG_LOGD("export failed %s", error->message); /* LCOV_EXCL_LINE */ } - } - else { + } else { LOG_LOGD("sync adapter object creation failed"); /* LCOV_EXCL_LINE */ } - } - else { + } else { LOG_LOGD("Failed to get package ID"); /* LCOV_EXCL_LINE */ } @@ -1171,8 +1126,7 @@ sync_manager_add_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* gboolean -sync_manager_remove_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine) -{ +sync_manager_remove_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine) { LOG_LOGD("Request to remove sync adapter"); string pkgIdStr; @@ -1192,8 +1146,7 @@ sync_manager_remove_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocatio ret = app_manager_get_app_id(pid, &pAppId); if (ret == APP_MANAGER_ERROR_NONE) { pkgIdStr = SyncManager::GetInstance()->GetPkgIdByAppId(pAppId); - } - else { + } else { /* LCOV_EXCL_START */ LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgIdStr = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); @@ -1228,16 +1181,14 @@ sync_manager_remove_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocatio LOG_LOGD("deletting sync adapter ipc %s", pAppId); ret = SYNC_ERROR_NONE; - } - else { + } else { LOG_LOGD("export failed %s", error->message); /* LCOV_EXCL_LINE */ } } free(pAppId); /* LCOV_EXCL_STOP */ - } - else { + } else { GDBusInterfaceSkeleton* interface = NULL; interface = G_DBUS_INTERFACE_SKELETON(pSyncAdapter); g_dbus_interface_skeleton_unexport(interface); @@ -1252,8 +1203,7 @@ sync_manager_remove_sync_adapter(TizenSyncManager* pObject, GDBusMethodInvocatio GVariant * -marshal_sync_job(ISyncJob* syncJob) -{ +marshal_sync_job(ISyncJob* syncJob) { SyncJob* pSyncJob = dynamic_cast< SyncJob* > (syncJob); GVariantBuilder builder; @@ -1278,8 +1228,7 @@ marshal_sync_job(ISyncJob* syncJob) gboolean -sync_manager_get_all_sync_jobs(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine) -{ +sync_manager_get_all_sync_jobs(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, const gchar* pCommandLine) { LOG_LOGD("Received request to get Sync job ids"); guint pid = get_caller_pid(pInvocation); @@ -1291,8 +1240,7 @@ sync_manager_get_all_sync_jobs(TizenSyncManager* pObject, GDBusMethodInvocation* if (ret == APP_MANAGER_ERROR_NONE) { pkgId = SyncManager::GetInstance()->GetPkgIdByAppId(pAppId); free(pAppId); - } - else { + } else { /* LCOV_EXCL_START */ LOG_LOGD("Request seems to be from app-id less/command line based request"); pkgId = SyncManager::GetInstance()->GetPkgIdByCommandline(pCommandLine); @@ -1321,12 +1269,10 @@ sync_manager_get_all_sync_jobs(TizenSyncManager* pObject, GDBusMethodInvocation* } outSyncJobList = g_variant_builder_end(&builder); } - } - else { + } else { LOG_LOGD("sync service: registered sync jobs are not found"); /* LCOV_EXCL_LINE */ } - } - else { + } else { LOG_LOGD("Sync jobs information not found for package [%s], pkgId.str()"); /* LCOV_EXCL_LINE */ } @@ -1353,8 +1299,7 @@ sync_manager_get_all_sync_jobs(TizenSyncManager* pObject, GDBusMethodInvocation* /* LCOV_EXCL_START */ gboolean -sync_manager_set_sync_status(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, gboolean sync_enable) -{ +sync_manager_set_sync_status(TizenSyncManager* pObject, GDBusMethodInvocation* pInvocation, gboolean sync_enable) { SyncManager::GetInstance()->SetSyncSetting(sync_enable); tizen_sync_manager_complete_set_sync_status(pObject, pInvocation); @@ -1364,13 +1309,12 @@ sync_manager_set_sync_status(TizenSyncManager* pObject, GDBusMethodInvocation* p void DbusSignalHandler(GDBusConnection* pConnection, - const gchar* pSenderName, - const gchar* pObjectPath, - const gchar* pInterfaceName, - const gchar* pSignalName, - GVariant* pParameters, - gpointer data) -{ + const gchar* pSenderName, + const gchar* pObjectPath, + const gchar* pInterfaceName, + const gchar* pSignalName, + GVariant* pParameters, + gpointer data) { if (!(g_strcmp0(pObjectPath, SYS_DBUS_PATH)) && !(g_strcmp0(pSignalName, POWEROFF_MSG))) { LOG_LOGD("Shutdown dbus received"); if (ShutdownInitiated == false) { @@ -1391,8 +1335,7 @@ DbusSignalHandler(GDBusConnection* pConnection, * DBus related initialization and setup */ static void -OnBusAcquired(GDBusConnection* pConnection, const gchar* pName, gpointer userData) -{ +OnBusAcquired(GDBusConnection* pConnection, const gchar* pName, gpointer userData) { GDBusInterfaceSkeleton* interface = NULL; sync_ipc_obj = tizen_sync_manager_skeleton_new(); if (sync_ipc_obj == NULL) { @@ -1439,15 +1382,13 @@ OnBusAcquired(GDBusConnection* pConnection, const gchar* pName, gpointer userDat static void -OnNameAcquired(GDBusConnection* pConnection, const gchar* pName, gpointer userData) -{ +OnNameAcquired(GDBusConnection* pConnection, const gchar* pName, gpointer userData) { } /* LCOV_EXCL_START */ static void -OnNameLost(GDBusConnection* pConnection, const gchar* pName, gpointer userData) -{ +OnNameLost(GDBusConnection* pConnection, const gchar* pName, gpointer userData) { LOG_LOGD("OnNameLost"); //exit (1); } @@ -1455,8 +1396,7 @@ OnNameLost(GDBusConnection* pConnection, const gchar* pName, gpointer userData) static bool -__initialize_dbus() -{ +__initialize_dbus() { static guint ownerId = g_bus_own_name(G_BUS_TYPE_SESSION, "org.tizen.sync", G_BUS_NAME_OWNER_FLAGS_NONE, @@ -1478,8 +1418,7 @@ __initialize_dbus() void -SyncService::InitializeDbus(void) -{ +SyncService::InitializeDbus(void) { LOG_LOGD("Dbus initialization starts"); if (__initialize_dbus() == false) { @@ -1497,8 +1436,7 @@ SyncService::InitializeDbus(void) * DBus related initialization done */ SyncService::SyncService(void) - : __pSyncManagerInstance(NULL) -{ + : __pSyncManagerInstance(NULL) { LOG_LOGD("Sync service initialization starts"); InitializeDbus(); @@ -1506,8 +1444,7 @@ SyncService::SyncService(void) /* LCOV_EXCL_START */ -SyncService::~SyncService(void) -{ +SyncService::~SyncService(void) { } /* LCOV_EXCL_STOP */ diff --git a/src/sync-service/SyncManager_SyncService.h b/src/sync-service/SyncManager_SyncService.h index f920139..201d5c0 100644 --- a/src/sync-service/SyncManager_SyncService.h +++ b/src/sync-service/SyncManager_SyncService.h @@ -38,8 +38,7 @@ class SyncManager; class SyncService - : public Singleton < SyncService > -{ + : public Singleton < SyncService > { public: int StartService(void); diff --git a/src/sync-service/SyncManager_SyncStatusInfo.cpp b/src/sync-service/SyncManager_SyncStatusInfo.cpp index d9183dd..d4957e3 100644 --- a/src/sync-service/SyncManager_SyncStatusInfo.cpp +++ b/src/sync-service/SyncManager_SyncStatusInfo.cpp @@ -30,14 +30,12 @@ /* LCOV_EXCL_START */ -SyncStatusInfo::SyncStatusInfo(int capabilityId) -{ +SyncStatusInfo::SyncStatusInfo(int capabilityId) { this->capabilityId = capabilityId; } -SyncStatusInfo::SyncStatusInfo(SyncStatusInfo &other) -{ +SyncStatusInfo::SyncStatusInfo(SyncStatusInfo &other) { this->capabilityId = other.capabilityId; vector<long long> ::iterator it; @@ -49,8 +47,7 @@ SyncStatusInfo::SyncStatusInfo(SyncStatusInfo &other) SyncStatusInfo& -SyncStatusInfo::operator =(SyncStatusInfo& other) -{ +SyncStatusInfo::operator =(SyncStatusInfo& other) { this->capabilityId = other.capabilityId; vector<long long> ::iterator it; @@ -63,8 +60,7 @@ SyncStatusInfo::operator =(SyncStatusInfo& other) SyncStatusInfo::SyncStatusInfo(string statusInfo) - : capabilityId(-1) -{ + : capabilityId(-1) { if (statusInfo.empty()) { LOG_LOGD("statusInfo string empty"); return; @@ -94,8 +90,7 @@ SyncStatusInfo::SyncStatusInfo(string statusInfo) void -SyncStatusInfo::SetPeriodicSyncTime(unsigned int index, long long when) -{ +SyncStatusInfo::SetPeriodicSyncTime(unsigned int index, long long when) { // The list is initialized lazily when scheduling occurs so we need to make sure // we initialize elements < index to zero (zero is ignore for scheduling purposes) EnsurePeriodicSyncTimeSize(index); @@ -104,20 +99,17 @@ SyncStatusInfo::SetPeriodicSyncTime(unsigned int index, long long when) long long -SyncStatusInfo::GetPeriodicSyncTime(unsigned int index) -{ +SyncStatusInfo::GetPeriodicSyncTime(unsigned int index) { if (index < __periodicSyncTimes.size()) { return __periodicSyncTimes[index]; - } - else { + } else { return 0; } } void -SyncStatusInfo::RemovePeriodicSyncTime(unsigned int index) -{ +SyncStatusInfo::RemovePeriodicSyncTime(unsigned int index) { if (index < __periodicSyncTimes.size()) { __periodicSyncTimes.erase(__periodicSyncTimes.begin()+index); } @@ -125,8 +117,7 @@ SyncStatusInfo::RemovePeriodicSyncTime(unsigned int index) void -SyncStatusInfo::EnsurePeriodicSyncTimeSize(unsigned int index) -{ +SyncStatusInfo::EnsurePeriodicSyncTimeSize(unsigned int index) { unsigned int requiredSize = index + 1; if (__periodicSyncTimes.size() < requiredSize) { for (unsigned int i = __periodicSyncTimes.size(); i < requiredSize; i++) { @@ -137,8 +128,7 @@ SyncStatusInfo::EnsurePeriodicSyncTimeSize(unsigned int index) string -SyncStatusInfo::GetStatusInfoString(void) -{ +SyncStatusInfo::GetStatusInfoString(void) { stringstream ss; string buff; diff --git a/src/sync-service/SyncManager_SyncStatusInfo.h b/src/sync-service/SyncManager_SyncStatusInfo.h index c40181b..99d8bd3 100644 --- a/src/sync-service/SyncManager_SyncStatusInfo.h +++ b/src/sync-service/SyncManager_SyncStatusInfo.h @@ -31,10 +31,11 @@ /*namespace _SyncManager { */ + using namespace std; -class SyncStatusInfo -{ + +class SyncStatusInfo { public: SyncStatusInfo(int capabilityId); diff --git a/src/sync-service/SyncManager_SyncWorker.cpp b/src/sync-service/SyncManager_SyncWorker.cpp index 4e88711..6d19962 100644 --- a/src/sync-service/SyncManager_SyncWorker.cpp +++ b/src/sync-service/SyncManager_SyncWorker.cpp @@ -29,29 +29,25 @@ {*/ -SyncWorker::SyncWorker(void) -{ +SyncWorker::SyncWorker(void) { } /* LCOV_EXCL_START */ -SyncWorker::~SyncWorker(void) -{ +SyncWorker::~SyncWorker(void) { Finalize(); } /* LCOV_EXCL_STOP */ int -SyncWorker::FireEvent(ISyncWorkerResultListener* pSyncWorkerResultListener, Message msg) -{ +SyncWorker::FireEvent(ISyncWorkerResultListener* pSyncWorkerResultListener, Message msg) { return AddRequestN(pSyncWorkerResultListener, msg); } void -SyncWorker::Initialize(void) -{ +SyncWorker::Initialize(void) { LOG_LOGD("Initializing sync worker thread"); GError* pGError = NULL; @@ -63,8 +59,7 @@ SyncWorker::Initialize(void) LOG_ERRORD("__pendingRequestsMutex Initialise Failed %d", ret); return; /* LCOV_EXCL_STOP */ - } - else { + } else { __pContext = g_main_context_new(); ASSERT(__pContext); @@ -95,8 +90,7 @@ SyncWorker::Initialize(void) /* LCOV_EXCL_START */ void -SyncWorker::Finalize(void) -{ +SyncWorker::Finalize(void) { LOG_LOGD("Finalizing sync worker"); for (std::list<RequestData*>::iterator it = __pendingRequests.begin(); it != __pendingRequests.end();) { @@ -130,8 +124,7 @@ SyncWorker::Finalize(void) int -SyncWorker::AddRequestN(ISyncWorkerResultListener* pSyncWorkerResultListener, Message msg) -{ +SyncWorker::AddRequestN(ISyncWorkerResultListener* pSyncWorkerResultListener, Message msg) { SYNC_LOGE_RET_RES(__pChannel != NULL, SYNC_ERROR_SYSTEM, "IO channel is not setup"); LOG_LOGD("Adding a request to sync worker"); @@ -168,8 +161,7 @@ SyncWorker::AddRequestN(ISyncWorkerResultListener* pSyncWorkerResultListener, Me gboolean -SyncWorker::OnEventReceived(GIOChannel* pChannel, GIOCondition condition, gpointer data) -{ +SyncWorker::OnEventReceived(GIOChannel* pChannel, GIOCondition condition, gpointer data) { LOG_LOGD("GIO event received"); SyncWorker* pSyncWorker = static_cast<SyncWorker*>(data); SYNC_LOGE_RET_RES(pSyncWorker != NULL, FALSE, "Data is NULL"); @@ -200,8 +192,7 @@ SyncWorker::OnEventReceived(GIOChannel* pChannel, GIOCondition condition, gpoint delete pData; pData = NULL; - } - else { + } else { pthread_mutex_unlock(&pSyncWorker->__pendingRequestsMutex); /* LCOV_EXCL_LINE */ } @@ -218,8 +209,7 @@ SyncWorker::OnEventReceived(GIOChannel* pChannel, GIOCondition condition, gpoint gpointer -SyncWorker::ThreadLoop(gpointer data) -{ +SyncWorker::ThreadLoop(gpointer data) { LOG_LOGD("Sync worker thread entered"); GMainLoop* pLoop = static_cast<GMainLoop*>(data); diff --git a/src/sync-service/SyncManager_SyncWorker.h b/src/sync-service/SyncManager_SyncWorker.h index 48b6a61..64c147f 100644 --- a/src/sync-service/SyncManager_SyncWorker.h +++ b/src/sync-service/SyncManager_SyncWorker.h @@ -37,8 +37,7 @@ using namespace std; -class SyncWorker -{ +class SyncWorker { public: SyncWorker(void); diff --git a/src/sync-service/SyncManager_SyncWorkerResultListener.h b/src/sync-service/SyncManager_SyncWorkerResultListener.h index cb47738..46286a5 100644 --- a/src/sync-service/SyncManager_SyncWorkerResultListener.h +++ b/src/sync-service/SyncManager_SyncWorkerResultListener.h @@ -23,8 +23,7 @@ { */ -class ISyncWorkerResultListener -{ +class ISyncWorkerResultListener { public: virtual ~ISyncWorkerResultListener() {}; /* LCOV_EXCL_LINE */ diff --git a/src/sync-service/main.cpp b/src/sync-service/main.cpp index 2ab1a49..da8188f 100644 --- a/src/sync-service/main.cpp +++ b/src/sync-service/main.cpp @@ -29,16 +29,14 @@ extern bool ShutdownInitiated; static Eina_Bool -OnIdle(void* pUserData) -{ +OnIdle(void* pUserData) { LOG_LOGD("MainLoop OnIdle"); return ECORE_CALLBACK_CANCEL; } void -terminate_service(void) -{ +terminate_service(void) { LOG_LOGD("Sync service will be terminated"); if (ShutdownInitiated == false) { @@ -51,8 +49,7 @@ terminate_service(void) Eina_Bool -OnTerminate(void *data, int ev_type, void *ev) -{ +OnTerminate(void *data, int ev_type, void *ev) { LOG_LOGD("MainLoop OnTerminate"); terminate_service(); @@ -61,8 +58,7 @@ OnTerminate(void *data, int ev_type, void *ev) int -main(int argc, char **argv) -{ +main(int argc, char **argv) { if (!ecore_init()) { return -1; } |