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

Nathanael Nerode neroden-guest at costa.debian.org
Sat Sep 3 20:53:51 UTC 2005


Author: neroden-guest
Date: 2005-09-03 20:53:50 +0000 (Sat, 03 Sep 2005)
New Revision: 156

Modified:
   pinfo/branches/cxx/src/initializelinks.cxx
   pinfo/branches/cxx/src/mainfunction.cxx
   pinfo/branches/cxx/src/manual.cxx
   pinfo/branches/cxx/src/parse_config.cxx
   pinfo/branches/cxx/src/tmpfiles.cxx
   pinfo/branches/cxx/src/tmpfiles.h
   pinfo/branches/cxx/src/video.cxx
Log:
Fix an apparent off-by-one error in mouse handling.
Fix return type of tmpfiles routines.
Fix some (easy) signed-unsigned warning issues.


Modified: pinfo/branches/cxx/src/initializelinks.cxx
===================================================================
--- pinfo/branches/cxx/src/initializelinks.cxx	2005-09-03 20:08:05 UTC (rev 155)
+++ pinfo/branches/cxx/src/initializelinks.cxx	2005-09-03 20:53:50 UTC (rev 156)
@@ -429,6 +429,7 @@
 		 * matches different info file.                                                *
 		 ******************************************************************************/
 		/* make sure that we don't handle notes, which fit in the second line */
