X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fcharset.c;h=a93fe99c41fa78a54550548e346966d73c474480;hb=d0801dd8f22a3e739c6a7d126d45829df981794d;hp=fcb24a488239b57ef022c1b0c5d6971b8476584d;hpb=ccb2231cd848c89f04ab2e1e54b013d69ea34893;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/charset.c b/gdb/charset.c index fcb24a4882..a93fe99c41 100644 --- a/gdb/charset.c +++ b/gdb/charset.c @@ -1,6 +1,6 @@ /* Character set conversion support for GDB. - Copyright (C) 2001-2018 Free Software Foundation, Inc. + Copyright (C) 2001-2019 Free Software Foundation, Inc. This file is part of GDB. @@ -21,12 +21,11 @@ #include "charset.h" #include "gdbcmd.h" #include "gdb_obstack.h" -#include "gdb_wait.h" +#include "gdbsupport/gdb_wait.h" #include "charset-list.h" -#include "vec.h" -#include "environ.h" +#include "gdbsupport/environ.h" #include "arch-utils.h" -#include "gdb_vecs.h" +#include "gdbsupport/gdb_vecs.h" #include #ifdef USE_WIN32API @@ -295,9 +294,6 @@ static struct gdbarch *be_le_arch; static void set_be_le_names (struct gdbarch *gdbarch) { - int i, len; - const char *target_wide; - if (be_le_arch == gdbarch) return; be_le_arch = gdbarch; @@ -307,6 +303,9 @@ set_be_le_names (struct gdbarch *gdbarch) target_wide_charset_le_name = "UTF-32LE"; target_wide_charset_be_name = "UTF-32BE"; #else + int i, len; + const char *target_wide; + target_wide_charset_le_name = NULL; target_wide_charset_be_name = NULL; @@ -548,7 +547,7 @@ convert_between_encodings (const char *from, const char *to, /* Now make sure that the object on the obstack only includes bytes we have converted. */ - obstack_blank_fast (output, -outleft); + obstack_blank_fast (output, -(ssize_t) outleft); if (r == (size_t) -1) { @@ -817,10 +816,9 @@ find_charset_names (void) #ifdef ICONV_BIN { - char *iconv_dir = relocate_gdb_directory (ICONV_BIN, - ICONV_BIN_RELOCATABLE); - iconv_program = concat (iconv_dir, SLASH_STRING, "iconv", NULL); - xfree (iconv_dir); + std::string iconv_dir = relocate_gdb_directory (ICONV_BIN, + ICONV_BIN_RELOCATABLE); + iconv_program = concat (iconv_dir.c_str(), SLASH_STRING, "iconv", NULL); } #else iconv_program = xstrdup ("iconv"); @@ -946,15 +944,9 @@ default_auto_wide_charset (void) #define ENDIAN_SUFFIX "LE" #endif -/* The code below serves to generate a compile time error if - gdb_wchar_t type is not of size 2 nor 4, despite the fact that - macro __STDC_ISO_10646__ is defined. - This is better than a gdb_assert call, because GDB cannot handle - strings correctly if this size is different. */ +/* GDB cannot handle strings correctly if this size is different. */ -extern char your_gdb_wchar_t_is_bogus[(sizeof (gdb_wchar_t) == 2 - || sizeof (gdb_wchar_t) == 4) - ? 1 : -1]; +gdb_static_assert (sizeof (gdb_wchar_t) == 2 || sizeof (gdb_wchar_t) == 4); /* intermediate_encoding returns the charset used internally by GDB to convert between target and host encodings. As the test above