]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/trace/visbuf.c
ncurses 6.0 - patch 20160528
[ncurses.git] / ncurses / trace / visbuf.c
index ff9337f12ef05ae5ca805b186e25b3c926c669a4..66d0c8a797ffde2fbf3b3751491ede1fe66b2295 100644 (file)
@@ -42,7 +42,7 @@
 #include <tic.h>
 #include <ctype.h>
 
 #include <tic.h>
 #include <ctype.h>
 
-MODULE_ID("$Id: visbuf.c,v 1.46 2016/01/10 23:51:56 tom Exp $")
+MODULE_ID("$Id: visbuf.c,v 1.47 2016/05/28 23:29:37 tom Exp $")
 
 #define NUM_VISBUFS 4
 
 
 #define NUM_VISBUFS 4
 
@@ -105,7 +105,6 @@ _nc_visbuf2n(int bufnum, const char *buf, int len)
 {
     const char *vbuf = 0;
     char *tp;
 {
     const char *vbuf = 0;
     char *tp;
-    int c;
     int count;
 
     if (buf == 0)
     int count;
 
     if (buf == 0)
@@ -122,6 +121,8 @@ _nc_visbuf2n(int bufnum, const char *buf, int len)
 #else
     {
        static char *mybuf[NUM_VISBUFS];
 #else
     {
        static char *mybuf[NUM_VISBUFS];
+       int c;
+
        if (bufnum < 0) {
            for (c = 0; c < NUM_VISBUFS; ++c) {
                FreeAndNull(mybuf[c]);
        if (bufnum < 0) {
            for (c = 0; c < NUM_VISBUFS; ++c) {
                FreeAndNull(mybuf[c]);
@@ -134,6 +135,8 @@ _nc_visbuf2n(int bufnum, const char *buf, int len)
     }
 #endif
     if (tp != 0) {
     }
 #endif
     if (tp != 0) {
+       int c;
+
        *tp++ = D_QUOTE;
        while ((--count >= 0) && (c = *buf++) != '\0') {
            tp = VisChar(tp, UChar(c), NormalLen(len));
        *tp++ = D_QUOTE;
        while ((--count >= 0) && (c = *buf++) != '\0') {
            tp = VisChar(tp, UChar(c), NormalLen(len));
@@ -185,7 +188,6 @@ _nc_viswbuf2n(int bufnum, const wchar_t *buf, int len)
 {
     const char *vbuf;
     char *tp;
 {
     const char *vbuf;
     char *tp;
-    wchar_t c;
     int count;
 
     if (buf == 0)
     int count;
 
     if (buf == 0)
@@ -205,6 +207,8 @@ _nc_viswbuf2n(int bufnum, const wchar_t *buf, int len)
     }
 #endif
     if (tp != 0) {
     }
 #endif
     if (tp != 0) {
+       wchar_t c;
+
        *tp++ = D_QUOTE;
        while ((--count >= 0) && (c = *buf++) != '\0') {
            char temp[CCHARW_MAX + 80];
        *tp++ = D_QUOTE;
        while ((--count >= 0) && (c = *buf++) != '\0') {
            char temp[CCHARW_MAX + 80];
@@ -278,10 +282,10 @@ NCURSES_EXPORT(const char *)
 _nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
 {
     char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
 _nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
 {
     char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);
-    int first;
-    const char *found;
 
     if (result != 0) {
 
     if (result != 0) {
+       int first = 0;
+
 #if USE_WIDEC_SUPPORT
        if (len < 0)
            len = _nc_wchstrlen(buf);
 #if USE_WIDEC_SUPPORT
        if (len < 0)
            len = _nc_wchstrlen(buf);
@@ -290,7 +294,6 @@ _nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
        /*
         * Display one or more strings followed by attributes.
         */
        /*
         * Display one or more strings followed by attributes.
         */
-       first = 0;
        while (first < len) {
            attr_t attr = AttrOf(buf[first]);
            int last = len - 1;
        while (first < len) {
            attr_t attr = AttrOf(buf[first]);
            int last = len - 1;
@@ -306,7 +309,8 @@ _nc_viscbuf2(int bufnum, const NCURSES_CH_T * buf, int len)
            (void) _nc_trace_bufcat(bufnum, l_brace);
            (void) _nc_trace_bufcat(bufnum, d_quote);
            for (j = first; j <= last; ++j) {
            (void) _nc_trace_bufcat(bufnum, l_brace);
            (void) _nc_trace_bufcat(bufnum, d_quote);
            for (j = first; j <= last; ++j) {
-               found = _nc_altcharset_name(attr, (chtype) CharOf(buf[j]));
+               const char *found = _nc_altcharset_name(attr, (chtype)
+                                                       CharOf(buf[j]));
                if (found != 0) {
                    (void) _nc_trace_bufcat(bufnum, found);
                    attr &= ~A_ALTCHARSET;
                if (found != 0) {
                    (void) _nc_trace_bufcat(bufnum, found);
                    attr &= ~A_ALTCHARSET;