[Pinfo-devel] r164 - pinfo/trunk/src

Bas Zoetekouw bas at costa.debian.org
Sun Sep 4 00:54:11 UTC 2005


Author: bas
Date: 2005-09-04 00:54:10 +0000 (Sun, 04 Sep 2005)
New Revision: 164

Modified:
   pinfo/trunk/src/datatypes.c
   pinfo/trunk/src/filehandling_functions.c
   pinfo/trunk/src/initializelinks.c
   pinfo/trunk/src/mainfunction.c
   pinfo/trunk/src/manual.c
   pinfo/trunk/src/pinfo.c
   pinfo/trunk/src/video.c
Log:
Fixed -Wshadow warnings


Modified: pinfo/trunk/src/datatypes.c
===================================================================
--- pinfo/trunk/src/datatypes.c	2005-09-04 00:39:51 UTC (rev 163)
+++ pinfo/trunk/src/datatypes.c	2005-09-04 00:54:10 UTC (rev 164)
@@ -90,7 +90,7 @@
  * Add history entry
  */
 void
-addinfohistory(char *file, char *node, int cursor, int menu, int pos)
+addinfohistory(char *file, char *node, int cursor, int mymenu, int pos)
 {
 	if (!infohistory.length)
 	{
@@ -118,7 +118,7 @@
 	strcpy(infohistory.file[infohistory.length], file);
 	infohistory.pos[infohistory.length] = pos;
 	infohistory.cursor[infohistory.length] = cursor;
-	infohistory.menu[infohistory.length] = menu;
+	infohistory.menu[infohistory.length] = mymenu;
 }
 
 /*

Modified: pinfo/trunk/src/filehandling_functions.c
===================================================================
--- pinfo/trunk/src/filehandling_functions.c	2005-09-04 00:39:51 UTC (rev 163)
+++ pinfo/trunk/src/filehandling_functions.c	2005-09-04 00:54:10 UTC (rev 164)
@@ -638,7 +638,7 @@
 	if (id)
 	{
 		char *tmp;
-		long filelen, i;
+		long filelen, l;
 		int aswitch = 0;
 		int firstswitch = 0;
 		dircount = 0;
@@ -651,18 +651,18 @@
 		fread(tmp, 1, filelen, id);
 		fclose(id);
 		id = fopen(tmpfilename, "w");
-		for (i = 0; i < filelen; i++)
+		for (l = 0; l < filelen; l++)
 		{
-			if (tmp[i] == INFO_TAG)
+			if (tmp[l] == INFO_TAG)
 			{
 				aswitch ^= 1;
 				if (!firstswitch)
-					fputc(tmp[i], id);
+					fputc(tmp[l], id);
 				firstswitch = 1;
 			}
 			else if ((aswitch) ||(!firstswitch))
-				fputc(tmp[i], id);
-			if (i + 1 == fileendentries[dircount])
+				fputc(tmp[l], id);
+			if (l + 1 == fileendentries[dircount])
 			{
 				if (aswitch != 0)
 					aswitch = 0;

Modified: pinfo/trunk/src/initializelinks.c
===================================================================
--- pinfo/trunk/src/initializelinks.c	2005-09-04 00:39:51 UTC (rev 163)
+++ pinfo/trunk/src/initializelinks.c	2005-09-04 00:54:10 UTC (rev 164)
@@ -138,7 +138,7 @@
  * Searchs for a note/menu delimiter.  it may be dot, comma, tab, or newline.
  */
 char *
-finddot(char *str, int note)
+finddot(char *str, int mynote)
 {
 	char *ptr = str;
 	char *end[4] =
@@ -155,13 +155,13 @@
 	}
 	end[0] = strrchr(str, '.');	/* nodename entry may end with dot, comma */
 	end[1] = strrchr(str, ',');	/* tabulation, or newline */
-	if (!note)
+	if (!mynote)
 	{
 		end[2] = strchr(str, '\t');
 		end[3] = strchr(str, '\n');
 	}
 	else
-		note = 2;
+		mynote = 2;
 	if (end[0])
 		closest = end[0];
 	else if (end[1])
@@ -170,7 +170,7 @@
 		closest = end[2];
 	else if (end[3])
 		closest = end[3];
-	for (i = 1; i < note; i++)	/* find the delimiter, which was found most
+	for (i = 1; i < mynote; i++)	/* find the delimiter, which was found most
 								   recently */
 	{
 		if ((end[i] < closest) &&(end[i]))

Modified: pinfo/trunk/src/mainfunction.c
===================================================================
--- pinfo/trunk/src/mainfunction.c	2005-09-04 00:39:51 UTC (rev 163)
+++ pinfo/trunk/src/mainfunction.c	2005-09-04 00:54:10 UTC (rev 164)
@@ -48,7 +48,7 @@
 #define Type	(*type)
 	static WorkRVal rval =
 	{0, 0};
-	FILE *pipe;
+	FILE *mypipe;
 	int i, fileoffset, j;
 	int indirectstart = -1;
 	int cursorchanged = 0;
@@ -241,17 +241,17 @@
 
 				myendwin();
 				system("clear");
-				pipe = popen(token, "w");	/* open pipe */
-				if (pipe != NULL)
+				mypipe = popen(token, "w");	/* open mypipe */
+				if (mypipe != NULL)
 				{
 					for (i = 1; i <= Lines; i++)	/* and flush the msg to stdin */
-						fprintf(pipe, "%s", Message[i]);
-					pclose(pipe);
+						fprintf(mypipe, "%s", Message[i]);
+					pclose(mypipe);
 					getchar();
 				}
 				doupdate();
 				curs_set(0);
-				if (pipe == NULL)
+				if (mypipe == NULL)
 					mvaddstr(maxy - 1, 0, _("Operation failed..."));
 				xfree(token);
 				token = 0;

Modified: pinfo/trunk/src/manual.c
===================================================================
--- pinfo/trunk/src/manual.c	2005-09-04 00:39:51 UTC (rev 163)
+++ pinfo/trunk/src/manual.c	2005-09-04 00:54:10 UTC (rev 164)
@@ -706,7 +706,7 @@
 {
 	/* set tmpcnt to the trailing zero of tmp */
 	int tmpcnt = strlen(tmp) + 1;
-	char *link = tmp;
+	char *mylink = tmp;
 	char *urlstart, *urlend;
 	long initialManualLinks = ManualLinks;
 	int i, b;
@@ -779,25 +779,25 @@
 	do
 	{
 		/* we look for '(', since manual link */
-		link = strchr(link, '(');
+		mylink = strchr(mylink, '(');
 		/* has form of  'blah(x)' */
-		if (link != NULL)
+		if (mylink != NULL)
 		{
 			char *temp;
 			/* look for the closing bracket */
-			if ((temp = strchr(link, ')')))
+			if ((temp = strchr(mylink, ')')))
 			{
 				char *p_t1, *p_t;
-				p_t = p_t1 = xmalloc((strlen(link) + 10) * sizeof(char));
-				for (++link; link != temp; *p_t++ = *link++);
+				p_t = p_t1 = xmalloc((strlen(mylink) + 10) * sizeof(char));
+				for (++mylink; mylink != temp; *p_t++ = *mylink++);
 				*p_t = '\0';
-				link -=(strlen(p_t1) + sizeof(char));
+				mylink -=(strlen(p_t1) + sizeof(char));
 
 				if ((!strchr(p_t1, '(')) &&(!is_in_manlinks(manlinks, p_t1)))
 				{
 					char tempchar;
 					int breakpos;
-					i = link - tmp - 1;
+					i = mylink - tmp - 1;
 					if (i < 0)
 						i++;
 					for (; i > 0; --i)
@@ -849,13 +849,13 @@
 					manuallinks[ManualLinks].col = i;
 					if (LongManualLinks)
 					{
-						for (b = 1; link[b] != ')'; b++)
-							manuallinks[ManualLinks].section[b - 1] = tolower(link[b]);
+						for (b = 1; mylink[b] != ')'; b++)
+							manuallinks[ManualLinks].section[b - 1] = tolower(mylink[b]);
 						manuallinks[ManualLinks].section[b - 1] = 0;
 					}
 					else
 					{
-						manuallinks[ManualLinks].section[0] = link[1];
+						manuallinks[ManualLinks].section[0] = mylink[1];
 						manuallinks[ManualLinks].section[1] = 0;
 					}
 					manuallinks[ManualLinks].section_mark = 0;
@@ -882,15 +882,15 @@
 				xfree((void *) p_t1);
 			}
 		}
-		if (link)
-			link++;
-		if (link >(tmp + tmpcnt))
+		if (mylink)
+			mylink++;
+		if (mylink >(tmp + tmpcnt))
 		{
 			break;
 		}
 	}
 	/* do this line until strchr() won't find a '(' in string */
-	while (link != NULL);
+	while (mylink != NULL);
 	if (initialManualLinks != ManualLinks)
 		sort_manuallinks_from_current_line(initialManualLinks, ManualLinks);
 }
@@ -900,11 +900,9 @@
 manualwork()
 {
 	/* for user's shell commands */
-	FILE *pipe;
+	FILE *mypipe;
 	/* a temporary buffer */
 	char *token;
-	/* again the same */
-	char *tmp;
 	/* key, which contains the value entered by user */
 	int key = 0;
 	/* tmp values */
@@ -927,6 +925,7 @@
 	maxy = 25;
 #endif /* getmaxyx */
 
+
 	/* get manualpos from history.  it is set in handlemanual() */
 	manualpos = manualhistory[manualhistorylength].pos;
 	/* if there was a valid selected entry, apply it */
@@ -1075,14 +1074,14 @@
 
 				myendwin();
 				system("clear");
-				/* open pipe */
-				pipe = popen(token, "w");
-				if (pipe != NULL)
+				/* open mypipe */
+				mypipe = popen(token, "w");
+				if (mypipe != NULL)
 				{
 					/* and flush the msg to stdin */
 					for (i = 0; i < ManualLines; i++)
-						fprintf(pipe, "%s", manual[i]);
-					pclose(pipe);
+						fprintf(mypipe, "%s", manual[i]);
+					pclose(mypipe);
 				}
 				getchar();
 				doupdate();
@@ -1156,6 +1155,7 @@
 				/* and search for it in all subsequential lines */
 				for (i = manualpos + 1; i < ManualLines - 1; i++)
 				{
+					char *tmp;
 					tmp = xmalloc(strlen(manual[i]) + strlen(manual[i + 1]) + 10);
 					/*
 					 * glue two following lines together, to find expres- sions

Modified: pinfo/trunk/src/pinfo.c
===================================================================
--- pinfo/trunk/src/pinfo.c	2005-09-04 00:39:51 UTC (rev 163)
+++ pinfo/trunk/src/pinfo.c	2005-09-04 00:54:10 UTC (rev 164)
@@ -61,7 +61,6 @@
 	/* this will hold the node's header */
 	char *type = 0;
 	int tag_table_pos = 1;
-	char *tmp;
 #ifdef HAVE_GETOPT_LONG
 	static struct option long_options[] =
 	{
@@ -134,6 +133,7 @@
 
 		do
 		{
+			char *tmp;
 			command_line_option = getopt_long(argc, argv,
 					"hvmfrapcsdtnlx", long_options, NULL);
 			switch(command_line_option)

Modified: pinfo/trunk/src/video.c
===================================================================
--- pinfo/trunk/src/video.c	2005-09-04 00:39:51 UTC (rev 163)
+++ pinfo/trunk/src/video.c	2005-09-04 00:54:10 UTC (rev 164)
@@ -128,15 +128,15 @@
 void
 info_addstr(int y, int x, char *txt, int column, int txtlen)
 {
-  int maxy, maxx;
-  getmaxyx(stdscr, maxy, maxx);
-  /* Use maxx and mvaddnstr to force clipping.
+  int xmax, ymax;
+  getmaxyx(stdscr, ymax, xmax);
+  /* Use xmax and mvaddnstr to force clipping.
    * Fairly blunt instrument, but the best I could come up with.
    * Breaks in the presence of tabs; I don't see how to handle them. */
 	if (x>column)
-		mvaddnstr(y,x-column,txt, maxx-(x-column) );
+		mvaddnstr(y,x-column,txt, xmax-(x-column) );
 	else if (x+txtlen>column)
-		mvaddnstr(y,0,txt+(column-x), maxx );
+		mvaddnstr(y,0,txt+(column-x), xmax );
 #ifdef __DEBUG__
   refresh();
 #endif /* __DEBUG__ */
@@ -145,7 +145,7 @@
 void
 info_add_highlights(int pos, int cursor, long lines, int column, char **message)
 {
-	int i, j;
+	int i;
 	for (i = 0; i < hyperobjectcount; i++)
 	{
 		if ((hyperobjects[i].line >= pos) &&
@@ -230,6 +230,7 @@
 				{
 					static char buf[1024];
 					char tmp;
+					int j;
 					strcpy(buf, "(");
 					strcat(buf, hyperobjects[i].file);
 					strcat(buf, ")");
@@ -264,8 +265,6 @@
 		long maxpos = pos +(maxy - 2);
 		if (maxpos > lines)
 			maxpos = lines;
-		int i;
-		for (i = pos; i < maxpos; i++)
 		{
 			int maxregexp = aftersearch ? h_regexp_num + 1 : h_regexp_num;
 			/*




More information about the Pinfo-devel mailing list