[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnulib-bug
Subject:    striconveh and unistr/* fixes
From:       Bruno Haible <bruno () clisp ! org>
Date:       2007-01-26 2:58:37
Message-ID: 200701260400.22775.bruno () clisp ! org
[Download RAW message or body]

This fixes various bugs in the new striconveh and unistr/* modules.

2007-01-25  Bruno Haible  <bruno@clisp.org>

	* lib/striconveh.c (mem_cd_iconveh_internal): Ignore *lengthp if
	*resultp is 0.

	* lib/unistr/u16-to-u8.c (u16_to_u8): Fix u8_uctomb invocation.
	* lib/unistr/u32-to-u8.c (u32_to_u8): Likewise.
	* lib/unistr/u8-to-u16.c (u8_to_u16): Fix u16_uctomb invocation.
	* lib/unistr/u32-to-u16.c (u32_to_u16): Likewise.

	* modules/unistr/u8-to-u16 (Depends-on): Add missing modules.
	* modules/unistr/u8-to-u32 (Depends-on): Add missing modules.
	* modules/unistr/u16-to-u8 (Depends-on): Add missing modules.
	* modules/unistr/u16-to-u32 (Depends-on): Add missing modules.
	* modules/unistr/u32-to-u8 (Depends-on): Add missing modules.
	* modules/unistr/u32-to-u16 (Depends-on): Add missing modules.

diff -c -3 -r1.7 striconveh.c
*** lib/striconveh.c	24 Jan 2007 03:00:11 -0000	1.7
--- lib/striconveh.c	26 Jan 2007 02:51:59 -0000
***************
*** 201,207 ****
    size_t length;
    size_t last_length = (size_t)(-1); /* only needed if offsets != NULL */
  
!   if (*lengthp >= sizeof (tmpbuf))
      {
        initial_result = *resultp;
        allocated = *lengthp;
--- 201,207 ----
    size_t length;
    size_t last_length = (size_t)(-1); /* only needed if offsets != NULL */
  
!   if (*resultp != NULL && *lengthp >= sizeof (tmpbuf))
      {
        initial_result = *resultp;
        allocated = *lengthp;
diff -c -3 -r1.1 u16-to-u8.c
*** lib/unistr/u16-to-u8.c	9 Jan 2007 14:02:57 -0000	1.1
--- lib/unistr/u16-to-u8.c	26 Jan 2007 02:51:59 -0000
***************
*** 1,5 ****
  /* Convert UTF-16 string to UTF-8 string.
!    Copyright (C) 2002, 2006 Free Software Foundation, Inc.
     Written by Bruno Haible <bruno@clisp.org>, 2002.
  
     This program is free software; you can redistribute it and/or modify it
--- 1,5 ----
  /* Convert UTF-16 string to UTF-8 string.
!    Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
     Written by Bruno Haible <bruno@clisp.org>, 2002.
  
     This program is free software; you can redistribute it and/or modify it
***************
*** 71,77 ****
        s += count;
  
        /* Store it in the output string.  */
!       count = u8_uctomb (result, uc, allocated - length);
        if (count == -1)
  	{
  	  if (!(result == resultbuf || result == NULL))
--- 71,77 ----
        s += count;
  
        /* Store it in the output string.  */
!       count = u8_uctomb (result + length, uc, allocated - length);
        if (count == -1)
  	{
  	  if (!(result == resultbuf || result == NULL))
***************
*** 103,109 ****
  	    memcpy ((char *) memory, (char *) result,
  		    length * sizeof (DST_UNIT));
  	  result = memory;
! 	  count = u8_uctomb (result, uc, allocated - length);
  	  if (count < 0)
  	    abort ();
  	}
--- 103,109 ----
  	    memcpy ((char *) memory, (char *) result,
  		    length * sizeof (DST_UNIT));
  	  result = memory;
! 	  count = u8_uctomb (result + length, uc, allocated - length);
  	  if (count < 0)
  	    abort ();
  	}
*** lib/unistr/u32-to-u16.c	9 Jan 2007 14:04:09 -0000	1.1
--- lib/unistr/u32-to-u16.c	26 Jan 2007 02:51:59 -0000
***************
*** 1,5 ****
  /* Convert UTF-32 string to UTF-16 string.
!    Copyright (C) 2002, 2006 Free Software Foundation, Inc.
     Written by Bruno Haible <bruno@clisp.org>, 2002.
  
     This program is free software; you can redistribute it and/or modify it
--- 1,5 ----
  /* Convert UTF-32 string to UTF-16 string.
!    Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
     Written by Bruno Haible <bruno@clisp.org>, 2002.
  
     This program is free software; you can redistribute it and/or modify it
***************
*** 65,71 ****
  	 u16_uctomb will verify uc anyway.  */
  
        /* Store it in the output string.  */
!       count = u16_uctomb (result, uc, allocated - length);
        if (count == -1)
  	{
  	  if (!(result == resultbuf || result == NULL))
--- 65,71 ----
  	 u16_uctomb will verify uc anyway.  */
  
        /* Store it in the output string.  */
!       count = u16_uctomb (result + length, uc, allocated - length);
        if (count == -1)
  	{
  	  if (!(result == resultbuf || result == NULL))
***************
*** 97,103 ****
  	    memcpy ((char *) memory, (char *) result,
  		    length * sizeof (DST_UNIT));
  	  result = memory;
! 	  count = u16_uctomb (result, uc, allocated - length);
  	  if (count < 0)
  	    abort ();
  	}
--- 97,103 ----
  	    memcpy ((char *) memory, (char *) result,
  		    length * sizeof (DST_UNIT));
  	  result = memory;
! 	  count = u16_uctomb (result + length, uc, allocated - length);
  	  if (count < 0)
  	    abort ();
  	}
*** lib/unistr/u32-to-u8.c	9 Jan 2007 14:03:41 -0000	1.1
--- lib/unistr/u32-to-u8.c	26 Jan 2007 02:52:00 -0000
***************
*** 1,5 ****
  /* Convert UTF-32 string to UTF-8 string.
!    Copyright (C) 2002, 2006 Free Software Foundation, Inc.
     Written by Bruno Haible <bruno@clisp.org>, 2002.
  
     This program is free software; you can redistribute it and/or modify it
--- 1,5 ----
  /* Convert UTF-32 string to UTF-8 string.
!    Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
     Written by Bruno Haible <bruno@clisp.org>, 2002.
  
     This program is free software; you can redistribute it and/or modify it
***************
*** 65,71 ****
  	 u8_uctomb will verify uc anyway.  */
  
        /* Store it in the output string.  */
!       count = u8_uctomb (result, uc, allocated - length);
        if (count == -1)
  	{
  	  if (!(result == resultbuf || result == NULL))
--- 65,71 ----
  	 u8_uctomb will verify uc anyway.  */
  
        /* Store it in the output string.  */
!       count = u8_uctomb (result + length, uc, allocated - length);
        if (count == -1)
  	{
  	  if (!(result == resultbuf || result == NULL))
***************
*** 97,103 ****
  	    memcpy ((char *) memory, (char *) result,
  		    length * sizeof (DST_UNIT));
  	  result = memory;
! 	  count = u8_uctomb (result, uc, allocated - length);
  	  if (count < 0)
  	    abort ();
  	}
--- 97,103 ----
  	    memcpy ((char *) memory, (char *) result,
  		    length * sizeof (DST_UNIT));
  	  result = memory;
! 	  count = u8_uctomb (result + length, uc, allocated - length);
  	  if (count < 0)
  	    abort ();
  	}
*** lib/unistr/u8-to-u16.c	9 Jan 2007 14:02:07 -0000	1.1
--- lib/unistr/u8-to-u16.c	26 Jan 2007 02:52:00 -0000
***************
*** 1,5 ****
  /* Convert UTF-8 string to UTF-16 string.
!    Copyright (C) 2002, 2006 Free Software Foundation, Inc.
     Written by Bruno Haible <bruno@clisp.org>, 2002.
  
     This program is free software; you can redistribute it and/or modify it
--- 1,5 ----
  /* Convert UTF-8 string to UTF-16 string.
!    Copyright (C) 2002, 2006-2007 Free Software Foundation, Inc.
     Written by Bruno Haible <bruno@clisp.org>, 2002.
  
     This program is free software; you can redistribute it and/or modify it
***************
*** 71,77 ****
        s += count;
  
        /* Store it in the output string.  */
!       count = u16_uctomb (result, uc, allocated - length);
        if (count == -1)
  	{
  	  if (!(result == resultbuf || result == NULL))
--- 71,77 ----
        s += count;
  
        /* Store it in the output string.  */
!       count = u16_uctomb (result + length, uc, allocated - length);
        if (count == -1)
  	{
  	  if (!(result == resultbuf || result == NULL))
***************
*** 103,109 ****
  	    memcpy ((char *) memory, (char *) result,
  		    length * sizeof (DST_UNIT));
  	  result = memory;
! 	  count = u16_uctomb (result, uc, allocated - length);
  	  if (count < 0)
  	    abort ();
  	}
--- 103,109 ----
  	    memcpy ((char *) memory, (char *) result,
  		    length * sizeof (DST_UNIT));
  	  result = memory;
! 	  count = u16_uctomb (result + length, uc, allocated - length);
  	  if (count < 0)
  	    abort ();
  	}
*** modules/unistr/u16-to-u32	9 Jan 2007 14:03:21 -0000	1.1
--- modules/unistr/u16-to-u32	26 Jan 2007 02:52:01 -0000
***************
*** 6,11 ****
--- 6,12 ----
  
  Depends-on:
  unistr/base
+ unistr/u16-mbtouc-safe
  
  configure.ac:
  
*** modules/unistr/u16-to-u8	9 Jan 2007 14:02:57 -0000	1.1
--- modules/unistr/u16-to-u8	26 Jan 2007 02:52:01 -0000
***************
*** 6,11 ****
--- 6,13 ----
  
  Depends-on:
  unistr/base
+ unistr/u16-mbtouc-safe
+ unistr/u8-uctomb
  
  configure.ac:
  
*** modules/unistr/u32-to-u16	9 Jan 2007 14:04:09 -0000	1.1
--- modules/unistr/u32-to-u16	26 Jan 2007 02:52:01 -0000
***************
*** 6,11 ****
--- 6,12 ----
  
  Depends-on:
  unistr/base
+ unistr/u16-uctomb
  
  configure.ac:
  
*** modules/unistr/u32-to-u8	9 Jan 2007 14:03:41 -0000	1.1
--- modules/unistr/u32-to-u8	26 Jan 2007 02:52:01 -0000
***************
*** 6,11 ****
--- 6,12 ----
  
  Depends-on:
  unistr/base
+ unistr/u8-uctomb
  
  configure.ac:
  
*** modules/unistr/u8-to-u16	9 Jan 2007 14:02:07 -0000	1.1
--- modules/unistr/u8-to-u16	26 Jan 2007 02:52:01 -0000
***************
*** 6,11 ****
--- 6,13 ----
  
  Depends-on:
  unistr/base
+ unistr/u8-mbtouc-safe
+ unistr/u16-uctomb
  
  configure.ac:
  
*** modules/unistr/u8-to-u32	9 Jan 2007 14:02:33 -0000	1.1
--- modules/unistr/u8-to-u32	26 Jan 2007 02:52:01 -0000
***************
*** 6,11 ****
--- 6,12 ----
  
  Depends-on:
  unistr/base
+ unistr/u8-mbtouc-safe
  
  configure.ac:
  




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic