diff options
author | wlemb <wlemb> | 2003-02-16 22:53:23 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2003-02-16 22:53:23 +0000 |
commit | cb5c9fa2e9b072eafd936a516564930a37270654 (patch) | |
tree | a32541c77505673affbf22e28e570b8e5e3d71f3 /src/devices/grotty | |
parent | 3b144c5915edcc49b59e82006562256a720f1f78 (diff) | |
download | groff-cb5c9fa2e9b072eafd936a516564930a37270654.tar.gz |
* src/devices/grotty/tty.cc (tty_printer::make_rgb_string): Avoid
null-bytes in created string.
* src/roff/troff/input.cc (lookup_color, interpolate_macro,
alias_macro, lookup_request): Improve warning messages.
* src/roff/troff/node.cc (suppress_node::tprint): Use `strsave',
not `strdup'.
Free `last_image_filename'.
* src/preproc/html/pre-html.cc (char_block::char_block): Initialize
`buffer'.
(imageList::createPage, imageList::createImage): Use `free', not
`a_delete'.
(imageItem::~imageItem): Free `imageName'.
(addRegDef): Use `strsave', not `strdup'.
(get_resolution): Free `pathp'.
Diffstat (limited to 'src/devices/grotty')
-rw-r--r-- | src/devices/grotty/tty.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/devices/grotty/tty.cc b/src/devices/grotty/tty.cc index 13a0b015..984ed6ca 100644 --- a/src/devices/grotty/tty.cc +++ b/src/devices/grotty/tty.cc @@ -213,14 +213,21 @@ char *tty_printer::make_rgb_string(unsigned int r, unsigned int g, unsigned int b) { - char *s = new char[7]; + char *s = new char[8]; s[0] = char(r >> 8); s[1] = char(r & 0xff); s[2] = char(g >> 8); s[3] = char(g & 0xff); s[4] = char(b >> 8); s[5] = char(b & 0xff); - s[6] = 0; + s[6] = 0x80; + s[7] = 0; + // avoid null-bytes in string + for (int i = 0; i < 6; i++) + if (!s[i]) { + s[i] = 1; + s[6] |= 1 << i; + } return s; } |