apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-frederic Clere <jfcl...@gmail.com>
Subject Re: apr-iconv (error: invalid lvalue in increment)
Date Thu, 30 Mar 2006 21:07:26 GMT
William A. Rowe, Jr. wrote:

> This is very similar to the recent patches on 
> httpd/trunk/modules/arch/win32
> in the mod_isapi module.  Now trying to build on gcc4 and Sunstudio 11 
> cc, I'n
> finding more and more issues with LHS cast expressions not resolving 
> as a valid
> lhs target of the assignment operator.
>
> It's silly, but needs to be patched :-/

Ok, with memcpy or with ** and casts?

Cheers

Jean-Frederic

>
> Jean-frederic Clere wrote:
>
>> Hi,
>>
>> I am trying to compile trunk and I have a problem in apr-iconv the 
>> corrections are like the patch below.
>> The memcpy is a bit paranoid, any comments?
>>
>> Cheers
>>
>> Jean-frederic
>>
>> +++
>> jfclere@vtxclere:~/apr-iconv$ svn diff .
>> Index: ces/ucs2-internal.c
>> ===================================================================
>> --- ces/ucs2-internal.c (revision 390028)
>> +++ ces/ucs2-internal.c (working copy)
>> @@ -59,7 +59,9 @@
>>                return -1;      /* No corresponding character in UCS-2 */
>>        if (*outbytesleft < sizeof(ucs2_t))
>>                return 0;       /* No space in the output buffer */
>> -       *((ucs2_t *)(*outbuf))++ = in;
>> +       /* memcpy prevents addressing problems */
>> +       *outbuf += sizeof(ucs2_t);
>> +       memcpy(*outbuf, &in, sizeof(ucs2_t));
>>        (*outbytesleft) -= sizeof(ucs2_t);
>>        return 1;
>> }
>> @@ -68,10 +70,14 @@
>> convert_to_ucs(struct iconv_ces *ces,
>>        const unsigned char **inbuf, apr_size_t *inbytesleft)
>> {
>> +       ucs2_t ret;
>>        if (*inbytesleft < sizeof(ucs2_t))
>>                return UCS_CHAR_NONE;   /* Not enough bytes in the 
>> input buffer */
>>        (*inbytesleft) -= sizeof(ucs2_t);
>> -       return *((const ucs2_t *)(*inbuf))++;
>> +       /* memcpy prevents addressing problems */
>> +       *inbuf += sizeof(ucs2_t);
>> +       memcpy(&ret, *inbuf, sizeof(ucs2_t));
>> +       return ret;
>> }
>>
>> static const struct iconv_ces_desc iconv_ces_desc = {
>> +++
>>
>>
>
>


Mime
View raw message