aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hardinfo/dt_util.c6
-rw-r--r--hardinfo/info.c4
-rw-r--r--includes/info.h4
-rw-r--r--modules/computer.c5
4 files changed, 9 insertions, 10 deletions
diff --git a/hardinfo/dt_util.c b/hardinfo/dt_util.c
index 9678042d..62213efd 100644
--- a/hardinfo/dt_util.c
+++ b/hardinfo/dt_util.c
@@ -571,8 +571,7 @@ char *dtr_list_byte(uint8_t *bytes, unsigned long count) {
dest = ret + 1;
for (i = 0; i < count; i++) {
v = bytes[i];
- sprintf(buff, "%s%02x", (i) ? " " : "", v);
- l = strlen(buff);
+ l = sprintf(buff, "%s%02x", (i) ? " " : "", v);
strncpy(dest, buff, l);
dest += l;
}
@@ -588,8 +587,7 @@ char *dtr_list_hex(dt_uint *list, unsigned long count) {
dest = ret = malloc(l);
memset(ret, 0, l);
for (i = 0; i < count; i++) {
- sprintf(buff, "%s0x%x", (i) ? " " : "", be32toh(list[i]));
- l = strlen(buff);
+ l = sprintf(buff, "%s0x%x", (i) ? " " : "", be32toh(list[i]));
strncpy(dest, buff, l);
dest += l;
}
diff --git a/hardinfo/info.c b/hardinfo/info.c
index 0bbf7a07..57da5bab 100644
--- a/hardinfo/info.c
+++ b/hardinfo/info.c
@@ -56,7 +56,7 @@ void info_add_group(struct Info *info, const gchar *group_name, ...)
g_array_append_val(info->groups, group);
}
-struct InfoField info_field(const gchar *name, gchar *value)
+struct InfoField info_field(const gchar *name, const gchar *value)
{
return (struct InfoField) {
.name = name,
@@ -160,7 +160,7 @@ static void flatten_group(GString *output, const struct InfoGroup *group)
g_string_append_printf(output, "%s=%s\n", field.name, field.value);
if (field.free_value_on_flatten)
- g_free(field.value);
+ g_free((gchar *)field.value);
}
} else if (group->computed) {
g_string_append_printf(output, "%s\n", group->computed);
diff --git a/includes/info.h b/includes/info.h
index 253c06e0..a665f0a3 100644
--- a/includes/info.h
+++ b/includes/info.h
@@ -45,7 +45,7 @@ struct InfoGroup {
struct InfoField {
const gchar *name;
- gchar *value;
+ const gchar *value;
int update_interval;
@@ -57,7 +57,7 @@ struct Info *info_new(void);
void info_add_group(struct Info *info, const gchar *group_name, ...);
void info_add_computed_group(struct Info *info, const gchar *name, const gchar *value);
-struct InfoField info_field(const gchar *name, gchar *value);
+struct InfoField info_field(const gchar *name, const gchar *value);
struct InfoField info_field_printf(const gchar *name, const gchar *format, ...)
__attribute__((format(printf, 2, 3)));
struct InfoField info_field_update(const gchar *name, int update_interval);
diff --git a/modules/computer.c b/modules/computer.c
index 08d64720..0b75d7d8 100644
--- a/modules/computer.c
+++ b/modules/computer.c
@@ -588,11 +588,12 @@ gchar *callback_display(void)
struct Info *info = info_new();
info_add_group(info, _("Session"),
- info_field(_("Type"), THISORUNK(computer->display->session_type) ),
+ info_field(_("Type"), THISORUNK(computer->display->session_type)),
info_field_last());
info_add_group(info, _("Wayland"),
- info_field(_("Current Display Name"), (wl->display_name) ? (wl->display_name) : _("(Not Available)") ),
+ info_field(_("Current Display Name"),
+ (wl->display_name) ? (wl->display_name) : _("(Not Available)")),
info_field_last());
info_add_group(info, _("X Server"),