[Pinfo-devel] r122 - pinfo/branches/cxx/src
Nathanael Nerode
neroden-guest at costa.debian.org
Fri Sep 2 03:13:17 UTC 2005
Author: neroden-guest
Date: 2005-09-02 03:13:16 +0000 (Fri, 02 Sep 2005)
New Revision: 122
Modified:
pinfo/branches/cxx/src/datatypes.cxx
pinfo/branches/cxx/src/datatypes.h
pinfo/branches/cxx/src/filehandling_functions.cxx
pinfo/branches/cxx/src/initializelinks.cxx
pinfo/branches/cxx/src/initializelinks.h
pinfo/branches/cxx/src/mainfunction.cxx
pinfo/branches/cxx/src/pinfo.cxx
pinfo/branches/cxx/src/utils.cxx
Log:
Convert tag_table.nodename to std::string.
Modified: pinfo/branches/cxx/src/datatypes.cxx
===================================================================
--- pinfo/branches/cxx/src/datatypes.cxx 2005-09-02 02:58:48 UTC (rev 121)
+++ pinfo/branches/cxx/src/datatypes.cxx 2005-09-02 03:13:16 UTC (rev 122)
@@ -92,7 +92,7 @@
* Add history entry
*/
void
-addinfohistory(const char *file, char *node, int cursor, int menu, int pos)
+addinfohistory(const char *file, const char *node, int cursor, int menu, int pos)
{
if (!infohistory.length)
{
Modified: pinfo/branches/cxx/src/datatypes.h
===================================================================
--- pinfo/branches/cxx/src/datatypes.h 2005-09-02 02:58:48 UTC (rev 121)
+++ pinfo/branches/cxx/src/datatypes.h 2005-09-02 03:13:16 UTC (rev 122)
@@ -52,10 +52,10 @@
}
Indirect;
-typedef struct
+typedef struct TagTable
{
- char nodename[256]; /* name of the node */
long offset; /* offset of the node */
+ std::string nodename; /* name of the node */
}
TagTable;
@@ -192,7 +192,7 @@
/* initialize history (see struct above) * variables for `lastread' history */
void inithistory ();
/* adds a history entry to the info file `lastread' history */
-void addinfohistory (const char *file, char *node, int cursor, int menu, int pos);
+void addinfohistory (const char *file, const char *node, int cursor, int menu, int pos);
/* deletes last history entry */
void dellastinfohistory ();
Modified: pinfo/branches/cxx/src/filehandling_functions.cxx
===================================================================
--- pinfo/branches/cxx/src/filehandling_functions.cxx 2005-09-02 02:58:48 UTC (rev 121)
+++ pinfo/branches/cxx/src/filehandling_functions.cxx 2005-09-02 03:13:16 UTC (rev 122)
@@ -98,7 +98,7 @@
bool
compare_tags(TagTable a, TagTable b) {
/* Should a be sorted before b? */
- int result = compare_tag_table_string(a.nodename, b.nodename);
+ int result = compare_tag_table_string(a.nodename.c_str(), b.nodename.c_str());
if (result < 0)
return true;
else
@@ -403,11 +403,7 @@
if (wsk1 < check)
{
TagTable my_tag;
- (*wsk1) = 0;
- strcpy(my_tag.nodename, wsk);
- (*(my_tag.nodename + (wsk1 - wsk) + 1)) = 0;
- /* Just terminating the bugger */
- (*wsk1) = INDIRECT_TAG;
+ my_tag.nodename.assign(wsk, wsk1 - wsk);
wsk1++;
my_tag.offset = atoi(wsk1);
tag_table.push_back(my_tag);
@@ -419,7 +415,7 @@
for (i = 0; i < tag_table.size(); i++)
{
- if (strcasecmp(tag_table[i].nodename, "Top") == 0)
+ if (strcasecmp(tag_table[i].nodename.c_str(), "Top") == 0)
{
FirstNodeOffset = tag_table[i].offset;
FirstNodeName = tag_table[i].nodename;
@@ -1033,7 +1029,7 @@
*/
if (fgets(buf, 1024, id) == NULL) {
TagTable my_tag;
- strcpy(my_tag.nodename, "12#!@#4");
+ my_tag.nodename = "12#!@#4";
my_tag.offset = 0;
tag_table.push_back(my_tag);
} else {
@@ -1058,7 +1054,7 @@
TagTable my_tag;
buf[j] = 0;
buflen = j;
- strcpy(my_tag.nodename, buf + i + 2);
+ my_tag.nodename, buf + i + 2;
my_tag.offset = oldpos - 2;
tag_table.push_back(my_tag);
break;
Modified: pinfo/branches/cxx/src/initializelinks.cxx
===================================================================
--- pinfo/branches/cxx/src/initializelinks.cxx 2005-09-02 02:58:48 UTC (rev 121)
+++ pinfo/branches/cxx/src/initializelinks.cxx 2005-09-02 03:13:16 UTC (rev 122)
@@ -51,7 +51,7 @@
* Compares two strings, ignoring whitespaces(tabs, spaces)
*/
int
-compare_tag_table_string(char *base, char *compared)
+compare_tag_table_string(const char *base, const char *compared)
{
int i, j;
Modified: pinfo/branches/cxx/src/initializelinks.h
===================================================================
--- pinfo/branches/cxx/src/initializelinks.h 2005-09-02 02:58:48 UTC (rev 121)
+++ pinfo/branches/cxx/src/initializelinks.h 2005-09-02 03:13:16 UTC (rev 122)
@@ -34,7 +34,7 @@
/* scans for the beginning of username. Returns a pointer to it. */
char *findemailstart (char *str);
/* strcmp, which is insensitive to whitespaces */
-int compare_tag_table_string (char *base, char *compared);
+int compare_tag_table_string (const char *base, const char *compared);
/*
* calculate length of visible part of string ('\t' included) between start and
* end. Returns length.
Modified: pinfo/branches/cxx/src/mainfunction.cxx
===================================================================
--- pinfo/branches/cxx/src/mainfunction.cxx 2005-09-02 02:58:48 UTC (rev 121)
+++ pinfo/branches/cxx/src/mainfunction.cxx 2005-09-02 03:13:16 UTC (rev 122)
@@ -702,7 +702,7 @@
for (int i = 0; i < tag_table.size(); i++)
{
/* if the name was found in the tag table */
- if (strcmp(token, tag_table[i].nodename) == 0)
+ if (tag_table[i].nodename == token)
{
return_value = i;
break;
Modified: pinfo/branches/cxx/src/pinfo.cxx
===================================================================
--- pinfo/branches/cxx/src/pinfo.cxx 2005-09-02 02:58:48 UTC (rev 121)
+++ pinfo/branches/cxx/src/pinfo.cxx 2005-09-02 03:13:16 UTC (rev 122)
@@ -386,7 +386,7 @@
/* handle goto/link where no file was found -- see bellow */
if (!filenotfound)
- addinfohistory(curfile.c_str(), tag_table[tag_table_pos].nodename, -1, -1, -1);
+ addinfohistory(curfile.c_str(), tag_table[tag_table_pos].nodename.c_str(), -1, -1, -1);
else
filenotfound = 0;
work_return_value = work(&message, &type, &lines, id, tag_table_pos);
Modified: pinfo/branches/cxx/src/utils.cxx
===================================================================
--- pinfo/branches/cxx/src/utils.cxx 2005-09-02 02:58:48 UTC (rev 121)
+++ pinfo/branches/cxx/src/utils.cxx 2005-09-02 03:13:16 UTC (rev 122)
@@ -312,7 +312,7 @@
{
/* left+(right-left)/2 */
int thispos = left +((right - left) >> 1);
- int compare_result = compare_tag_table_string(tag_table[thispos].nodename, node);
+ int compare_result = compare_tag_table_string(tag_table[thispos].nodename.c_str(), node);
if (compare_result == 0)
return thispos;
else
More information about the Pinfo-devel
mailing list