[Pinfo-devel] r187 - pinfo/branches/cxx/src
Nathanael Nerode
neroden-guest at costa.debian.org
Wed Sep 7 02:08:45 UTC 2005
Author: neroden-guest
Date: 2005-09-07 02:08:44 +0000 (Wed, 07 Sep 2005)
New Revision: 187
Modified:
pinfo/branches/cxx/src/filehandling_functions.cxx
pinfo/branches/cxx/src/filehandling_functions.h
pinfo/branches/cxx/src/pinfo.cxx
Log:
Convert message in load_indirect to vector<string>, and stop ignoring last
line (off-by-one issue?)
Modified: pinfo/branches/cxx/src/filehandling_functions.cxx
===================================================================
--- pinfo/branches/cxx/src/filehandling_functions.cxx 2005-09-07 01:58:42 UTC (rev 186)
+++ pinfo/branches/cxx/src/filehandling_functions.cxx 2005-09-07 02:08:44 UTC (rev 187)
@@ -405,19 +405,17 @@
}
void
-load_indirect(char **message, long lines)
+load_indirect(vector<string> message)
{
- for (long i = 1; i < lines; i++) { /* Avoid the last line. (Why?) */
- string wsk_string = message[i];
- unsigned int n = 0;
+ for (typeof(message.size()) i = 0; i < message.size(); i++) {
/* Find the first colon, but not in position 0 */
- n = wsk_string.find(':', 1);
+ string::size_type n = message[i].find(':', 1);
if (n == string::npos) {
; /* No colon. Invalid entry. */
} else {
Indirect my_entry;
- my_entry.filename = wsk_string.substr(0, n);
- string remainder = wsk_string.substr(n + 2, string::npos);
+ my_entry.filename = message[i].substr(0, n);
+ string remainder = message[i].substr(n + 2, string::npos);
my_entry.offset = atoi(remainder.c_str());
indirect.push_back(my_entry);
}
Modified: pinfo/branches/cxx/src/filehandling_functions.h
===================================================================
--- pinfo/branches/cxx/src/filehandling_functions.h 2005-09-07 01:58:42 UTC (rev 186)
+++ pinfo/branches/cxx/src/filehandling_functions.h 2005-09-07 02:08:44 UTC (rev 187)
@@ -60,7 +60,7 @@
* loads indirect table (from a special node, stored in message, of lines
* length)
*/
-void load_indirect (char **message, long lines);
+void load_indirect (std::vector<std::string> message);
/* loads tag table (as above) */
void load_tag_table (char **message, long lines);
/* opens info file */
Modified: pinfo/branches/cxx/src/pinfo.cxx
===================================================================
--- pinfo/branches/cxx/src/pinfo.cxx 2005-09-07 01:58:42 UTC (rev 186)
+++ pinfo/branches/cxx/src/pinfo.cxx 2005-09-07 02:08:44 UTC (rev 187)
@@ -333,7 +333,16 @@
if (seek_indirect(id))
{
read_item(id, &type, &message, &lines);
- load_indirect(message, lines);
+
+ /* Quick conversion to vector. Temporary, FIXME. */
+ vector<string> my_message;
+ for (typeof(my_message.size()) x = 0; x < lines; x++) {
+ /* one-based to zero-based conversion, ick */
+ string foo = message[x + 1];
+ my_message.push_back(foo);
+ }
+
+ load_indirect(my_message);
}
/* load tag table if such exists... */
@@ -473,8 +482,17 @@
{
/* read it */
read_item(id, &type, &message, &lines);
+
+ /* Quick conversion to vector. Temporary, FIXME. */
+ vector<string> my_message;
+ for (typeof(my_message.size()) x = 0; x < lines; x++) {
+ /* one-based to zero-based conversion, ick */
+ string foo = message[x + 1];
+ my_message.push_back(foo);
+ }
+
/* initialize indirect entries */
- load_indirect(message, lines);
+ load_indirect(my_message);
}
/* free old tag table */
tag_table.clear();
More information about the Pinfo-devel
mailing list