[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * info/util.c (text_buffer_iconv): Handle E2BIG e
From: |
Gavin D. Smith |
Subject: |
branch master updated: * info/util.c (text_buffer_iconv): Handle E2BIG error here. * info/scan.c (copy_converting, scan_reference_label): Update. |
Date: |
Sat, 20 Aug 2022 07:40:40 -0400 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new d1576b9166 * info/util.c (text_buffer_iconv): Handle E2BIG error here.
* info/scan.c (copy_converting, scan_reference_label): Update.
d1576b9166 is described below
commit d1576b91666e7496d255cb80dc9451cbfecfb3a9
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Aug 20 12:40:32 2022 +0100
* info/util.c (text_buffer_iconv): Handle E2BIG error here.
* info/scan.c (copy_converting, scan_reference_label): Update.
---
ChangeLog | 5 +++++
info/scan.c | 16 +---------------
info/util.c | 16 +++++++++++++---
3 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d9e0588a0b..58b3dc3185 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-08-20 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * info/util.c (text_buffer_iconv): Handle E2BIG error here.
+ * info/scan.c (copy_converting, scan_reference_label): Update.
+
2022-08-20 Gavin Smith <gavinsmith0123@gmail.com>
Character conversion for info reference labels
diff --git a/info/scan.c b/info/scan.c
index c013d643fd..6286b317f0 100644
--- a/info/scan.c
+++ b/info/scan.c
@@ -715,11 +715,6 @@ copy_converting (long n)
/* There's been an error while converting. */
switch (errno)
{
- case E2BIG:
- /* Ran out of space in output buffer. Allocate more
- and try again. */
- text_buffer_alloc (&output_buf, n);
- continue;
case EINVAL:
/* Incomplete byte sequence at end of input buffer. Try to read
more. */
@@ -1194,16 +1189,7 @@ scan_reference_label (REFERENCE *entry, int in_index)
break; /* Success: all of input converted. */
/* There's been an error while converting. */
- switch (errno)
- {
- case E2BIG:
- /* Ran out of space in output buffer. Allocate more
- and try again. */
- text_buffer_alloc (&label_text, label_len);
- continue;
- default: /* EINVAL or EILSEQ or unknown error */
- goto no_convert;
- }
+ goto no_convert;
}
text_buffer_add_char (&label_text, '\0');
diff --git a/info/util.c b/info/util.c
index 03c8e9fe4a..d07262d19b 100644
--- a/info/util.c
+++ b/info/util.c
@@ -351,11 +351,21 @@ text_buffer_iconv (struct text_buffer *buf, iconv_t
iconv_state,
outptr = text_buffer_base (buf) + text_buffer_off (buf);
out_bytes_left = text_buffer_space_left (buf);
- iconv_ret = iconv (iconv_state, inbuf, inbytesleft,
- &outptr, &out_bytes_left);
+ while (1)
+ {
+ iconv_ret = iconv (iconv_state, inbuf, inbytesleft,
+ &outptr, &out_bytes_left);
+ if (iconv_ret != (size_t) -1)
+ break; /* success */
+
+ /* If we ran out of space, allocate more and try again. */
+ if (errno == E2BIG)
+ text_buffer_alloc (buf, 4);
+ else
+ break; /* let calling code deal with it */
+ }
text_buffer_off (buf) = outptr - text_buffer_base (buf);
-
return iconv_ret;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * info/util.c (text_buffer_iconv): Handle E2BIG error here. * info/scan.c (copy_converting, scan_reference_label): Update.,
Gavin D. Smith <=