summaryrefslogtreecommitdiff
path: root/gdb/charset.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2010-05-13 23:53:31 +0000
committerMichael Snyder <msnyder@specifix.com>2010-05-13 23:53:31 +0000
commit65d22948e1ee7d60c1bc24175e7378f933e8d72c (patch)
treeb8b5f403d49e27a57c591fd9bbcdd281eb77dd24 /gdb/charset.c
parent4c4cb03d0f9e6ff0c36847a01967538b21764770 (diff)
downloadgdb-65d22948e1ee7d60c1bc24175e7378f933e8d72c.tar.gz
2010-05-13 Michael Snyder <msnyder@vmware.com>
* charset.c: White space. * c-lang.c: White space. * cli-out.c: White space. * coffread.c: White space. * complaints.c: White space. * completer.c: White space. * corefile.c: White space. * corelow.c: White space. * cp-abi.c: White space. * cp-namespace.c: White space. * cp-support.c: White space. * cp-valprint.c: White space. * c-typeprint.c: White space. * c-valprint.c: White space.
Diffstat (limited to 'gdb/charset.c')
-rw-r--r--gdb/charset.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/charset.c b/gdb/charset.c
index fadd2327646..8a9b5ad1d96 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -167,6 +167,7 @@ iconv (iconv_t utf_flag, const char **inbuf, size_t *inbytesleft,
/* In all other cases we simply copy input bytes to the
output. */
size_t amt = *inbytesleft;
+
if (amt > *outbytesleft)
amt = *outbytesleft;
memcpy (*outbuf, *inbuf, amt);
@@ -312,6 +313,7 @@ validate (struct gdbarch *gdbarch)
const char *host_cset = host_charset ();
const char *target_cset = target_charset (gdbarch);
const char *target_wide_cset = target_wide_charset_name;
+
if (!strcmp (target_wide_cset, "auto"))
target_wide_cset = gdbarch_auto_wide_charset (gdbarch);
@@ -634,10 +636,10 @@ wchar_iterate (struct wchar_iterator *iter,
size_t orig_in = iter->bytes;
size_t out_avail = out_request * sizeof (gdb_wchar_t);
size_t num;
-
size_t r = iconv (iter->desc,
(ICONV_CONST char **) &iter->input, &iter->bytes,
&outptr, &out_avail);
+
if (r == (size_t) -1)
{
switch (errno)