mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
hyptop: Fix -Wrestrict warning
Make sure there are two different buffers passed to iconv() to get rid
of the following GCC8 compile warning:
helper.c: In function ‘ht_ebcdic_to_ascii’:
helper.c:103:30: warning: passing argument 2 to restrict-qualified
parameter aliases with argument 4 [-Wrestrict]
iconv(l_iconv_ebcdic_ascii, &inout, &len, &inout, &len);
^~~~~~ ~~~~~~
helper.c:103:38: warning: passing argument 3 to restrict-qualified
parameter aliases with argument 5 [-Wrestrict]
iconv(l_iconv_ebcdic_ascii, &inout, &len, &inout, &len);
^~~~ ~~~~
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
@@ -55,8 +55,7 @@ struct l_x_sys_hdr {
|
||||
|
||||
static inline void l_sys_hdr__sys_name(struct l_x_sys_hdr *hdr, char *name)
|
||||
{
|
||||
memcpy(name, hdr->sys_name, LPAR_NAME_LEN);
|
||||
ht_ebcdic_to_ascii(name, LPAR_NAME_LEN);
|
||||
ht_ebcdic_to_ascii(hdr->sys_name, name, LPAR_NAME_LEN);
|
||||
name[LPAR_NAME_LEN] = 0;
|
||||
ht_strstrip(name);
|
||||
}
|
||||
|
||||
@@ -245,8 +245,7 @@ static void l_sd_sys_root_fill(struct sd_sys *sys)
|
||||
struct sd_sys *guest;
|
||||
|
||||
guest_name[NAME_LEN] = 0;
|
||||
memcpy(guest_name, data->guest_name, NAME_LEN);
|
||||
ht_ebcdic_to_ascii(guest_name, NAME_LEN);
|
||||
ht_ebcdic_to_ascii(data->guest_name, guest_name, NAME_LEN);
|
||||
ht_strstrip(guest_name);
|
||||
|
||||
guest = sd_sys_get(sys, guest_name);
|
||||
|
||||
@@ -98,9 +98,15 @@ void *ht_realloc(void *old_ptr, size_t size)
|
||||
/*
|
||||
* Convert EBCDIC string to ASCII
|
||||
*/
|
||||
void ht_ebcdic_to_ascii(char *inout, size_t len)
|
||||
void ht_ebcdic_to_ascii(char *in, char *out, size_t size)
|
||||
{
|
||||
iconv(l_iconv_ebcdic_ascii, &inout, &len, &inout, &len);
|
||||
size_t size_out = size;
|
||||
size_t size_in = size;
|
||||
size_t rc;
|
||||
|
||||
rc = iconv(l_iconv_ebcdic_ascii, &in, &size_in, &out, &size_out);
|
||||
if (rc == (size_t) -1)
|
||||
ERR_EXIT_ERRNO("Code page translation EBCDIC-ASCII failed");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -30,7 +30,7 @@ extern char *ht_strstrip(char *str);
|
||||
extern char *ht_strdup(const char *str);
|
||||
extern void ht_print_head(const char *sys);
|
||||
extern void ht_print_help_icon(void);
|
||||
extern void ht_ebcdic_to_ascii(char *inout, size_t len);
|
||||
extern void ht_ebcdic_to_ascii(char *in, char *out, size_t len);
|
||||
extern char *ht_mount_point_get(const char *fs_type);
|
||||
extern u64 ht_ext_tod_2_us(void *tod_ext);
|
||||
extern void ht_print_time(void);
|
||||
|
||||
Reference in New Issue
Block a user