if (remote_error) {
LOG_LOGD("Remote error [%s]", remote_error);
if (g_str_has_prefix(remote_error, SYNC_ERROR_PREFIX) == true) {
+ LOG_LOGD("Error prefix - [%s]", SYNC_ERROR_PREFIX);
int error_enum_count = G_N_ELEMENTS(_sync_errors);
for (int i = 0; i < error_enum_count; i++) {
if (g_strcmp0(_sync_errors[i].dbus_error_name, remote_error) == 0) {
}
}
} else if (g_str_has_prefix(remote_error, FREEDEKTOP_ERROR_PREFIX) == true) {
+ LOG_LOGD("Error prefix - [%s]", FREEDEKTOP_ERROR_PREFIX);
const char* error_name = FREEDEKTOP_ERROR_PREFIX".AccessDenied";
if (g_strcmp0(error_name, remote_error) == 0) {
LOG_LOGD("Error code matched with freedesktop error");
int
CurrentSyncJobQueue::AddSyncJobToCurrentSyncQueue(SyncJob* syncJob) {
- LOG_LOGD("Active Sync Jobs Queue size : Before = [%d]", __currentSyncJobQueue.size());
+ LOG_LOGD("Active Sync Jobs Queue size : Before = [%zu]", __currentSyncJobQueue.size());
map<const string, CurrentSyncContext*>::iterator it;
it = __currentSyncJobQueue.find(syncJob->__key);
return SYNC_ERROR_ALREADY_IN_PROGRESS;
}
}
- LOG_LOGD("Active Sync Jobs Queue size : After = [%d]", __currentSyncJobQueue.size());
+ LOG_LOGD("Active Sync Jobs Queue size : After = [%zu]", __currentSyncJobQueue.size());
return SYNC_ERROR_NONE;
}
CurrentSyncJobQueue::IsJobActive(CurrentSyncContext *pCurrSync) {
LOG_LOGD("CurrentSyncJobQueue::IsJobActive() Starts");
- LOG_LOGD("job q size [%d]", __currentSyncJobQueue.size());
+ LOG_LOGD("job q size [%zu]", __currentSyncJobQueue.size());
if (pCurrSync == NULL) {
return false;
map<const string, CurrentSyncContext*>::iterator it = __currentSyncJobQueue.find(pSyncJob->__key);
CurrentSyncContext* pCurrContext = it->second;
__currentSyncJobQueue.erase(it);
- LOG_LOGD("Active Sync Jobs queue size, After = [%d]", __currentSyncJobQueue.size());
+ LOG_LOGD("Active Sync Jobs queue size, After = [%zu]", __currentSyncJobQueue.size());
delete pCurrContext;
pCurrContext = NULL;
ret = alarmmgr_add_periodic_alarm_withcb(periodicSyncJob->__period, QUANTUMIZE, PeriodicSyncScheduler::OnAlarmExpired, this, &alarm_id);
/* ret = alarmmgr_add_periodic_alarm_withcb(2, QUANTUMIZE, PeriodicSyncScheduler::OnAlarmExpired, this, &alarm_id); */
if (ret == ALARMMGR_RESULT_SUCCESS) {
- LOG_LOGD("Alarm added for %ld min, id %ld", periodicSyncJob->__period, alarm_id);
+ LOG_LOGD("Alarm added for %ld min, id %d", periodicSyncJob->__period, alarm_id);
/* LOG_LOGD("Alarm added for [%ld] min, id [%ld]", 2, alarm_id); */
__activePeriodicSyncJobs.insert(make_pair(alarm_id, periodicSyncJob));
return SYNC_ERROR_SYSTEM;
}
- LOG_LOGD("Active periodic alarm count, [%d]", __activePeriodicSyncJobs.size());
+ LOG_LOGD("Active periodic alarm count, [%zu]", __activePeriodicSyncJobs.size());
return SYNC_ERROR_NONE;
}
ss << syncJobs.size();
xmlNewProp(rootNode, XML_ATTR_COUNT, (const xmlChar*)ss.str().c_str());
- LOG_LOGD("size [%d]", syncJobs.size());
+ LOG_LOGD("size [%zu]", syncJobs.size());
map<string, SyncJobsInfo*>::iterator itr = syncJobs.begin();
while (itr != syncJobs.end()) {
if (syncJobToRun == NULL && !jobQueue.empty()) {
LOG_LOGD("Non priority job found");
- LOG_LOGD("Non priority size: [%d]", jobQueue.size());
+ LOG_LOGD("Non priority size: [%zu]", jobQueue.size());
syncJobToRun = jobQueue.front();
jobQueue.pop_front();
if (syncJobToRun == NULL)
SYNC_LOGE_RET_RES(pSyncJobEntry != NULL, SYNC_ERROR_SYSTEM, "Failed to get sync job");
if (pSyncJobEntry->IsExpedited()) {
- LOG_LOGD("Priority SyncJob Queue size, before = [%d]", __prioritySyncJobsQueue.size());
+ LOG_LOGD("Priority SyncJob Queue size, before = [%zu]", __prioritySyncJobsQueue.size());
__prioritySyncJobsQueue.push_back(pSyncJob);
- LOG_LOGD("Priority SyncJob Queue size, after = [%d]", __prioritySyncJobsQueue.size());
+ LOG_LOGD("Priority SyncJob Queue size, after = [%zu]", __prioritySyncJobsQueue.size());
} else {
- LOG_LOGD("SyncJob Queue size, before = [%d]", __syncJobsQueue.size());
+ LOG_LOGD("SyncJob Queue size, before = [%zu]", __syncJobsQueue.size());
__syncJobsQueue.push_back(pSyncJob);
- LOG_LOGD("SyncJob Queue size, after = [%d]", __syncJobsQueue.size());
+ LOG_LOGD("SyncJob Queue size, after = [%zu]", __syncJobsQueue.size());
}
return SYNC_ERROR_NONE;
int
SyncJobQueue::RemoveSyncJob(SyncJob* pSyncJob) {
if (pSyncJob ->IsExpedited()) {
- LOG_LOGD("Priority SyncJob Queue size, before = [%d]", __prioritySyncJobsQueue.size());
+ LOG_LOGD("Priority SyncJob Queue size, before = [%zu]", __prioritySyncJobsQueue.size());
__prioritySyncJobsQueue.remove(pSyncJob);
- LOG_LOGD("Priority SyncJob Queue size, after = [%d]", __prioritySyncJobsQueue.size());
+ LOG_LOGD("Priority SyncJob Queue size, after = [%zu]", __prioritySyncJobsQueue.size());
} else {
- LOG_LOGD("SyncJob Queue size, before = [%d]", __syncJobsQueue.size());
+ LOG_LOGD("SyncJob Queue size, before = [%zu]", __syncJobsQueue.size());
__syncJobsQueue.remove(pSyncJob);
- LOG_LOGD("SyncJob Queue size, after = [%d]", __syncJobsQueue.size());
+ LOG_LOGD("SyncJob Queue size, after = [%zu]", __syncJobsQueue.size());
}
return SYNC_ERROR_NONE;
/* LCOV_EXCL_START */
void
SyncJobsInfo::RemoveAllSyncJobs() {
- LOG_LOGD("Removing Sync jobs for package [%s]. Count [%d] ", __packageId.c_str(), __syncIdList.size());
+ LOG_LOGD("Removing Sync jobs for package [%s]. Count [%zd] ", __packageId.c_str(), __syncIdList.size());
map<int, ISyncJob*>::iterator itr = __syncIdList.begin();
while (itr != __syncIdList.end()) {
int
SyncManager::AddPeriodicSyncJob(string pPackageId, int uid, const char* syncJobName, int accountId, bundle* pExtras, int syncOption, int syncJobId, long period) {
- if (period < 1800) {
+ unsigned int lperiod = (unsigned int)period;
+ if (lperiod < 1800) {
/* LCOV_EXCL_START */
- LOG_LOGD("Requested period %d is less than minimum, rounding up to 30 mins", period);
- period = 1800;
+ LOG_LOGD("Requested period %d is less than minimum, rounding up to 30 mins", lperiod);
+ lperiod = 1800;
/* LCOV_EXCL_STOP */
}
if (accountId != -1 && !GetSyncSupport(accountId)) {
/* LCOV_EXCL_START */
- LOG_LOGD("Sync is not enabled for account ID %s", accountId);
+ LOG_LOGD("Sync is not enabled for account ID %d", accountId);
return SYNC_ERROR_SYSTEM;
/* LCOV_EXCL_STOP */
}
- PeriodicSyncJob* pRequestedJob = new (std::nothrow) PeriodicSyncJob(pSyncAdapterApp, uid, syncJobName, accountId, pExtras, syncOption, syncJobId, SYNC_TYPE_PERIODIC, period / 60);
+ PeriodicSyncJob* pRequestedJob = new (std::nothrow) PeriodicSyncJob(pSyncAdapterApp, uid, syncJobName, accountId, pExtras, syncOption, syncJobId, SYNC_TYPE_PERIODIC, lperiod / 60);
SYNC_LOGE_RET_RES(pRequestedJob != NULL, SYNC_ERROR_OUT_OF_MEMORY, "Failed to construct periodic SyncJob");
__pSyncJobsAggregator->AddSyncJob(pPackageId.c_str(), uid, syncJobName, pRequestedJob);
if (accountId != -1 && !GetSyncSupport(accountId)) {
/* LCOV_EXCL_START */
- LOG_LOGD("Sync is not enabled for account ID %s", accountId);
+ LOG_LOGD("Sync is not enabled for account ID %d", accountId);
return SYNC_ERROR_SYSTEM;
/* LCOV_EXCL_STOP */
}
interface = G_DBUS_INTERFACE_SKELETON(pSyncAdapter);
if (g_dbus_interface_skeleton_export(interface, gdbusConnection, object_path, &error)) {
g_signal_connect(pSyncAdapter, "handle-send-result", G_CALLBACK(sync_adapter_handle_send_result), NULL);
- LOG_LOGD("inserting sync adapter ipc [%s][%x]", appId, pSyncAdapter);
+ LOG_LOGD("inserting sync adapter ipc [%s][%p]", appId, (void*)pSyncAdapter);
g_hash_table_insert(g_hash_table, (gpointer)g_strdup(appId), (gpointer)pSyncAdapter);
} else {
SYNC_LOGE_RET_RES(!(error->message), SYNC_ERROR_SYSTEM, "export failed [%s]", error->message);
if (pPackageSyncJobs != NULL) {
map<int, ISyncJob*>& allSyncJobs = pPackageSyncJobs->GetAllSyncJobs();
if (!allSyncJobs.empty()) {
- LOG_LOGD("Package ID [%s], it has [%d] sync job", pkgId.c_str(), allSyncJobs.size());
+ LOG_LOGD("Package ID [%s], it has [%zu] sync job", pkgId.c_str(), allSyncJobs.size());
} else {
LOG_LOGD("Package ID [%s], doesn't have any sync job", pkgId.c_str());
return 0;
if (g_dbus_interface_skeleton_export(interface, gdbusConnection, object_path, &error)) {
g_signal_connect(syncAdapterObj, "handle-send-result", G_CALLBACK(sync_adapter_handle_send_result), NULL);
pAggregator->AddSyncAdapter((const char*)pkgIdStr.c_str(), pAppId);
- LOG_LOGD("inserting sync adapter ipc [%s][%x]", pAppId, syncAdapterObj);
+ LOG_LOGD("inserting sync adapter ipc [%s][%p]", pAppId, (void*)syncAdapterObj);
g_hash_table_insert(g_hash_table, (gpointer)g_strdup(pAppId), (gpointer)syncAdapterObj);
ret = SYNC_ERROR_NONE;
} else {
g_signal_connect(syncAdapterObj, "handle-send-result", G_CALLBACK(sync_adapter_handle_send_result), NULL);
if (isApp) {
pAggregator->AddSyncAdapter((const char*)pkgIdStr.c_str(), pAppId);
- LOG_LOGD("inserting sync adapter ipc [%s][%x]", pAppId, syncAdapterObj);
+ LOG_LOGD("inserting sync adapter ipc [%s][%p]", pAppId, (void*)syncAdapterObj);
g_hash_table_insert(g_hash_table, (gpointer)g_strdup(pAppId), (gpointer)syncAdapterObj);
} else {
pAggregator->AddSyncAdapter((const char*)pkgIdStr.c_str(), (const char*)pkgIdStr.c_str());
- LOG_LOGD("inserting sync adapter ipc [%s][%x]", pkgIdStr.c_str(), syncAdapterObj);
+ LOG_LOGD("inserting sync adapter ipc [%s][%p]", pkgIdStr.c_str(), (void*)syncAdapterObj);
g_hash_table_insert(g_hash_table, (gpointer)g_strdup(pkgIdStr.c_str()), (gpointer)syncAdapterObj);
}
ret = SYNC_ERROR_NONE;
map<int, ISyncJob*>& allSyncJobs = pPackageSyncJobs->GetAllSyncJobs();
if (!allSyncJobs.empty()) {
g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY);
- LOG_LOGD("Package has [%d] sync jobs", allSyncJobs.size());
+ LOG_LOGD("Package has [%zu] sync jobs", allSyncJobs.size());
map< int, ISyncJob* >::iterator itr = allSyncJobs.begin();
while (itr != allSyncJobs.end()) {
ISyncJob* syncJob = itr->second;
static void
free_hash_table_items(gpointer key, gpointer value, gpointer user_data) {
- LOG_LOGD("free g_hash_table - key : [%s], value : [%x]", (char *)key, value);
+ LOG_LOGD("free g_hash_table - key : [%s], value : [%p]", (char *)key, (void*)value);
g_free(key);
}
buff.append(ss.str().c_str());
ss.str(string());
- LOG_LOGD("writing sync time now, size = %d", __periodicSyncTimes.size());
+ LOG_LOGD("writing sync time now, size = %zu", __periodicSyncTimes.size());
buff.append(" ");
ss << __periodicSyncTimes.size();
buff.append(ss.str().c_str());
uint64_t count = 1;
gsize writtenSize = 0;
- // GError* error = NULL;
- // GIOStatus status;
pthread_mutex_lock(&__pendingRequestsMutex);
__pendingRequests.push_back(pRequestData);
- LOG_LOGD("Added into __pendingRequests, current size = %d", __pendingRequests.size());
+ LOG_LOGD("Added into __pendingRequests, current size = %zu", __pendingRequests.size());
pthread_mutex_unlock(&__pendingRequestsMutex);
GError* pError = NULL;
int status = g_io_channel_write_chars(__pChannel, (const gchar*) &count, sizeof(count), &writtenSize, &pError);
if (status != G_IO_STATUS_NORMAL) {
- LOG_LOGD("SyncWorker::Add Request Failed with IO Write Error %d %d", status, count); /* LCOV_EXCL_LINE */
+ LOG_LOGD("SyncWorker::Add Request Failed with IO Write Error %d %llu", status, (long long unsigned)count); /* LCOV_EXCL_LINE */
return SYNC_ERROR_SYSTEM;
}
g_io_channel_flush(__pChannel, &pError);
if (*it != NULL) {
RequestData* pData = *it;
pSyncWorker->__pendingRequests.pop_front();
- LOG_LOGD("Popping from __pendingRequests, size = %d", pSyncWorker->__pendingRequests.size());
+ LOG_LOGD("Popping from __pendingRequests, size = %zu", pSyncWorker->__pendingRequests.size());
pthread_mutex_unlock(&pSyncWorker->__pendingRequestsMutex);
pData->pResultListener->OnEventReceived(pData->message);