projects
/
gnulib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ae3973f
)
Make the striconveha module actually work.
author
Bruno Haible
<bruno@clisp.org>
Wed, 24 Jan 2007 00:48:01 +0000
(
00:48
+0000)
committer
Bruno Haible
<bruno@clisp.org>
Wed, 24 Jan 2007 00:48:01 +0000
(
00:48
+0000)
ChangeLog
patch
|
blob
|
history
lib/striconveha.c
patch
|
blob
|
history
diff --git
a/ChangeLog
b/ChangeLog
index
1f7c682
..
46e11d7
100644
(file)
--- a/
ChangeLog
+++ b/
ChangeLog
@@
-1,3
+1,10
@@
+2007-01-23 Bruno Haible <bruno@clisp.org>
+
+ * lib/striconveha.c (mem_iconveha): Fix endless recursion. Try all
+ encodings without forgiving before trying any encoding with handler.
+ (str_iconveha): Try all encodings without forgiving before trying any
+ encoding with handler.
+
2007-01-23 Paul Eggert <eggert@cs.ucla.edu>
Import the following changes from libc.
2007-01-23 Paul Eggert <eggert@cs.ucla.edu>
Import the following changes from libc.
diff --git
a/lib/striconveha.c
b/lib/striconveha.c
index
12a7bfc
..
f17293f
100644
(file)
--- a/
lib/striconveha.c
+++ b/
lib/striconveha.c
@@
-163,13
+163,32
@@
mem_iconveha (const char *src, size_t srclen,
for (alias = autodetect_list; alias != NULL; alias = alias->next)
if (strcmp (from_codeset, alias->name) == 0)
{
for (alias = autodetect_list; alias != NULL; alias = alias->next)
if (strcmp (from_codeset, alias->name) == 0)
{
- const char * const *encodings
= alias->encodings_to_try
;
+ const char * const *encodings;
+ if (handler != iconveh_error)
+ {
+ /* First try all encodings without any forgiving. */
+ encodings = alias->encodings_to_try;
+ do
+ {
+ retval = mem_iconveha (src, srclen,
+ *encodings, to_codeset,
+ iconveh_error, offsets,
+ resultp, lengthp);
+ if (!(retval < 0 && errno == EILSEQ))
+ return retval;
+ encodings++;
+ }
+ while (*encodings != NULL);
+ }
+
+ encodings = alias->encodings_to_try;
do
{
retval = mem_iconveha (src, srclen,
do
{
retval = mem_iconveha (src, srclen,
- from_codeset, to_codeset, handler,
- offsets, resultp, lengthp);
+ *encodings, to_codeset,
+ handler, offsets,
+ resultp, lengthp);
if (!(retval < 0 && errno == EILSEQ))
return retval;
encodings++;
if (!(retval < 0 && errno == EILSEQ))
return retval;
encodings++;
@@
-204,11
+223,30
@@
str_iconveha (const char *src,
for (alias = autodetect_list; alias != NULL; alias = alias->next)
if (strcmp (from_codeset, alias->name) == 0)
{
for (alias = autodetect_list; alias != NULL; alias = alias->next)
if (strcmp (from_codeset, alias->name) == 0)
{
- const char * const *encodings = alias->encodings_to_try;
+ const char * const *encodings;
+
+ if (handler != iconveh_error)
+ {
+ /* First try all encodings without any forgiving. */
+ encodings = alias->encodings_to_try;
+ do
+ {
+ result = str_iconveha (src,
+ *encodings, to_codeset,
+ iconveh_error);
+ if (!(result == NULL && errno == EILSEQ))
+ return result;
+ encodings++;
+ }
+ while (*encodings != NULL);
+ }
+ encodings = alias->encodings_to_try;
do
{
do
{
- result = str_iconveha (src, *encodings, to_codeset, handler);
+ result = str_iconveha (src,
+ *encodings, to_codeset,
+ handler);
if (!(result == NULL && errno == EILSEQ))
return result;
encodings++;
if (!(result == NULL && errno == EILSEQ))
return result;
encodings++;