summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-02-23 22:20:18 +0100
committerBoris Faure <billiob@gmail.com>2015-02-23 22:20:18 +0100
commitf13d9ad1116bea50fa98c34a8e9c1e85b09e14f6 (patch)
tree382062d6867243c8d2ecd4e3b195b99401a69383 /src
parent2de1cd87b60b32adcb2c5373fbdb097391506e9f (diff)
fix compilation on solaris
Diffstat (limited to 'src')
-rw-r--r--src/bin/termpty.h4
-rw-r--r--src/bin/termptyesc.c29
-rw-r--r--src/bin/termptysave.c6
3 files changed, 23 insertions, 16 deletions
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index e5452d8..057724f 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -128,8 +128,8 @@ struct _Termpty
128 Termcell *screen, *screen2; 128 Termcell *screen, *screen2;
129 Termsave **back; 129 Termsave **back;
130 unsigned char oldbuf[4]; 130 unsigned char oldbuf[4];
131 int *buf; 131 Eina_Unicode *buf;
132 int buflen; 132 size_t buflen;
133 int w, h; 133 int w, h;
134 int fd, slavefd; 134 int fd, slavefd;
135 int circular_offset; 135 int circular_offset;
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 7617d6e..56cc215 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -656,7 +656,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
656 if (cc == ce) return 0; 656 if (cc == ce) return 0;
657 *b = 0; 657 *b = 0;
658 b = buf; 658 b = buf;
659 DBG(" CSI: '%c' args '%s'", *cc, (char *) buf); 659 DBG(" CSI: '%c' args '%s'", (int) *cc, (char *) buf);
660 switch (*cc) 660 switch (*cc)
661 { 661 {
662 case 'm': // color set 662 case 'm': // color set
@@ -668,7 +668,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
668 DBG("insert %d blank chars", arg); 668 DBG("insert %d blank chars", arg);
669 { 669 {
670 int pi = ty->state.insert; 670 int pi = ty->state.insert;
671 int blank[1] = { ' ' }; 671 Eina_Unicode blank[1] = { ' ' };
672 int cx = ty->state.cx; 672 int cx = ty->state.cx;
673 673
674 ty->state.wrapnext = 0; 674 ty->state.wrapnext = 0;
@@ -1035,11 +1035,12 @@ unhandled:
1035 for (i = 0; c + i <= cc && i < 100; i++) 1035 for (i = 0; c + i <= cc && i < 100; i++)
1036 { 1036 {
1037 if ((c[i] < ' ') || (c[i] >= 0x7f)) 1037 if ((c[i] < ' ') || (c[i] >= 0x7f))
1038 eina_strbuf_append_printf(bf, "\033[35m%08x\033[0m", c[i]); 1038 eina_strbuf_append_printf(bf, "\033[35m%08x\033[0m",
1039 (unsigned int) c[i]);
1039 else 1040 else
1040 eina_strbuf_append_char(bf, c[i]); 1041 eina_strbuf_append_char(bf, c[i]);
1041 } 1042 }
1042 ERR("unhandled CSI '%c': %s", *cc, eina_strbuf_string_get(bf)); 1043 ERR("unhandled CSI '%c': %s", (int) *cc, eina_strbuf_string_get(bf));
1043 eina_strbuf_free(bf); 1044 eina_strbuf_free(bf);
1044 } 1045 }
1045 cc++; 1046 cc++;
@@ -1478,7 +1479,8 @@ _handle_esc_dcs(Termpty *ty EINA_UNUSED, const Eina_Unicode *c, const Eina_Unico
1478 /* Request status string */ 1479 /* Request status string */
1479 if (len > 1 && buf[1] != 'q') 1480 if (len > 1 && buf[1] != 'q')
1480 { 1481 {
1481 ERR("invalid/unhandled dsc esc '$%c' (expected '$q')", buf[1]); 1482 ERR("invalid/unhandled dsc esc '$%c' (expected '$q')",
1483 (int) buf[1]);
1482 goto end; 1484 goto end;
1483 } 1485 }
1484 if (len < 4) 1486 if (len < 4)
@@ -1499,7 +1501,7 @@ _handle_esc_dcs(Termpty *ty EINA_UNUSED, const Eina_Unicode *c, const Eina_Unico
1499 } 1501 }
1500 else 1502 else
1501 { 1503 {
1502 ERR("invalid/unhandled dsc esc '$q\"%c'", buf[3]); 1504 ERR("invalid/unhandled dsc esc '$q\"%c'", (int) buf[3]);
1503 goto end; 1505 goto end;
1504 } 1506 }
1505 break; 1507 break;
@@ -1508,14 +1510,15 @@ _handle_esc_dcs(Termpty *ty EINA_UNUSED, const Eina_Unicode *c, const Eina_Unico
1508 case 'r': /* DECSTBM */ 1510 case 'r': /* DECSTBM */
1509 /* TODO: */ 1511 /* TODO: */
1510 default: 1512 default:
1511 ERR("unhandled dsc request status string '$q%c'", buf[2]); 1513 ERR("unhandled dsc request status string '$q%c'",
1514 (int) buf[2]);
1512 goto end; 1515 goto end;
1513 } 1516 }
1514 /* TODO */ 1517 /* TODO */
1515 break; 1518 break;
1516 default: 1519 default:
1517 // many others 1520 // many others
1518 ERR("Unhandled DCS escape '%c'", buf[0]); 1521 ERR("Unhandled DCS escape '%c'", (int) buf[0]);
1519 break; 1522 break;
1520 } 1523 }
1521end: 1524end:
@@ -1528,7 +1531,7 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
1528 int len = ce - c; 1531 int len = ce - c;
1529 1532
1530 if (len < 1) return 0; 1533 if (len < 1) return 0;
1531 DBG("ESC: '%c'", c[0]); 1534 DBG("ESC: '%c'", (int) c[0]);
1532 switch (c[0]) 1535 switch (c[0])
1533 { 1536 {
1534 case '[': 1537 case '[':
@@ -1651,7 +1654,7 @@ _handle_esc(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
1651 return 1; 1654 return 1;
1652 */ 1655 */
1653 default: 1656 default:
1654 ERR("Unhandled escape '%c' (0x%02x)", c[0], c[0]); 1657 ERR("Unhandled escape '%c' (0x%02x)", (int) c[0], (unsigned int) c[0]);
1655 return 1; 1658 return 1;
1656 } 1659 }
1657 return 0; 1660 return 0;
@@ -1770,7 +1773,7 @@ termpty_handle_seq(Termpty *ty, Eina_Unicode *c, Eina_Unicode *ce)
1770 else if (c[0] == 0x7f) // DEL 1773 else if (c[0] == 0x7f) // DEL
1771 { 1774 {
1772 ty->state.had_cr = 0; 1775 ty->state.had_cr = 0;
1773 ERR("Unhandled char 0x%02x [DEL]", c[0]); 1776 ERR("Unhandled char 0x%02x [DEL]", (unsigned int) c[0]);
1774 return 1; 1777 return 1;
1775 } 1778 }
1776 else if (c[0] == 0x9b) // ANSI ESC!!! 1779 else if (c[0] == 0x9b) // ANSI ESC!!!
@@ -1822,11 +1825,11 @@ termpty_handle_seq(Termpty *ty, Eina_Unicode *c, Eina_Unicode *ce)
1822 { 1825 {
1823 ty->state.had_cr = 0; 1826 ty->state.had_cr = 0;
1824 } 1827 }
1825 cc = (int *)c; 1828 cc = (Eina_Unicode *)c;
1826 DBG("txt: ["); 1829 DBG("txt: [");
1827 while ((cc < ce) && (*cc >= 0x20) && (*cc != 0x7f)) 1830 while ((cc < ce) && (*cc >= 0x20) && (*cc != 0x7f))
1828 { 1831 {
1829 DBG("%c", *cc); 1832 DBG("%c", (int) *cc);
1830 cc++; 1833 cc++;
1831 len++; 1834 len++;
1832 } 1835 }
diff --git a/src/bin/termptysave.c b/src/bin/termptysave.c
index dada3f0..686ea0f 100644
--- a/src/bin/termptysave.c
+++ b/src/bin/termptysave.c
@@ -98,7 +98,7 @@ _alloc_new(int size, unsigned char gen)
98 // so allocate a new block 98 // so allocate a new block
99 sz = TS_MMAP_SIZE; 99 sz = TS_MMAP_SIZE;
100 // get mmaped anonymous memory so when freed it goes away from the system 100 // get mmaped anonymous memory so when freed it goes away from the system
101 ptr = mmap(NULL, sz, PROT_READ | PROT_WRITE, 101 ptr = (unsigned char*) mmap(NULL, sz, PROT_READ | PROT_WRITE,
102 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 102 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
103 if (ptr == MAP_FAILED) { 103 if (ptr == MAP_FAILED) {
104 ERR("Cannot allocate more memory with mmap MAP_ANONYMOUS"); 104 ERR("Cannot allocate more memory with mmap MAP_ANONYMOUS");
@@ -159,7 +159,11 @@ _ts_free(void *ptr)
159 al->allocated -= sz; 159 al->allocated -= sz;
160 if (al->count > 0) return; 160 if (al->count > 0) return;
161 alloc[al->slot] = NULL; 161 alloc[al->slot] = NULL;
162#if defined (__sun) || defined (__sun__)
163 munmap((caddr_t)al, al->size);
164#else
162 munmap(al, al->size); 165 munmap(al, al->size);
166#endif
163} 167}
164 168
165static void 169static void