From c307b7178bc2041efc5d28cd84c49e61be172c69 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 22 Apr 2018 01:08:17 +0200 Subject: [PATCH] Use the correct type for frequency on {Free,Net}BSD --- src/applets/cpufreq.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/applets/cpufreq.c b/src/applets/cpufreq.c index 08a792b..989d880 100644 --- a/src/applets/cpufreq.c +++ b/src/applets/cpufreq.c @@ -174,7 +174,7 @@ static gboolean _cpufreq_on_timeout(gpointer data) { Cpufreq * cpufreq = data; PanelAppletHelper * helper = cpufreq->helper; - uint64_t freq; + int freq; size_t freqsize = sizeof(freq); char buf[256]; @@ -185,19 +185,19 @@ static gboolean _cpufreq_on_timeout(gpointer data) helper->error(NULL, error_get(NULL), 1); return TRUE; } - if(freq > INT64_MAX) + if(freq < 0) { helper->error(NULL, strerror(ERANGE), 1); return TRUE; } - if(cpufreq->current == (int64_t)freq) + if(cpufreq->current == freq) return TRUE; cpufreq->current = freq; - snprintf(buf, sizeof(buf), "%4" PRIx64, freq); + snprintf(buf, sizeof(buf), "%4" PRId64, cpufreq->current); gtk_label_set_text(GTK_LABEL(cpufreq->label), buf); # if GTK_CHECK_VERSION(2, 12, 0) - snprintf(buf, sizeof(buf), "%s%" PRIx64 " %s", _("CPU frequency: "), - freq, _("MHz")); + snprintf(buf, sizeof(buf), "%s%" PRId64 " %s", _("CPU frequency: "), + cpufreq->current, _("MHz")); gtk_widget_set_tooltip_text(cpufreq->hbox, buf); # endif return TRUE;