Enlightenment: Fix coverity issues related to new sysinfo gadget

This fixes CID1368352 CID1368351 CID1368350 CID1368349 CID1368348 CID1368347 CID1368346 CID1368344 CID1368343
This commit is contained in:
Stephen 'Okra' Houston 2017-01-09 09:39:58 -06:00
parent 8d6b834d57
commit d843f58671
7 changed files with 16 additions and 9 deletions

View File

@ -74,8 +74,9 @@ _batman_update(Instance *inst, int full, int time_left, int time_full, Eina_Bool
static double debounce_time = 0.0;
if (!inst) return;
if (inst->cfg->esm != E_SYSINFO_MODULE_BATMAN && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
if (!inst->cfg) return;
if (inst->cfg->esm != E_SYSINFO_MODULE_BATMAN && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
if (have_power != inst->cfg->batman.have_power)
{
if (have_power && (full < 100))
@ -322,7 +323,7 @@ _batman_warning_popup_destroy(Instance *inst)
ecore_timer_del(inst->cfg->batman.alert_timer);
inst->cfg->batman.alert_timer = NULL;
}
if ((!inst) || (!inst->warning)) return;
if (!inst->warning) return;
elm_ctxpopup_dismiss(inst->warning);
}

View File

@ -709,8 +709,9 @@ _cpuclock_cb_frequency_check_notify(void *data,
Thread_Config *thc = data;
Instance *inst = thc->inst;
if (inst->cfg->esm != E_SYSINFO_MODULE_CPUCLOCK && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
if (!inst->cfg) return;
if (inst->cfg->esm != E_SYSINFO_MODULE_CPUCLOCK && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
if ((inst->cfg->cpuclock.status) && (status) &&
(
#ifdef __OpenBSD__

View File

@ -51,8 +51,9 @@ _cpumonitor_cb_usage_check_notify(void *data,
Thread_Config *thc = data;
Instance *inst = thc->inst;
if (inst->cfg->esm != E_SYSINFO_MODULE_CPUMONITOR && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
if (!inst->cfg) return;
if (inst->cfg->esm != E_SYSINFO_MODULE_CPUMONITOR && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
_cpumonitor_face_update(inst);
}

View File

@ -49,8 +49,9 @@ _memusage_cb_usage_check_notify(void *data,
Thread_Config *thc = data;
Instance *inst = thc->inst;
if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
if (!inst->cfg) return;
if (inst->cfg->esm != E_SYSINFO_MODULE_MEMUSAGE && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
_memusage_face_update(inst, thc->memstatus, thc->swapstatus);
}

View File

@ -32,7 +32,8 @@ int _memusage_proc_getswapusage(void)
fclose(f);
swap_used = swap_total - swap_free;
percent = 100 * ((float)swap_used / (float)swap_total);
if (swap_total > 0)
percent = 100 * ((float)swap_used / (float)swap_total);
}
if (percent > 100) percent = 100;
else if (percent < 0) percent = 0;
@ -72,7 +73,8 @@ int _memusage_proc_getmemusage(void)
fclose(f);
mem_used = mem_total - mem_free;
percent = 100 * ((float)mem_used / (float)mem_total);
if (mem_total > 0)
percent = 100 * ((float)mem_used / (float)mem_total);
}
if (percent > 100) percent = 100;
else if (percent < 0) percent = 0;

View File

@ -63,8 +63,9 @@ _netstatus_cb_usage_check_notify(void *data,
Thread_Config *thc = data;
Instance *inst = thc->inst;
if (inst->cfg->esm != E_SYSINFO_MODULE_NETSTATUS && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
if (!inst->cfg) return;
if (inst->cfg->esm != E_SYSINFO_MODULE_NETSTATUS && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
_netstatus_face_update(inst, EINA_FALSE, thc->rstatus);
_netstatus_face_update(inst, EINA_TRUE, thc->tstatus);
}

View File

@ -293,7 +293,7 @@ check(Tempthread *tth)
{
char dummy[4096];
if (fgets(buf, sizeof(buf), f) == NULL) goto error;
fclose(f);
f = NULL;
if (sscanf(buf, "%s %s %i", dummy, dummy, &temp) == 3)