FreeBSD Bugzilla – Attachment 189748 Details for
Bug 224552
'od -c' show wrong char when it is a non-printable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Restore the original character if we peeked ahead, but still can't complete
0001-Restore-the-original-character-if-we-peeked-ahead-bu.patch (text/plain), 1.51 KB, created by
Yuri Pankov
on 2018-01-15 13:58:35 UTC
(
hide
)
Description:
Restore the original character if we peeked ahead, but still can't complete
Filename:
MIME Type:
Creator:
Yuri Pankov
Created:
2018-01-15 13:58:35 UTC
Size:
1.51 KB
patch
obsolete
>From 66833e03829afaa85855e0daa81e8e3b7f7958ac Mon Sep 17 00:00:00 2001 >From: Yuri Pankov <yuripv@icloud.com> >Date: Mon, 15 Jan 2018 16:07:41 +0300 >Subject: [PATCH] Restore the original character if we peeked ahead, but still > can't complete. > >--- > usr.bin/hexdump/conv.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/usr.bin/hexdump/conv.c b/usr.bin/hexdump/conv.c >index 95a1becb2dc0..e4bc8d7015bd 100644 >--- a/usr.bin/hexdump/conv.c >+++ b/usr.bin/hexdump/conv.c >@@ -56,6 +56,7 @@ conv_c(PR *pr, u_char *p, size_t bufsize) > size_t clen, oclen; > int converr, pad, width; > u_char peekbuf[MB_LEN_MAX]; >+ u_char *op; > > if (pr->mbleft > 0) { > str = "**"; >@@ -107,6 +108,14 @@ conv_c(PR *pr, u_char *p, size_t bufsize) > else if (clen == (size_t)-1 || (clen == (size_t)-2 && > p == peekbuf)) { > memset(&pr->mbstate, 0, sizeof(pr->mbstate)); >+ if (p == peekbuf) { >+ /* >+ * We peeked ahead, but still can't complete; >+ * restore original character. >+ */ >+ oclen = 0; >+ p = op; >+ } > wc = *p; > clen = 1; > converr = 1; >@@ -116,6 +125,7 @@ conv_c(PR *pr, u_char *p, size_t bufsize) > * can complete it. > */ > oclen = bufsize; >+ op = p; > bufsize = peek(p = peekbuf, MB_CUR_MAX); > goto retry; > } >@@ -128,7 +138,7 @@ conv_c(PR *pr, u_char *p, size_t bufsize) > if (!odmode) { > *pr->cchar = 'c'; > (void)printf(pr->fmt, (int)wc); >- } else { >+ } else { > *pr->cchar = 'C'; > assert(strcmp(pr->fmt, "%3C") == 0); > width = wcwidth(wc); >-- >2.15.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 224552
:
189747
| 189748