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

Nathanael Nerode neroden-guest at costa.debian.org
Sun Aug 28 20:44:10 UTC 2005


Author: neroden-guest
Date: 2005-08-28 20:44:07 +0000 (Sun, 28 Aug 2005)
New Revision: 52

Modified:
   pinfo/branches/cxx/src/filehandling_functions.cxx
   pinfo/branches/cxx/src/filehandling_functions.h
   pinfo/branches/cxx/src/pinfo.cxx
Log:
Convert interface to addrawpath.



Modified: pinfo/branches/cxx/src/filehandling_functions.cxx
===================================================================
--- pinfo/branches/cxx/src/filehandling_functions.cxx	2005-08-28 20:40:25 UTC (rev 51)
+++ pinfo/branches/cxx/src/filehandling_functions.cxx	2005-08-28 20:44:07 UTC (rev 52)
@@ -785,13 +785,11 @@
 }
 
 void
-addrawpath(char *filename)
+addrawpath(const string filename_string)
 {
-	string filename_string;
-	filename_string = filename;
-	/* Cut the filename after the last slash. */
-	string::size_type index = filename_string.rfind('/');
+	/* Get the portion up to the last slash. */
 	string dirstring;
+	string::size_type index = filename_string.rfind('/');
 	if (index != string::npos)
 		dirstring = filename_string.substr(0, index + 1);
 	else

Modified: pinfo/branches/cxx/src/filehandling_functions.h
===================================================================
--- pinfo/branches/cxx/src/filehandling_functions.h	2005-08-28 20:40:25 UTC (rev 51)
+++ pinfo/branches/cxx/src/filehandling_functions.h	2005-08-28 20:44:07 UTC (rev 52)
@@ -28,12 +28,13 @@
 #include <unistd.h>
 #include <errno.h>
 
+#include <string>
 
 #define INFO_TAG 0x1f
 #define INDIRECT_TAG 0x7f
 
 void initpaths ();
-void addrawpath (char *filename);
+void addrawpath (const std::string filename);
 
 /*  seek to a node in certain info file */
 void seeknode (int tag_table_pos, FILE ** Id);

Modified: pinfo/branches/cxx/src/pinfo.cxx
===================================================================
--- pinfo/branches/cxx/src/pinfo.cxx	2005-08-28 20:40:25 UTC (rev 51)
+++ pinfo/branches/cxx/src/pinfo.cxx	2005-08-28 20:44:07 UTC (rev 52)
@@ -156,7 +156,8 @@
 					/* security check */
 					checkfilename(filename);
 					/* add the raw path to searchpath */
-					addrawpath(filename);
+					string filename_string = filename;
+					addrawpath(filename_string);
 					tmp = filename + strlen(filename) - 1;
 					/* later, openinfo automaticaly adds them */
 					strip_compression_suffix(filename);
@@ -306,7 +307,8 @@
 				(strncmp(filename,"./",2)==0)||
 				(filename[0]=='/'))
 		{
-			addrawpath(filename);
+			string filename_string = filename;
+			addrawpath(filename_string);
 		}
 
 		/* leave some space for `.info' suffix */




More information about the Pinfo-devel mailing list