[Pinfo-devel] r95 - pinfo/branches/cxx/src
Nathanael Nerode
neroden-guest at costa.debian.org
Tue Aug 30 13:23:26 UTC 2005
Author: neroden-guest
Date: 2005-08-30 13:23:25 +0000 (Tue, 30 Aug 2005)
New Revision: 95
Modified:
pinfo/branches/cxx/src/manual.cxx
pinfo/branches/cxx/src/menu_and_note_utils.cxx
Log:
Make it compile after last commit.
Convert parts of mvaddstrmanual (manual.cxx).
Modified: pinfo/branches/cxx/src/manual.cxx
===================================================================
--- pinfo/branches/cxx/src/manual.cxx 2005-08-30 13:07:16 UTC (rev 94)
+++ pinfo/branches/cxx/src/manual.cxx 2005-08-30 13:23:25 UTC (rev 95)
@@ -1449,17 +1449,15 @@
/* print a manual line */
mvaddstr_manual(int y, int x, char *str)
{
- int i, j, len = strlen(str);
- static char strippedline[1024];
+ int len = strlen(str);
+ static string strippedline_string;
if ((h_regexp_num) ||(manual_aftersearch))
{
- string strippedline_string = str;
+ strippedline_string = str;
strip_manual(strippedline_string);
- strcpy(strippedline, strippedline_string.c_str());
}
move(y, x);
- for (i = 0; i < len; i++)
- {
+ for (int i = 0; i < len; i++) {
if ((i > 0) &&(i < len - 1))
{
/* handle bold highlight */
@@ -1518,25 +1516,27 @@
/* if it is after search, then we have user defined regexps+
a searched regexp to highlight */
- for (j = 0; j < maxregexp; j++)
+ for (int j = 0; j < maxregexp; j++)
{
- char *tmpstr = strippedline;
+ char* strippedline = strdup(strippedline_string.c_str());
+ char* tmpstr = strippedline;
while (!regexec(&h_regexp[j], tmpstr, 1, pmatch, 0))
{
int n = pmatch[0].rm_eo - pmatch[0].rm_so;
int rx = pmatch[0].rm_so + tmpstr - strippedline;
int curY, curX;
- char tmpchr;
getyx(stdscr, curY, curX);
- tmpchr = strippedline[rx + n];
- strippedline[rx + n] = 0;
+
attrset(searchhighlight);
- mvaddstr(y, rx, strippedline + rx);
+ string str_to_print;
+ str_to_print.assign(strippedline_string, rx, n);
+ mvaddstr(y, rx, str_to_print.c_str());
attrset(normal);
- strippedline[rx + n] = tmpchr;
+
tmpstr = tmpstr + pmatch[0].rm_eo;
move(curY, curX);
}
+ free(strippedline);
}
}
#endif
Modified: pinfo/branches/cxx/src/menu_and_note_utils.cxx
===================================================================
--- pinfo/branches/cxx/src/menu_and_note_utils.cxx 2005-08-30 13:07:16 UTC (rev 94)
+++ pinfo/branches/cxx/src/menu_and_note_utils.cxx 2005-08-30 13:23:25 UTC (rev 95)
@@ -51,7 +51,7 @@
getnextnode(char *type, char *node)
{
int j;
- char *tmp = xmalloc(strlen(type) + 1);
+ char *tmp = (char*)xmalloc(strlen(type) + 1);
char *wsk;
strcpy(tmp, type);
wsk = strstr(tmp, "Next: ");
@@ -78,7 +78,7 @@
getprevnode(char *type, char *node)
{
int j;
- char *tmp = xmalloc(strlen(type) + 1);
+ char *tmp = (char*)xmalloc(strlen(type) + 1);
char *wsk;
strcpy(tmp, type);
wsk = strstr(tmp, "Prev: ");
@@ -105,7 +105,7 @@
getupnode(char *type, char *node)
{
int j;
- char *tmp = xmalloc(strlen(type) + 1);
+ char *tmp = (char*)xmalloc(strlen(type) + 1);
char *wsk;
strcpy(tmp, type);
wsk = strstr(tmp, "Up: ");
@@ -133,7 +133,7 @@
getnodename(char *type, char *node)
{
int j;
- char *tmp = xmalloc(strlen(type) + 1);
+ char *tmp = (char*)xmalloc(strlen(type) + 1);
char *wsk;
strcpy(tmp, type);
wsk = strstr(tmp, "Node: ");
More information about the Pinfo-devel
mailing list