File happy-gcc.patch of Package wdiff

--- wdiff-0.5.93/src/wdiff.c.orig	2009-08-04 00:03:26.000000000 +0200
+++ wdiff-0.5.93/src/wdiff.c	2009-08-04 19:06:29.563764000 +0200
@@ -44,6 +44,8 @@
 /* Library declarations.  */
 
 #include <ctype.h>
+#include <locale.h>
+#include <sys/wait.h>
 
 #if STDC_HEADERS
 # include <string.h>
@@ -537,7 +539,7 @@ real_end_of_insert (void)
 | We say "white space", but we actually mean space or punctuation |
 `----------------------------------------------------------------*/
 
-#define is_space_or_punct(c) (isspace(c) || ignore_punct && ispunct(c))
+#define is_space_or_punct(c) (isspace(c) || (ignore_punct && ispunct(c)))
 
 /*--------------------------------.
 | Skip over white space on SIDE.  |
@@ -1010,16 +1012,20 @@ reformat_diff_output (void)
 	    }
 
 	  if (!inhibit_left)
-	    if (!inhibit_common && inhibit_right)
-	      copy_until_ordinal (left_side, resync_left);
-	    else
-	      skip_until_ordinal (left_side, resync_left);
+	    {
+	      if (!inhibit_common && inhibit_right)
+	        copy_until_ordinal (left_side, resync_left);
+	      else
+	        skip_until_ordinal (left_side, resync_left);
+	    }
 
 	  if (!inhibit_right)
-	    if (inhibit_common)
-	      skip_until_ordinal (right_side, resync_right);
-	    else
-	      copy_until_ordinal (right_side, resync_right);
+	    {
+	      if (inhibit_common)
+		skip_until_ordinal (right_side, resync_right);
+	      else
+		copy_until_ordinal (right_side, resync_right);
+	    }
 
 	  if (!inhibit_common && inhibit_left && inhibit_right)
 	    copy_until_ordinal (right_side, resync_right);
@@ -1049,19 +1055,21 @@ reformat_diff_output (void)
 	     right file is used merely to show common words.  */
 
 	  if (directive == 'a' || directive == 'c')
-	    if (inhibit_right)
-	      {
-		if (!inhibit_common && inhibit_left)
-		  skip_until_ordinal (right_side, argument[3]);
-	      }
-	    else
-	      {
-		copy_whitespace (right_side, output_file);
-		start_of_insert ();
-		copy_word (right_side, output_file);
-		copy_until_ordinal (right_side, argument[3]);
-		end_of_insert ();
-	      }
+	    {
+	      if (inhibit_right)
+		{
+		  if (!inhibit_common && inhibit_left)
+		    skip_until_ordinal (right_side, argument[3]);
+		}
+	      else
+		{
+		  copy_whitespace (right_side, output_file);
+		  start_of_insert ();
+		  copy_word (right_side, output_file);
+		  copy_until_ordinal (right_side, argument[3]);
+		  end_of_insert ();
+		}
+	    }
 	}
     }
 
--- wdiff-0.5.93/src/unify.c.orig	2008-06-20 20:45:57.000000000 +0200
+++ wdiff-0.5.93/src/unify.c	2009-08-04 19:12:22.457735000 +0200
@@ -23,6 +23,7 @@
 #include "system.h"
 #include <getopt.h>
 #include <string.h>
+#include <locale.h>
 
 /* FIXME: Programs should not have such limits.  */
 #define NAME_LENGTH 255
@@ -331,7 +332,7 @@ main (int argc, char *const *argv)
 
   char previous_start = ' ';
   char star_in_cdiff;		/* if '*' seen in a new-style context diff */
-  char type;
+  char type = ' ';		// gcc warns: may be used uninitialized
 
   program_name = argv[0];
   setlocale (LC_ALL, "");
@@ -481,12 +482,12 @@ Written by Wayne Davison <davison@borlan
 		}
 	      if (!patch_format)
 		{
-		  if (output_type == TYPE_UNIDIFF
-		      && (*buffer == '+'
-			  || *buffer == '-' && previous_start != '*')
-		      || output_type == TYPE_CDIFF
-		      && (*buffer == '*'
-			  || *buffer == '-' && previous_start == '*'))
+		  if ((output_type == TYPE_UNIDIFF
+		          && (*buffer == '+'
+			      || (*buffer == '-' && previous_start != '*')))
+		      || (output_type == TYPE_CDIFF
+		          && (*buffer == '*'
+			      || (*buffer == '-' && previous_start == '*'))))
 		    printf ("%s", buffer);
 		  else if (*buffer == '*' || *buffer == '+')
 		    printf ("---%s", buffer + 3);
--- wdiff-0.5.93/src/mdiff.c.orig	2008-06-20 20:45:48.000000000 +0200
+++ wdiff-0.5.93/src/mdiff.c	2009-08-04 19:15:44.518348000 +0200
@@ -46,6 +46,8 @@
 #endif
 
 #include <ctype.h>
+#include <locale.h>
+#include <sys/wait.h>
 
 #if STDC_HEADERS
 # include <string.h>
@@ -313,7 +315,7 @@ static int rcs = 0;
 static int side_by_side = 0;
 
 /* Output at most NUM characters per line.  */
-static int width = 130;
+// static int width = 130;
 
 /* Output only the left column of common lines.  */
 static int left_column = 0;
@@ -346,7 +348,7 @@ static int new_file = 0;
 static int unidirectional_new_file = 0;
 
 /* Report when two files are the same.  */
-static int report_identical_files = 0;
+// static int report_identical_files = 0;
 
 /* Exclude files that match PAT.  */
 static const char *exclude = NULL;
@@ -1057,17 +1059,17 @@ study_input (struct input *input)
 {
 #if SAVE_AND_SLOW
 # define ADJUST_CHECKSUM(Character) \
-  checksum = (checksum << 5) + (checksum >> BITS_PER_WORD - 5) \
+  checksum = (checksum << 5) + (checksum >> (BITS_PER_WORD - 5)) \
     + (Character & 0xFF)
 #else
 # define ADJUST_CHECKSUM(Character) \
-  checksum = (checksum << 5) + (checksum >> BITS_PER_WORD - BITS_PER_TYPE - 5) \
+  checksum = (checksum << 5) + (checksum >> (BITS_PER_WORD - BITS_PER_TYPE - 5)) \
     + (Character & 0xFF)
 #endif
 
   int item_count;		/* number of items read */
-  char *buffer;			/* line buffer */
-  int length;			/* actual line length in buffer */
+  char *buffer = NULL;		/* line buffer */
+  int length = 0;		/* actual line length in buffer */
 
   /* Read the file and checksum all items.  */
 
@@ -1140,15 +1142,17 @@ study_input (struct input *input)
 	    if (isspace (*cursor))
 	      {
 		if (!ignore_all_space)
-		  if (ignore_space_change)
-		    {
-		      ADJUST_CHECKSUM (' ');
-		      while (cursor + 1 < buffer + length
-			     && isspace (cursor[1]))
-			cursor++;
-		    }
-		  else
-		    ADJUST_CHECKSUM (*cursor);
+		  {
+		    if (ignore_space_change)
+		      {
+			ADJUST_CHECKSUM (' ');
+			while (cursor + 1 < buffer + length
+			       && isspace (cursor[1]))
+			  cursor++;
+		      }
+		    else
+		      ADJUST_CHECKSUM (*cursor);
+		  }
 	      }
 	    else if (isalpha (*cursor))
 	      {
@@ -1329,7 +1333,7 @@ reference_string (int number)
 
   struct reference reference;
   static char buffer[RING_LENGTH][20];
-  static next = RING_LENGTH - 1;
+  static int next = RING_LENGTH - 1;
 
   if (next == RING_LENGTH - 1)
     next = 0;
@@ -1527,6 +1531,7 @@ dump_member (struct member *member)
 | Dump all members.  |
 `-------------------*/
 
