qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 08/15] Add base64 encoder/decoder


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH v2 08/15] Add base64 encoder/decoder
Date: Sun, 23 May 2010 12:04:42 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

Avi Kivity wrote:
> On 05/23/2010 10:55 AM, Jan Kiszka wrote:
>>>> +/*
>>>> + * Convert string 'src' of length 'srclen' from base64 to binary form,
>>>> + * saving the result in 'dest'. The size of the destination buffer
>>>> must be at
>>>> + * least srclen * 3 / 4.
>>>> + *
>>>> + * Returns 0 on success, -1 on conversion error.
>>>> + */
>>>> +int base64_decode(const char *src, size_t srclen, void *dest)
>>>>        
>>> I think dest should be char *, like all the functions where dest is
>>> passed to.
>>>      
>> The output may but need not be a string, it's binary data. And to avoid
>> needless warnings about signedness mismatches if unsigned char or
>> uint8_t buffers are passed, I chose void *.
>>    
> 
> I think qemu is pretty consistent in using uint8_t for binary, and void
> * is a little dangerous as it allows passing any kind of data (anything
> above a byte is subject to endianness issues for example).
> 
> But I don't feel strongly about this.
> 

Let's go for consistency: I switched to uint8_t for the binary input/output.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]