diff options
author | Burt P <pburt0@gmail.com> | 2019-06-30 18:14:51 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2019-07-02 17:36:25 -0700 |
commit | fa17fdf3cc463c990a1e84150c8766ec49a9c6ce (patch) | |
tree | b711bd37176156e49e41f27e2538b41d7e0306e0 /hardinfo | |
parent | d7750592038e79a602c329a42a813fa098e5f6ad (diff) |
dmi_util/memory devices: fixes for 32-bit systems
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'hardinfo')
-rw-r--r-- | hardinfo/dmi_util.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/hardinfo/dmi_util.c b/hardinfo/dmi_util.c index 627d1cd0..c82e86b4 100644 --- a/hardinfo/dmi_util.c +++ b/hardinfo/dmi_util.c @@ -239,7 +239,7 @@ static char *dd_cache[128] = {}; void dmidecode_cache_free() { int i; for(i = 0; i < 128; i++) g_free(dd_cache[i]); } -char *dmidecode_read(const unsigned long *dmi_type) { +char *dmidecode_read(const dmi_type *type) { gchar *ret = NULL; gchar full_path[PATH_MAX]; gboolean spawned; @@ -247,10 +247,10 @@ char *dmidecode_read(const unsigned long *dmi_type) { int i = 0; - if (dmi_type) { - if (dd_cache[*dmi_type]) - return g_strdup(dd_cache[*dmi_type]); - snprintf(full_path, PATH_MAX, "dmidecode -t %lu", *dmi_type); + if (type) { + if (dd_cache[*type]) + return g_strdup(dd_cache[*type]); + snprintf(full_path, PATH_MAX, "dmidecode -t %"PRId32, *type); } else { if (dd_cache[127]) return g_strdup(dd_cache[127]); @@ -269,8 +269,8 @@ char *dmidecode_read(const unsigned long *dmi_type) { } if (ret) { - if (*dmi_type) - dd_cache[*dmi_type] = g_strdup(ret); + if (*type) + dd_cache[*type] = g_strdup(ret); else dd_cache[127] = g_strdup(ret); } @@ -278,25 +278,25 @@ char *dmidecode_read(const unsigned long *dmi_type) { return ret; } -dmi_handle_list *dmi_handle_list_add(dmi_handle_list *hl, unsigned int new_handle) { +dmi_handle_list *dmi_handle_list_add(dmi_handle_list *hl, dmi_handle new_handle) { if (!hl) { hl = malloc(sizeof(dmi_handle_list)); hl->count = 1; - hl->handles = malloc(sizeof(unsigned long) * hl->count); + hl->handles = malloc(sizeof(dmi_handle) * hl->count); } else { hl->count++; - hl->handles = realloc(hl->handles, sizeof(unsigned long) * hl->count); + hl->handles = realloc(hl->handles, sizeof(dmi_handle) * hl->count); } hl->handles[hl->count - 1] = new_handle; return hl; } -dmi_handle_list *dmidecode_handles(const unsigned long *dmi_type) { +dmi_handle_list *dmidecode_handles(const dmi_type *type) { gchar *full = NULL, *p = NULL, *next_nl = NULL; dmi_handle_list *hl = NULL; unsigned int ch = 0; - full = dmidecode_read(dmi_type); + full = dmidecode_read(type); if (full) { p = full; while(next_nl = strchr(p, '\n')) { @@ -317,7 +317,7 @@ void dmi_handle_list_free(dmi_handle_list *hl) { free(hl); } -char *dmidecode_match(const char *name, const unsigned long *dmi_type, const unsigned long *handle) { +char *dmidecode_match(const char *name, const dmi_type *type, const dmi_handle *handle) { gchar *ret = NULL, *full = NULL, *p = NULL, *next_nl = NULL; unsigned int ch = 0; int ln = 0; @@ -325,7 +325,7 @@ char *dmidecode_match(const char *name, const unsigned long *dmi_type, const uns if (!name) return NULL; ln = strlen(name); - full = dmidecode_read(dmi_type); + full = dmidecode_read(type); if (full) { p = full; while(next_nl = strchr(p, '\n')) { @@ -351,7 +351,7 @@ char *dmidecode_match(const char *name, const unsigned long *dmi_type, const uns return ret; } -dmi_handle_list *dmidecode_match_value(const char *name, const char *value, const unsigned long *dmi_type) { +dmi_handle_list *dmidecode_match_value(const char *name, const char *value, const dmi_type *type) { dmi_handle_list *hl = NULL; gchar *full = NULL, *p = NULL, *next_nl = NULL; unsigned int ch = 0; @@ -361,7 +361,7 @@ dmi_handle_list *dmidecode_match_value(const char *name, const char *value, cons ln = strlen(name); lnv = (value) ? strlen(value) : 0; - full = dmidecode_read(dmi_type); + full = dmidecode_read(type); if (full) { p = full; while(next_nl = strchr(p, '\n')) { |