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

Nathanael Nerode neroden-guest at costa.debian.org
Fri Sep 2 08:52:47 UTC 2005


Author: neroden-guest
Date: 2005-09-02 08:52:46 +0000 (Fri, 02 Sep 2005)
New Revision: 145

Modified:
   pinfo/branches/cxx/src/initializelinks.cxx
   pinfo/branches/cxx/src/initializelinks.h
   pinfo/branches/cxx/src/manual.cxx
Log:
Enhance string version of findurlend to take a starting search point.
Small cosmetic cleanups.


Modified: pinfo/branches/cxx/src/initializelinks.cxx
===================================================================
--- pinfo/branches/cxx/src/initializelinks.cxx	2005-09-02 08:25:35 UTC (rev 144)
+++ pinfo/branches/cxx/src/initializelinks.cxx	2005-09-02 08:52:46 UTC (rev 145)
@@ -109,13 +109,13 @@
  * is no non-URL character)
  */
 string::size_type
-findurlend(const string str)
+findurlend(const string str, string::size_type pos)
 {
 	const char* allowedchars =
 		"QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890-_/~.%=|:@­";
 
 	string::size_type idx;
-	idx = str.find_first_not_of(allowedchars);
+	idx = str.find_first_not_of(allowedchars, pos);
 	if (idx == string::npos) {
 		/* All allowed characters! */
 		return str.length();

Modified: pinfo/branches/cxx/src/initializelinks.h
===================================================================
--- pinfo/branches/cxx/src/initializelinks.h	2005-09-02 08:25:35 UTC (rev 144)
+++ pinfo/branches/cxx/src/initializelinks.h	2005-09-02 08:52:46 UTC (rev 145)
@@ -28,7 +28,8 @@
  * returns a pointer to the found place.
  */
 char *findurlend (char *str);
-std::string::size_type findurlend (std::string str);
+std::string::size_type findurlend (std::string str,
+																	 std::string::size_type pos = 0);
 
 /* scans for the beginning of username. Returns a pointer to it.  */
 char *findemailstart (char *str);

Modified: pinfo/branches/cxx/src/manual.cxx
===================================================================
--- pinfo/branches/cxx/src/manual.cxx	2005-09-02 08:25:35 UTC (rev 144)
+++ pinfo/branches/cxx/src/manual.cxx	2005-09-02 08:52:46 UTC (rev 145)
@@ -547,17 +547,15 @@
 void
 man_initializelinks(char *tmp, int carry)
 {
-	/* set tmpcnt to the trailing zero of tmp */
-	int tmpcnt = strlen(tmp) + 1;
-	char *link = tmp;
-	char *urlstart, *urlend;
-	int i, b;
 	/******************************************************************************
 	 * handle url refrences                                                       *
 	 *****************************************************************************/
+	char *urlstart, *urlend;
 	urlend = tmp;
 
 	vector<manuallink>::size_type initialManualLinks = manuallinks.size();
+
+	char* crap = tmp;
 	while ((urlstart = strstr(urlend, "http://")) != NULL)
 	{
 		/* always successfull */
@@ -615,8 +613,11 @@
 	/******************************************************************************
 	 * handle normal manual refrences -- reference(section)                       *
 	 ******************************************************************************/
-	do
-	{
+	/* set tmpcnt to the trailing zero of tmp */
+	int tmpcnt = strlen(tmp) + 1;
+	char *link = tmp;
+	int i, b;
+	do {
 		/* we look for '(', since manual link */
 		link = strchr(link, '(');
 		/* has form of  'blah(x)' */
@@ -724,7 +725,7 @@
 		}
 		if (link)
 			link++;
-		if (link >(tmp + tmpcnt))
+		if (link > (tmp + tmpcnt))
 		{
 			break;
 		}




More information about the Pinfo-devel mailing list