From d7538011ec12fbdab189506a921a0b45064c77be Mon Sep 17 00:00:00 2001 From: Al 'netstar' Poole Date: Sat, 15 Jul 2017 10:58:24 -0500 Subject: [PATCH] Modules: Fix compilation and remove warnings for BSD --- src/modules/battery/e_mod_sysctl.c | 4 ++-- src/modules/cpufreq/e_mod_main.c | 2 +- src/modules/shot/e_mod_main.c | 7 ++++++- src/modules/sysinfo/batman/batman.c | 4 ++++ src/modules/sysinfo/cpuclock/cpuclock.c | 11 ++++++++--- src/modules/sysinfo/thermal/thermal.c | 2 +- src/modules/temperature/e_mod_main.c | 5 +++-- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/modules/battery/e_mod_sysctl.c b/src/modules/battery/e_mod_sysctl.c index 3cbeb30a2..d7c889105 100644 --- a/src/modules/battery/e_mod_sysctl.c +++ b/src/modules/battery/e_mod_sysctl.c @@ -30,7 +30,6 @@ _battery_sysctl_start(void) struct sensordev snsrdev; size_t sdlen = sizeof(struct sensordev); #elif defined(__FreeBSD__) || defined(__DragonFly__) - int result; size_t len; #endif @@ -169,8 +168,9 @@ _battery_sysctl_battery_update_poll(void *data EINA_UNUSED) static int _battery_sysctl_battery_update() { - double _time, charge; + double _time; #if defined(__OpenBSD__) || defined(__NetBSD__) + double charge; struct sensor s; size_t slen = sizeof(struct sensor); #elif defined(__FreeBSD__) || defined(__DragonFly__) diff --git a/src/modules/cpufreq/e_mod_main.c b/src/modules/cpufreq/e_mod_main.c index d5251acd1..058143079 100644 --- a/src/modules/cpufreq/e_mod_main.c +++ b/src/modules/cpufreq/e_mod_main.c @@ -687,7 +687,7 @@ _cpufreq_status_check_available(Cpu_Status *s) *q = '\0'; freq = atoi(pos); freq *= 1000; - s->frequencies = eina_list_append(s->frequencies, (void *)freq); + s->frequencies = eina_list_append(s->frequencies, (void *)(long)freq); pos = q + 1; pos = strchr(pos, ' '); diff --git a/src/modules/shot/e_mod_main.c b/src/modules/shot/e_mod_main.c index 065a18d21..324c0d73b 100644 --- a/src/modules/shot/e_mod_main.c +++ b/src/modules/shot/e_mod_main.c @@ -15,6 +15,11 @@ #include #include +#if defined(__FreeBSD__) || defined(__DragonFly__) +#include +#include +#endif + static E_Module *shot_module = NULL; static E_Action *border_act = NULL, *act = NULL; @@ -1091,7 +1096,7 @@ _x_shot_now(E_Zone *zone, E_Client *ec, const char *params) } fclose(f); } -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#elif defined(__FreeBSD__) || defined(__DragonFly__) int max; size_t len = sizeof(max); diff --git a/src/modules/sysinfo/batman/batman.c b/src/modules/sysinfo/batman/batman.c index e4877f73a..2d69e49b6 100644 --- a/src/modules/sysinfo/batman/batman.c +++ b/src/modules/sysinfo/batman/batman.c @@ -354,7 +354,11 @@ _batman_device_update(Instance *inst) static Eina_Bool _screensaver_on(void *data) { +#if defined(HAVE_EEZE) Instance *inst = data; +#else + (void) data; +#endif #if defined(HAVE_EEZE) _batman_udev_stop(inst); diff --git a/src/modules/sysinfo/cpuclock/cpuclock.c b/src/modules/sysinfo/cpuclock/cpuclock.c index 35f6b99ca..a6a4940c2 100644 --- a/src/modules/sysinfo/cpuclock/cpuclock.c +++ b/src/modules/sysinfo/cpuclock/cpuclock.c @@ -4,6 +4,11 @@ #include #endif +#if defined(__FreeBSD__) || defined(__DragonFly__) + #include + #include +#endif + EINTERN void _cpuclock_poll_interval_update(Instance *inst); typedef struct _Thread_Config Thread_Config; @@ -102,9 +107,8 @@ void _cpuclock_set_frequency(int frequency) { char buf[4096]; - struct stat st; -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) frequency /= 1000; #endif @@ -114,6 +118,7 @@ _cpuclock_set_frequency(int frequency) freq = eina_stringshare_add(buf); ecore_thread_run(_cpuclock_set_thread_frequency, _cpuclock_set_thread_done, NULL, freq); #else + struct stat st; char exe[4096]; snprintf(exe, 4096, "%s/%s/cpuclock_sysfs", e_module_dir_get(sysinfo_config->module), MODULE_ARCH); @@ -482,7 +487,7 @@ _cpuclock_status_check_available(Cpu_Status *s) *q = '\0'; freq = atoi(pos); freq *= 1000; - s->frequencies = eina_list_append(s->frequencies, (void *)freq); + s->frequencies = eina_list_append(s->frequencies, (void *)(long)freq); pos = q + 1; pos = strchr(pos, ' '); diff --git a/src/modules/sysinfo/thermal/thermal.c b/src/modules/sysinfo/thermal/thermal.c index 49f79f8c0..91b4fbc7d 100644 --- a/src/modules/sysinfo/thermal/thermal.c +++ b/src/modules/sysinfo/thermal/thermal.c @@ -143,7 +143,7 @@ _thermal_check_notify(void *data, Ecore_Thread *th, void *msg) static void _thermal_check_done(void *data, Ecore_Thread *th EINA_UNUSED) { - TempThread *tth = data; + Tempthread *tth = data; Instance *inst = tth->inst; if (inst->cfg->thermal.defer) diff --git a/src/modules/temperature/e_mod_main.c b/src/modules/temperature/e_mod_main.c index 5e76d5919..8d7d0ad34 100644 --- a/src/modules/temperature/e_mod_main.c +++ b/src/modules/temperature/e_mod_main.c @@ -50,11 +50,12 @@ static Config *temperature_config = NULL; static void _temperature_thread_free(Tempthread *tth) { +#if defined(HAVE_EEZE) const char *s; - +#endif eina_stringshare_del(tth->sensor_name); eina_stringshare_del(tth->sensor_path); -#ifdef HAVE_EEZE +#if defined(HAVE_EEZE) EINA_LIST_FREE(tth->tempdevs, s) eina_stringshare_del(s); #endif e_powersave_sleeper_free(tth->sleeper);