[Pinfo-devel] r104 - pinfo/branches/cxx/src

Nathanael Nerode neroden-guest at costa.debian.org
Tue Aug 30 15:26:53 UTC 2005


Author: neroden-guest
Date: 2005-08-30 15:26:52 +0000 (Tue, 30 Aug 2005)
New Revision: 104

Modified:
   pinfo/branches/cxx/src/datatypes.cxx
   pinfo/branches/cxx/src/datatypes.h
   pinfo/branches/cxx/src/filehandling_functions.cxx
   pinfo/branches/cxx/src/mainfunction.cxx
Log:
Make indirect table "normal" 0-based, not 1-based.


Modified: pinfo/branches/cxx/src/datatypes.cxx
===================================================================
--- pinfo/branches/cxx/src/datatypes.cxx	2005-08-30 15:02:58 UTC (rev 103)
+++ pinfo/branches/cxx/src/datatypes.cxx	2005-08-30 15:26:52 UTC (rev 104)
@@ -46,7 +46,6 @@
 SearchAgain searchagain;
 
 vector<HyperObject> hyperobjects;
-int hyperobjectcount = 0;
 
 Indirect *indirect = 0;
 TagTable *tag_table = 0;

Modified: pinfo/branches/cxx/src/datatypes.h
===================================================================
--- pinfo/branches/cxx/src/datatypes.h	2005-08-30 15:02:58 UTC (rev 103)
+++ pinfo/branches/cxx/src/datatypes.h	2005-08-30 15:26:52 UTC (rev 104)
@@ -125,8 +125,7 @@
 
 /* an array of references for info */
 extern std::vector<HyperObject> hyperobjects;
-extern int hyperobjectcount;
-/* an array of indirect entries [1 to n] */
+/* an array of indirect entries */
 extern Indirect *indirect;
 /* number of indirect entries */
 extern int IndirectEntries;

Modified: pinfo/branches/cxx/src/filehandling_functions.cxx
===================================================================
--- pinfo/branches/cxx/src/filehandling_functions.cxx	2005-08-30 15:02:58 UTC (rev 103)
+++ pinfo/branches/cxx/src/filehandling_functions.cxx	2005-08-30 15:26:52 UTC (rev 104)
@@ -313,7 +313,7 @@
 load_indirect(char **message, long lines)
 {
 	int cut = 0;			/* number of invalid entries */
-	indirect = (Indirect*)xmalloc((lines + 1) * sizeof(Indirect));
+	indirect = (Indirect*)xmalloc((lines) * sizeof(Indirect));
 	for (long i = 1; i < lines; i++) {
 		string wsk_string = message[i];
 		unsigned int n = 0;
@@ -325,14 +325,14 @@
 		} else {
 			string filename;
 			filename = wsk_string.substr(0, n);
-			strncpy(indirect[i - cut].filename, filename.c_str(), 200);
+			strncpy(indirect[i - cut - 1].filename, filename.c_str(), 200);
 
 			string remainder;
 			remainder = wsk_string.substr(n + 2, string::npos);
-			indirect[i - cut].offset = atoi(remainder.c_str());
+			indirect[i - cut - 1].offset = atoi(remainder.c_str());
 		}
 	}
-	IndirectEntries = lines - 1 - cut;
+	IndirectEntries = lines - 1 - cut - 1;
 }
 
 void
@@ -955,18 +955,14 @@
 	for (i=0; i<infopathcount; i++)
 		if (infopaths[i]) fprintf(stderr,"--> %s\n", infopaths[i]);
 #endif
-
-
 }
 
-
-
-	void
+void
 create_indirect_tag_table()
 {
 	FILE *id = 0;
 	int i, j, initial;
-	for (i = 1; i <= IndirectEntries; i++)
+	for (i = 0; i <= IndirectEntries; i++)
 	{
 		string tmpstr = indirect[i].filename;
 		id = openinfo(tmpstr, 1);
@@ -987,7 +983,8 @@
 	FirstNodeName = tag_table[1].nodename;
 	qsort(&tag_table[1], TagTableEntries, sizeof(TagTable), qsort_cmp);
 }
-	void
+
+void
 create_tag_table(FILE * id)
 {
 	char *buf = (char*)xmalloc(1024);
@@ -1051,7 +1048,7 @@
 	}				/* end: global while loop, looping until eof */
 	xfree(buf);
 	buf = 0;
-	if (!indirect)
+	if (!indirect) /* originally (!indirect) -- check this NCN FIXME */
 	{
 		FirstNodeOffset = tag_table[1].offset;
 		FirstNodeName = tag_table[1].nodename;
@@ -1069,9 +1066,9 @@
 	 * file-offset = tagtable_offset - indirect_offset +
 	 *             + tagtable[1]_offset
 	 */
-	if (indirect)	
+	if (indirect)	/* Originally if (indirect) -- NCN CHECK FIXME */
 	{
-		for (i = IndirectEntries; i >= 1; i--)
+		for (i = IndirectEntries; i >= 0; i--)
 		{
 			if (indirect[i].offset <= tag_table[tag_table_pos].offset)
 			{

Modified: pinfo/branches/cxx/src/mainfunction.cxx
===================================================================
--- pinfo/branches/cxx/src/mainfunction.cxx	2005-08-30 15:02:58 UTC (rev 103)
+++ pinfo/branches/cxx/src/mainfunction.cxx	2005-08-30 15:26:52 UTC (rev 104)
@@ -377,7 +377,8 @@
 
 				/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 				return_value = -1;
-				if (indirect)	/* the info is of indirect type; we'll search through several files */
+				/* the info is of indirect type; we'll search through several files */
+				if (indirect)
 				{
 					FILE *fd;
 					long tokenpos;
@@ -1259,7 +1260,7 @@
 	int i, fileoffset = 0;
 	if (indirect)
 	{
-		for (i = IndirectEntries; i >= 1; i--)
+		for (i = IndirectEntries; i >= 0; i--)
 		{
 			if (indirect[i].offset <= tag_table[tag_table_pos].offset)
 			{




More information about the Pinfo-devel mailing list