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 :-/
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
+++
[EMAIL PROTECTED]:~/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 = {
+++