+		/* Signed-unsigned issues FIXME */
 		if ((long)(notestart - buf) < strlen(line1))
 		{
 			/* we can handle only those, who are in the first line, or who are split up into two lines */

Modified: pinfo/branches/cxx/src/mainfunction.cxx
===================================================================
--- pinfo/branches/cxx/src/mainfunction.cxx	2005-09-03 20:08:05 UTC (rev 155)
+++ pinfo/branches/cxx/src/mainfunction.cxx	2005-09-03 20:53:50 UTC (rev 156)
@@ -391,7 +391,8 @@
 					long tokenpos;
 					long starttokenpos;
 					long filelen;
-					for (typeof(indirect.size()) j = indirectstart;
+					/* Signed/unsigned issues. */
+					for (signed int j = indirectstart;
 					     j < indirect.size(); j++)
 					{
 						fd = openinfo(indirect[j].filename, 1);	/* get file length. */
@@ -699,7 +700,7 @@
 				curs_set(0);
 				noecho();
 				attrset(normal);
-				for (int i = 0; i < tag_table.size(); i++)
+				for (typeof(tag_table.size()) i = 0; i < tag_table.size(); i++)
 				{
 					/* if the name was found in the tag table */
 					if (tag_table[i].nodename == token)

Modified: pinfo/branches/cxx/src/manual.cxx
===================================================================
--- pinfo/branches/cxx/src/manual.cxx	2005-09-03 20:08:05 UTC (rev 155)
+++ pinfo/branches/cxx/src/manual.cxx	2005-09-03 20:53:50 UTC (rev 156)
@@ -1064,7 +1064,7 @@
 					if (manualpos >= 1)
 						manualpos--;
 					/* and scan for selected again :) */
-					for (i = 0; i < manuallinks.size(); i++)
+					for (typeof(manuallinks.size()) i = 0; i < manuallinks.size(); i++)
 					{
 						if (manuallinks[i].line == manualpos)
 						{
@@ -1158,32 +1158,32 @@
 			if ((key == keys.down_1) || (key == keys.down_2))
 			{
 				selectedchanged = 0;
-				if (selected < manuallinks.size())
-					for (i = selected + 1; i < manuallinks.size(); i++)
-					{
+				/* signed/unsigned issues with selected FIXME */
+				if (selected < manuallinks.size()) {
+					for (typeof(manuallinks.size()) i = selected + 1;
+					     i < manuallinks.size(); i++) {
 						if ((manuallinks[i].line >= manualpos) &&
-								(manuallinks[i].line < manualpos +(maxy - 2)))
-						{
+								(manuallinks[i].line < manualpos +(maxy - 2))) {
 							selected = i;
 							selectedchanged = 1;
 							break;
 						}
 					}
-				if (!selectedchanged)
-				{
+				}
+				if (!selectedchanged) {
 					if (manualpos < ManualLines -(maxy - 1))
 						manualpos++;
-					if (selected < manuallinks.size())
-						for (i = selected + 1; i < manuallinks.size(); i++)
-						{
+					if (selected < manuallinks.size()) {
+						for (typeof(manuallinks.size()) i = selected + 1;
+						     i < manuallinks.size(); i++) {
 							if ((manuallinks[i].line >= manualpos) &&
-									(manuallinks[i].line < manualpos +(maxy - 2)))
-							{
+									(manuallinks[i].line < manualpos +(maxy - 2))) {
 								selected = i;
 								selectedchanged = 1;
 								break;
 							}
 						}
+					}
 				}
 			}
 			/*=====================================================*/
@@ -1263,7 +1263,7 @@
 				{
 					if ((mouse.y > 0) &&(mouse.y < maxy - 1))
 					{
-						for (i = selected; i > 0; i--)
+						for (i = selected; i >= 0; i--)
 						{
 							if (manuallinks[i].line == mouse.y + manualpos - 1)
 							{
@@ -1304,7 +1304,7 @@
 				{
 					if ((mouse.y > 0) &&(mouse.y < maxy - 1))
 					{
-						for (i = selected; i > 0; i--)
+						for (i = selected; i >= 0; i--)
 						{
 							if (manuallinks[i].line == mouse.y + manualpos - 1)
 							{
@@ -1366,8 +1366,7 @@
 /* scan for some hyperlink, available on current screen */
 rescan_selected()
 {
-	int i;
-	for (i = 0; i < manuallinks.size(); i++)
+	for (typeof(manuallinks.size()) i = 0; i < manuallinks.size(); i++)
 	{
 		if ((manuallinks[i].line >= manualpos) &&
 				(manuallinks[i].line < manualpos +(maxy - 1)))
@@ -1543,9 +1542,8 @@
 void
 add_highlights()
 {
-	int i;
 	/* scan through the visible objects */
-	for (i = 0; i < manuallinks.size(); i++)
+	for (typeof(manuallinks.size()) i = 0; i < manuallinks.size(); i++)
 	{
 		/* if the object is on the current screen */
 		if ((manuallinks[i].line >= manualpos) &&

Modified: pinfo/branches/cxx/src/parse_config.cxx
===================================================================
--- pinfo/branches/cxx/src/parse_config.cxx	2005-09-03 20:08:05 UTC (rev 155)
+++ pinfo/branches/cxx/src/parse_config.cxx	2005-09-03 20:53:50 UTC (rev 156)
@@ -918,9 +918,7 @@
 char *
 str_toupper(char *str)
 {
-	int i;
-
-	for (i = 0; i < strlen(str); ++i)
+	for (unsigned int i = 0; i < strlen(str); ++i)
 		if (islower(str[i]))
 			str[i] = toupper(str[i]);
 

Modified: pinfo/branches/cxx/src/tmpfiles.cxx
===================================================================
--- pinfo/branches/cxx/src/tmpfiles.cxx	2005-09-03 20:08:05 UTC (rev 155)
+++ pinfo/branches/cxx/src/tmpfiles.cxx	2005-09-03 20:53:50 UTC (rev 156)
@@ -47,7 +47,7 @@
 string tmpfilename2;
 string apropos_tmpfilename;
 
-int mktmpdir () {
+void mktmpdir () {
 	ostringstream tmpdirname_stream;
 	tmpdirname_stream << "/tmp/pinfo";
 	pid_t my_pid = getpid();
@@ -79,7 +79,7 @@
 	umask(077);
 }
 
-int rmtmpfiles () {
+void rmtmpfiles () {
 	int result;
 
 	result = unlink(tmpfilename1.c_str());

Modified: pinfo/branches/cxx/src/tmpfiles.h
===================================================================
--- pinfo/branches/cxx/src/tmpfiles.h	2005-09-03 20:08:05 UTC (rev 155)
+++ pinfo/branches/cxx/src/tmpfiles.h	2005-09-03 20:53:50 UTC (rev 156)
@@ -28,7 +28,7 @@
 extern std::string tmpfilename2;
 extern std::string apropos_tmpfilename;
 
-int mktmpdir(void);
-int rmtmpfiles(void);
+void mktmpdir(void);
+void rmtmpfiles(void);
 
 #endif /* _TMPFILES_H */

Modified: pinfo/branches/cxx/src/video.cxx
===================================================================
--- pinfo/branches/cxx/src/video.cxx	2005-09-03 20:08:05 UTC (rev 155)
+++ pinfo/branches/cxx/src/video.cxx	2005-09-03 20:53:50 UTC (rev 156)
@@ -145,9 +145,7 @@
 void
 info_add_highlights(int pos, int cursor, long lines, int column, char **message)
 {
-	int i, j;
-	for (i = 0; i < hyperobjects.size(); i++)
-	{
+	for (typeof(hyperobjects.size()) i = 0; i < hyperobjects.size(); i++) {
 		if ((hyperobjects[i].line < pos) ||
 				(hyperobjects[i].line >= pos +(maxy - 2)))
 			continue; /* Off screen */
@@ -188,6 +186,7 @@
 					mynode,
 					column);
 		} else {
+			int j;
 			string part1, part2;
 			part1 = mynode.substr(0, hyperobjects[i].breakpos);
 			info_addstring(1 + hyperobjects[i].line - pos,
@@ -215,14 +214,14 @@
 		long maxpos = pos +(maxy - 2);
 		if (maxpos > lines)
 			maxpos = lines;
-		for (i = pos; i < maxpos; i++)
+		for (int i = pos; i < maxpos; i++)
 		{
 			int maxregexp = aftersearch ? h_regexp_num + 1 : h_regexp_num;
 			/*
 			 * if it is after search, then we have user defined regexps+
 			 * a searched regexp to highlight
 			 */
-			for (j = 0; j < maxregexp; j++)
+			for (int j = 0; j < maxregexp; j++)
 			{
 				char *str = message[i];
 				while (!regexec(&h_regexp[j], str, 1, pmatch, 0))




More information about the Pinfo-devel mailing list