[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH v3 19/25] s390/ebcdic: Use size_t to iterate over
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-ppc] [PATCH v3 19/25] s390/ebcdic: Use size_t to iterate over arrays |
Date: |
Wed, 20 Feb 2019 12:37:12 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 |
On 2/20/19 10:40 AM, Cornelia Huck wrote:
> On Wed, 20 Feb 2019 02:02:26 +0100
> Philippe Mathieu-Daudé <address@hidden> wrote:
>
>> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
>> ---
>> include/hw/s390x/ebcdic.h | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/hw/s390x/ebcdic.h b/include/hw/s390x/ebcdic.h
>> index 69a04cab62..d89174e113 100644
>> --- a/include/hw/s390x/ebcdic.h
>> +++ b/include/hw/s390x/ebcdic.h
>> @@ -83,18 +83,18 @@ static const uint8_t ascii2ebcdic[] = {
>> 0x90, 0x3F, 0x3F, 0x3F, 0x3F, 0xEA, 0x3F, 0xFF
>> };
>>
>> -static inline void ebcdic_put(uint8_t *p, const char *ascii, int len)
>> +static inline void ebcdic_put(uint8_t *p, const char *ascii, size_t len)
>> {
>> - int i;
>> + size_t i;
>>
>> for (i = 0; i < len; i++) {
>> p[i] = ascii2ebcdic[(uint8_t)ascii[i]];
>> }
>> }
>>
>> -static inline void ascii_put(uint8_t *p, const char *ebcdic, int len)
>> +static inline void ascii_put(uint8_t *p, const char *ebcdic, size_t len)
>> {
>> - int i;
>> + size_t i;
>>
>> for (i = 0; i < len; i++) {
>> p[i] = ebcdic2ascii[(uint8_t)ebcdic[i]];
>
> Making the passed len parameter a size_t makes sense; but using a
> size_t as an array iterator looks a bit unidiomatic... it's not wrong,
> though.
This is to silent the "-Wsign-conversion -Wsign-compare" warnings...
I am still not sure what is the best to do.
> Acked-by: Cornelia Huck <address@hidden>
Thanks!
Phil.
- [Qemu-ppc] [PATCH v3 00/25] chardev: Convert qemu_chr_write() to take a size_t argument, Philippe Mathieu-Daudé, 2019/02/19
- [Qemu-ppc] [PATCH v3 19/25] s390/ebcdic: Use size_t to iterate over arrays, Philippe Mathieu-Daudé, 2019/02/19
- [Qemu-ppc] [PATCH v3 15/25] spapr-vty: Let vty_putchars() use size_t, Philippe Mathieu-Daudé, 2019/02/19
- [Qemu-ppc] [PATCH v3 20/25] s390x/sclp: Use a const variable to improve readability, Philippe Mathieu-Daudé, 2019/02/19
- [Qemu-ppc] [PATCH v3 14/25] virtio-serial: Let VirtIOSerialPortClass::have_data() use size_t, Philippe Mathieu-Daudé, 2019/02/19
- [Qemu-ppc] [PATCH v3 12/25] xen: Let buffer_append() return the size consumed, Philippe Mathieu-Daudé, 2019/02/19
- [Qemu-ppc] [PATCH v3 09/25] vhost-user: Express sizeof with size_t, Philippe Mathieu-Daudé, 2019/02/19