texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6281] info don't output unrecognized bytes


From: Gavin D. Smith
Subject: [6281] info don't output unrecognized bytes
Date: Mon, 18 May 2015 20:29:13 +0000

Revision: 6281
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6281
Author:   gavin
Date:     2015-05-18 20:29:08 +0000 (Mon, 18 May 2015)
Log Message:
-----------
info don't output unrecognized bytes

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/info-utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-05-18 16:32:19 UTC (rev 6280)
+++ trunk/ChangeLog     2015-05-18 20:29:08 UTC (rev 6281)
@@ -1,5 +1,11 @@
 2015-05-18  Gavin Smith  <address@hidden>
 
+       * info/info-utils.c (printed_representation): Declare char * as 
+       unsigned, so that check for printable limit works.  Display 
+       unknown bytes with an octal representation.
+
+2015-05-18  Gavin Smith  <address@hidden>
+
        * info/t/Init-test.inc, info/t/Init-inter.inc, info/t/*.sh:
        Revert split of GINFO variable from yesterday.
 

Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c     2015-05-18 16:32:19 UTC (rev 6280)
+++ trunk/info/info-utils.c     2015-05-18 20:29:08 UTC (rev 6281)
@@ -506,7 +506,7 @@
   int printable_limit = ISO_Latin_p ? 255 : 127;
   struct text_buffer *rep = &printed_rep;
 
-  char *cur_ptr = (char *) mbi_cur_ptr (*iter);
+  unsigned char *cur_ptr = (unsigned char *) mbi_cur_ptr (*iter);
   size_t cur_len = mb_len (mbi_cur (*iter));
 
   text_buffer_reset (&printed_rep);
@@ -587,12 +587,14 @@
     }
   else
     {
-      /* Use original bytes, although not recognized as anything.  This
-         shouldn't happen because of the many cases above .*/
-
-      *pchars = cur_len;
-      *pbytes = cur_len;
-      text_buffer_add_string (rep, cur_ptr, cur_len);
+      /* Original byte was not recognized as anything.  Display its octal 
+         value.  This could happen in the C locale for bytes above 128,
+         or for bytes 128-159 in an ISO-8859-1 locale.  Don't output the bytes 
+         as they are, because they could have special meaning to the 
+         terminal. */
+      *pchars = 4;
+      *pbytes = 4;
+      text_buffer_printf (rep, "\\%0o", *cur_ptr);
       return text_buffer_base (rep);
     }
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]