projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Explain the different license terms for module descriptions,
[gnulib.git]
/
lib
/
striconv.c
diff --git
a/lib/striconv.c
b/lib/striconv.c
index
5326376
..
3e5782d
100644
(file)
--- a/
lib/striconv.c
+++ b/
lib/striconv.c
@@
-1,5
+1,5
@@
/* Charset conversion.
/* Charset conversion.
- Copyright (C) 2001-200
6
Free Software Foundation, Inc.
+ Copyright (C) 2001-200
7
Free Software Foundation, Inc.
Written by Bruno Haible and Simon Josefsson.
This program is free software; you can redistribute it and/or modify
Written by Bruno Haible and Simon Josefsson.
This program is free software; you can redistribute it and/or modify
@@
-51,7
+51,7
@@
mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+
|| !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
/* Set to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
/* Set to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
@@
-59,7
+59,10
@@
mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
/* Determine the length we need. */
{
size_t count = 0;
/* Determine the length we need. */
{
size_t count = 0;
- char tmpbuf[tmpbufsize];
+ /* 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;
const char *inptr = src;
size_t insize = srclen;
@@
-95,7
+98,7
@@
mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+
|| !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
{
char *outptr = tmpbuf;
size_t outsize = tmpbufsize;
{
char *outptr = tmpbuf;
size_t outsize = tmpbufsize;
@@
-107,6
+110,7
@@
mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
}
# endif
length = count;
}
# endif
length = count;
+# undef tmpbuf
}
if (length == 0)
}
if (length == 0)
@@
-126,7
+130,7
@@
mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+
|| !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
/* Return to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
/* Return to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
@@
-165,7
+169,7
@@
mem_cd_iconv (const char *src, size_t srclen, iconv_t cd,
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+
|| !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
{
size_t res = iconv (cd, NULL, NULL, &outptr, &outsize);
{
size_t res = iconv (cd, NULL, NULL, &outptr, &outsize);
@@
-248,7
+252,7
@@
str_cd_iconv (const char *src, iconv_t cd)
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
/* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+
|| !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
/* Set to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
/* Set to the initial state. */
iconv (cd, NULL, NULL, NULL, NULL);
# endif
@@
-311,7
+315,7
@@
str_cd_iconv (const char *src, iconv_t cd)
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
}
/* Avoid glibc-2.1 bug and Solaris 2.7 bug. */
# if defined _LIBICONV_VERSION \
- || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
+
|| !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun)
for (;;)
{
/* Here outptr + outbytes_remaining = result + result_size - 1. */
for (;;)
{
/* Here outptr + outbytes_remaining = result + result_size - 1. */