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

Nathanael Nerode neroden-guest at costa.debian.org
Mon Aug 29 02:27:12 UTC 2005


Author: neroden-guest
Date: 2005-08-29 02:27:11 +0000 (Mon, 29 Aug 2005)
New Revision: 62

Modified:
   pinfo/branches/cxx/src/filehandling_functions.cxx
Log:
Fix the bugs I introduced.  Should work again now.


Modified: pinfo/branches/cxx/src/filehandling_functions.cxx
===================================================================
--- pinfo/branches/cxx/src/filehandling_functions.cxx	2005-08-29 01:09:55 UTC (rev 61)
+++ pinfo/branches/cxx/src/filehandling_functions.cxx	2005-08-29 02:27:11 UTC (rev 62)
@@ -125,7 +125,9 @@
 	while ((dp = readdir(dir))) { /* Ends loop when NULL is returned */
 		string test_filename = dp->d_name;
 		strip_compression_suffix(test_filename); /* Strip in place */
-		if (test_filename  == basename_string) {
+		string basename_info = basename_string;
+		basename_info += ".info";
+		if (test_filename  == basename_info) {
 			/* Matched.  Clean up and return from function. */
 			buf += "/";
 			buf += test_filename;
@@ -1113,6 +1115,10 @@
 	for (int j = 0; j < SuffixesNumber; j++)
 	{
 		string::size_type suffix_len =  strlen(suffixes[j].suffix);
+		if (suffix_len == 0) {
+			/* Nothing is a suffix, but that gives an early false positive. */
+			continue;
+		}
 		if (    (filename.length() >= suffix_len)
 		     && (filename.substr(filename.length() - suffix_len)
 		         == suffixes[j].suffix)




More information about the Pinfo-devel mailing list