diff options
author | Nick Clifton <nickc@redhat.com> | 2018-11-09 12:51:46 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2018-11-09 12:51:46 +0000 |
commit | dcd9adc5cbac756507eb5da65a4f9cf3edb8fc93 (patch) | |
tree | 50e121798030c47cc28df94fb75c97f4e91d7c57 /binutils/strings.c | |
parent | 71f5e3f7b624a725ba550a2dd18a413c88ee6497 (diff) | |
download | gdb-dcd9adc5cbac756507eb5da65a4f9cf3edb8fc93.zip gdb-dcd9adc5cbac756507eb5da65a4f9cf3edb8fc93.tar.gz gdb-dcd9adc5cbac756507eb5da65a4f9cf3edb8fc93.tar.bz2 |
oops - add missing piece of previous delta
Diffstat (limited to 'binutils/strings.c')
-rw-r--r-- | binutils/strings.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/binutils/strings.c b/binutils/strings.c index eac7292..e1fecc0 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -661,7 +661,43 @@ print_strings (const char *filename, FILE *stream, file_ptr address, if (c == EOF) break; if (! STRING_ISGRAPHIC (c)) - break; + { + if (encoding_bytes > 1) + { + /* In case of multibyte encodings rewind using magic buffer. */ + if (magiccount == 0) + { + /* If no magic buffer exists: use memory of c. */ + switch (encoding) + { + default: + break; + case 'b': + c = c & 0xff; + magiccount += 1; + break; + case 'l': + case 'L': + c = c >> 8; + magiccount += (encoding_bytes -1); + break; + case 'B': + c = (( c & 0xff0000) >> 16) | ( c & 0xff00) + | (( c & 0xff) << 16); + magiccount += 3; + break; + } + magic = (char *) &c; + } + else + { + /* If magic buffer exists: rewind. */ + magic = magic - (encoding_bytes -1); + } + address = address - (encoding_bytes -1); + } + break; + } putchar (c); } |