bug-gnulib
[Top][All Lists]
Advanced

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

striconv tweak


From: Bruno Haible
Subject: striconv tweak
Date: Sat, 13 Jan 2007 15:43:00 +0100 (MET)
User-agent: KMail/1.5.4

Hi,

For some iconv encodings the buffer needs to be aligned. This fixes an
alignment issue on CPUs other than x86.


2007-01-10  Bruno Haible  <address@hidden>

        * lib/striconv.c (mem_cd_iconv): Align the temporary buffer.

*** gnulib-20070109/lib/striconv.c      2007-01-09 00:14:32.000000000 +0100
--- gnulib-20070109-unistring/lib/striconv.c    2007-01-10 10:05:14.000000000 
+0100
***************
*** 1,5 ****
  /* Charset conversion.
!    Copyright (C) 2001-2006 Free Software Foundation, Inc.
     Written by Bruno Haible and Simon Josefsson.
  
     This program is free software; you can redistribute it and/or modify
--- 1,5 ----
  /* Charset conversion.
!    Copyright (C) 2001-2007 Free Software Foundation, Inc.
     Written by Bruno Haible and Simon Josefsson.
  
     This program is free software; you can redistribute it and/or modify
***************
*** 59,65 ****
    /* Determine the length we need.  */
    {
      size_t count = 0;
!     char tmpbuf[tmpbufsize];
      const char *inptr = src;
      size_t insize = srclen;
  
--- 59,68 ----
    /* Determine the length we need.  */
    {
      size_t count = 0;
!     /* The alignment is needed when converting e.g. to glibc's WCHAR_T or
!        libiconv's UCS-4-INTERNAL encoding.  */
!     union { unsigned int align; char buf[tmpbufsize]; } tmp;
! # define tmpbuf tmp.buf
      const char *inptr = src;
      size_t insize = srclen;
  
***************
*** 107,112 ****
--- 110,116 ----
      }
  # endif
      length = count;
+ # undef tmpbuf
    }
  
    if (length == 0)





reply via email to

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