+# if 0
 static void
 dump_all_members (void)
 {
@@ -1536,6 +1541,7 @@ dump_all_members (void)
   for (counter = 0; counter < members; counter++)
     dump_member (member_array + counter);
 }
+# endif
 
 #endif /* DEBUGGING */
 
@@ -1608,12 +1614,13 @@ new_member (int item)
 | Output a cluster explanation line.  |
 `------------------------------------*/
 
+# if 0
 static void
 explain_member (char prefix, struct member *quote)
 {
   struct cluster *cluster = cluster_array + quote->cluster_number;
   struct member *member;
-  int counter;
+  // int counter;
   struct reference reference;
 
   putc (prefix, output_file);
@@ -1628,6 +1635,7 @@ explain_member (char prefix, struct memb
     }
   putc ('\n', output_file);
 }
+# endif
 
 /*----------------------.
 | Search for clusters.  |
@@ -1654,7 +1662,7 @@ prepare_clusters (void)
      of INDIRECT_ITEM_ARRAY, between FIRST and LAST (included).  */
   int *sorter_array = NULL;	/* for ensuring members are in nice order */
   int sorters;			/* number of members in sorter_array */
-  int *sorter;			/* cursor into sorter_array */
+  // int *sorter;			/* cursor into sorter_array */
   int *cursor;			/* cursor into sorter_array */
 
   ITEM *item;			/* cursor in item_array */
@@ -1899,8 +1907,8 @@ prepare_indirects (void)
 {
   int counter;
   struct member *member;
-  struct input *input;
-  int duplicated_items;
+  // struct input *input;
+  // int duplicated_items;
 
 #if DEBUGGING
   if (debugging)
@@ -2011,7 +2019,7 @@ explain_group (char prefix, struct mergi
   struct cluster *cluster
     = cluster_array + member_array[merging->member_number].cluster_number;
   int counter;
-  struct input *input;
+  // struct input *input;
   struct member *member;
   struct merging *cursor;
   struct reference reference;
@@ -2067,7 +2075,7 @@ prepare_mergings (void)
   struct cluster *cluster;	/* current cluster candidate */
   int cost;			/* cost associate with current candidate */
   struct cluster *best_cluster;	/* best cluster candidate for hunk */
-  int best_cost;		/* cost associated with best cluster */
+  int best_cost = 0;		/* cost associated with best cluster */
   int group_flag;		/* set if next merging starts group */
 
   /* Remove member overlaps.  */
@@ -2216,12 +2224,14 @@ prepare_mergings (void)
 
 #if DEBUGGING
 	    if (debugging)
-	      if (best_cluster)
-		fprintf (stderr, "  {%d}=%d <-> {%d}=%d\n",
-			 best_cluster - cluster_array, best_cost,
-			 cluster - cluster_array, cost);
-	      else
-		fprintf (stderr, "  {%d}=%d\n", cluster - cluster_array, cost);
+	      {
+		if (best_cluster)
+		  fprintf (stderr, "  {%d}=%d <-> {%d}=%d\n",
+			   best_cluster - cluster_array, best_cost,
+			   cluster - cluster_array, cost);
+		else
+		  fprintf (stderr, "  {%d}=%d\n", cluster - cluster_array, cost);
+	      }
 #endif
 	    if (!best_cluster || cost < best_cost)
 	      {
@@ -2238,7 +2248,7 @@ prepare_mergings (void)
 #if DEBUGGING
       if (debugging)
 	{
-	  fprintf (stderr, "\nCHOICE\t", best_cluster);
+	  fprintf (stderr, "\nCHOICE\t");
 	  dump_cluster (best_cluster);
 	  putc ('\n', stderr);
 	}
@@ -2550,7 +2560,7 @@ output_characters (const char *string, i
   static unsigned column = 0;
 
   const char *cursor;
-  int counter;
+  // int counter;
 
   if (overstrike || expand)
     for (cursor = string; cursor < string + length; cursor++)
@@ -2676,7 +2686,7 @@ output_characters (const char *string, i
 	  break;
 	}
   else
-    fwrite (string, length, 1, output_file);
+    (void)fwrite (string, length, 1, output_file);
 }
 
 /*------------------------------------------------------------------------.
@@ -2873,11 +2883,14 @@ make_margin (struct input *input, enum m
   char buffer[15];
   char *cursor;
 
-  if (margin == EMPTY_MARGIN)
-    return;
+  // if (margin == EMPTY_MARGIN)
+  //   return;
 
   switch (margin)
     {
+    case EMPTY_MARGIN:
+      return;
+
     case LOCATION_IN_MARGIN:
       sprintf (buffer, "%s%d", input->nick_name,
 	       input->item - input->first_item + 1);
@@ -3129,13 +3142,13 @@ relist_annotated_files (void)
 
   enum margin_mode margin_mode = show_links ? LOCATION_IN_MARGIN : EMPTY_MARGIN;
 
-  struct input *input;
+  struct input *input = NULL;
   int *cursor;
   int counter;
-  FILE *file;
+  // FILE *file;
   ITEM *item;
   struct active *active;
-  struct member *member;
+  struct member *member = NULL;
   struct cluster *cluster;
   int ordinal;
   struct reference reference;
@@ -3472,8 +3485,8 @@ relist_merged_lines (int unified, int cr
   int counter;
   struct input *input;
   struct member *member;
-  struct cluster *chosen_cluster;
-  struct reference reference;
+  // struct cluster *chosen_cluster;
+  // struct reference reference;
   struct merging *merging;
   struct merging *group_limit;
   struct merging *cursor;
@@ -3583,8 +3596,8 @@ relist_merged_words (void)
   int counter;
   struct input *input;
   struct member *member;
-  struct cluster *chosen_cluster;
-  struct reference reference;
+  // struct cluster *chosen_cluster;
+  // struct reference reference;
   struct merging *merging;
   struct merging *group_limit;
   struct merging *cursor;
@@ -4076,7 +4089,7 @@ int
 main (int argc, char *const *argv)
 {
   int option_char;		/* option character */
-  struct input *input;		/* cursor in input array */
+  // struct input *input;		/* cursor in input array */
 
   int inhibit_left = 0;
   int inhibit_right = 0;
--- wdiff-0.5.93/src/wdiff2.c.orig	2008-06-20 22:34:36.000000000 +0200
+++ wdiff-0.5.93/src/wdiff2.c	2009-08-04 19:08:44.965479000 +0200
@@ -28,6 +28,8 @@
 #define EXIT_FAILURE 2		/* any other reason for exit */
 
 #include <getopt.h>
+#include <locale.h>		// LC_ALL
+#include <unistd.h>		// execvp
 
 const char *program_name;	/* name of executing program */
 
--- wdiff-0.5.93/src/readpipe.c.orig	2007-07-12 02:26:09.000000000 +0200
+++ wdiff-0.5.93/src/readpipe.c	2009-08-04 19:18:10.741062000 +0200
@@ -80,7 +80,8 @@ readpipe (va_alist)
 	  close (1);		/* We don't want the old stdout. */
 	  if (dup (fds[1]) == 0)/* Maybe stdin was closed. */
 	    {
-	      dup (fds[1]);	/* Guaranteed to dup to 1 (stdout). */
+	      if (1 != dup (fds[1]))	/* Guaranteed to dup to 1 (stdout). */
+	        _exit(3);
 	      close (0);
 	    }
 	  close (fds[1]);	/* No longer needed. */
--- wdiff-0.5.93/src/writepipe.c.orig	2007-07-12 02:26:09.000000000 +0200
+++ wdiff-0.5.93/src/writepipe.c	2009-08-04 19:17:56.878247000 +0200
@@ -78,7 +78,8 @@ writepipe (va_alist)
       if (fds[0] != 0)		/* Redirect 0 (stdin) only if needed.  */
 	{
 	  close (0);		/* We don't want the old stdin. */
-	  dup (fds[0]);		/* Guaranteed to dup to 0 (stdin). */
+	  if (0 != dup (fds[0]))		/* Guaranteed to dup to 0 (stdin). */
+	    _exit(4);
 	  close (fds[0]);	/* No longer needed. */
 	}
       execvp (args[0], args);
openSUSE Build Service is sponsored by