File gdchart0.11.5dev_compilefixes.patch of Package gdchart

Index: ft_samp.c
===================================================================
--- ft_samp.c.orig
+++ ft_samp.c
@@ -6,14 +6,20 @@
 /*       will default to builtin font, if specified TTF not found */
 
 #include <stdio.h>
- 
+#include <stdlib.h>
+
 #include "gdc.h"
 #include "gdchart.h"
 
 #define NUM_SETS	1
 #define NUM_POINTS	4
 
-main()
+void get_data( float data[NUM_SETS][NUM_POINTS],
+          int	low,
+          int	high );
+void get_individual_colors( unsigned long extclr[NUM_SETS][NUM_POINTS] );
+
+int main()
 {
     float           data  [ NUM_SETS ][ NUM_POINTS ];
     unsigned long   extclr[ NUM_SETS ][ NUM_POINTS ];
@@ -65,7 +71,7 @@
 /* --------------------------------------------------------- */
 #include <stdlib.h>     /* for rand() */
 #include <time.h>       /* for seed   */
-get_data( float data[NUM_SETS][NUM_POINTS],
+void get_data( float data[NUM_SETS][NUM_POINTS],
           int	low,
           int	high )
 {
@@ -78,7 +84,7 @@
 }
 
 /* -------- also random colors ----------------------------- */
-get_individual_colors( unsigned long extclr[NUM_SETS][NUM_POINTS] )
+void get_individual_colors( unsigned long extclr[NUM_SETS][NUM_POINTS] )
 {
     int i, j;
     for( i=0; i<NUM_SETS; ++i )
Index: gdc.c
===================================================================
--- gdc.c.orig
+++ gdc.c
@@ -4,6 +4,7 @@
 #define GDC_INCL
 #define GDC_LIB
 #include <math.h>
+#include <string.h>
 #include "gdc.h"
 
 struct	GDC_FONT_T	GDC_fontc[GDC_numfonts] = { (gdFontPtr)NULL, 8,  5,
Index: gdc_pie_samp.c
===================================================================
--- gdc_pie_samp.c.orig
+++ gdc_pie_samp.c
@@ -5,12 +5,13 @@
 /*  vi: :set tabstop=4 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <math.h>
 
 #include "gdc.h"
 #include "gdcpie.h"
 
-main( int argc, char *argv[] )
+int main( int argc, char *argv[] )
 {
 	/* labels */
 	char		*lbl[] = { "CPQ\n(DEC)",
Index: gdc_samp1.c
===================================================================
--- gdc_samp1.c.orig
+++ gdc_samp1.c
@@ -10,11 +10,12 @@
 /* for CGI use un-comment the "Content-Type" line */
 
 #include <stdio.h>
- 
+#include <stdlib.h>
+
 #include "gdc.h"
 #include "gdchart.h"
  
-main()
+int main()
 {
     /* ----- set some data ----- */
 /*    float   a[6]  = { 0.5, 0.09, 0.6, 0.85, 0.0, 0.90 }, */
Index: gdc_samp2.c
===================================================================
--- gdc_samp2.c.orig
+++ gdc_samp2.c
@@ -14,12 +14,14 @@
 */
 
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
 
 #include "gdc.h"
 #include "gdchart.h"
 
 
-main()
+int main()
 {
 	/* set some sample data points */
 	float	h[12]  = {	17.8,  17.1,  17.3,  GDC_NOVALUE,  17.2,  17.1,
@@ -36,7 +38,7 @@
 	char	*t[12] = {	"May", "Jun", "Jul",  "Aug",       "Sep",  "Oct",
 						"Nov", "Dec", "Jan", "Feb",        "Mar",  "Apr" };
 
-	/* set color RGB as ulong array */
+/* set color RGB as ulong array */
 /*	unsigned long	setcolor[3]    = { 0xC0C0FF, 0xFF4040, 0xFFFFFF }; */
 
 	GDC_ANNOTATION_T	anno;
@@ -64,13 +66,13 @@
 	GDC_VolColor = 0x4040FFL;								/* aka combo */
 	GDC_3d_depth  = 4.0;									/* % entire image */
 
-/*	GDC_SetColor  = setcolor;								/* see README */ 
+/*	GDC_SetColor  = setcolor;								/ * see README */
 	GDC_PlotColor = 0xFFFFFF;
 	GDC_grid = FALSE;
 
 /*	GDC_xtitle="fy.1998"; */
 
-/*	fprintf( stdout, "Content-Type: image/png\n\n" );		/* rem: for web use */
+/*	fprintf( stdout, "Content-Type: image/png\n\n" );		/ * rem: for web use */
 															/* finally: make the call */
 	out_graph( 200, 175,									/* overall width, height */
 			   outpng1,										/* open FILE pointer */
Index: gdchart.c
===================================================================
--- gdchart.c.orig
+++ gdchart.c
@@ -36,6 +36,7 @@
 								gdp[1].x  = x1+(xoff), gdp[1].y = y1-yoff,	\
 								gdp[2].x  = x2+(xoff), gdp[2].y = y2-yoff,	\
 								gdp[3].x  = x2,        gdp[3].y = y2
+long get_uniq_color( gdImagePtr im );
 /* ------------------------------------------------------------------------- */
 /* vals in pixels */
 /* ref is front plane */
@@ -391,6 +392,8 @@
 	float		lowest   = FLT_MAX;
 	gdPoint     volpoly[4];
 
+	vyorig = 0.0;
+
 	char		do_vol = ( type == GDC_COMBO_HLC_BAR   ||		/* aka: combo */
 						   type == GDC_COMBO_HLC_AREA  ||
 						   type == GDC_COMBO_LINE_BAR  ||
@@ -453,8 +456,7 @@
 	CREATE_ARRAY2( ExtColor,    int, num_sets, num_points );	/*		ExtColor[num_sets][num_points],    */
 	CREATE_ARRAY2( ExtColorShd, int, threeD?num_sets:1,			/*		ExtColorShd[num_sets][num_points]; */
 									 threeD?num_points:1 );		/* shade colors only with 3D */
-	float		*uvol;
-
+	float		*uvol = NULL;
 	int			BGColor,
 				LineColor,
 				PlotColor,
@@ -463,9 +465,11 @@
 				ThumbDColor,
 				ThumbLblColor,
 				ThumbUColor,
+				AnnoteColor;
+
+				VolColor = AnnoteColor = 0;
 /*				ArrowDColor, */
 /*				ArrowUColor, */
-				AnnoteColor;
 #ifdef HAVE_LIBFREETYPE
 	char		*gdc_title_font	      = GDC_title_font;			/* for convienience  */
 	char		*gdc_ytitle_font      = GDC_ytitle_font;		/* in func calls */
@@ -530,6 +534,7 @@
 	for( i=0; i<num_sets; ++i )
 		uvals[i] = data+i*num_points;
 	if( do_vol )
+	{
 		if( !combo_data )
 			{
 			out_err( IMGWIDTH, IMGHEIGHT, img_fptr, GDC_BGColor, GDC_LineColor, "No Combo Data Available" );
@@ -540,8 +545,10 @@
 			return -2;
 			}
 		else
+			{
 			uvol = combo_data;
-
+			}
+	}
 	/* ----- calculate interpretations first ----- */
 	if( GDC_interpolations )
 		{
@@ -580,10 +587,16 @@
 					pos_set_sum = 0.0;
 			for( i=0; i<num_sets; ++i )
 				if( uvals[i][j] != GDC_NOVALUE )
+					{
 					if( uvals[i][j] < 0.0 )
+						{
 						neg_set_sum += uvals[i][j];
+						}
 					else
+						{
 						pos_set_sum += uvals[i][j];
+						}
+					}
 			lowest  = MIN( lowest,  MIN(neg_set_sum,pos_set_sum) );
 			highest = MAX( highest, MAX(neg_set_sum,pos_set_sum) );
 			}
@@ -623,11 +636,17 @@
 			type == GDC_3DCOMBO_LINE_AREA ||
 			type == GDC_3DCOMBO_HLC_BAR   ||
 			type == GDC_3DCOMBO_HLC_AREA )
-		if( vhighest < 0.0 )
-			vhighest = 0.0;
-		else
-		if( vlowest > 0.0 )
-			vlowest = 0.0;						/* bar, area should always start at 0 */
+			{
+				if( vhighest < 0.0 )
+					{
+					vhighest = 0.0;
+					}
+				else
+					{
+					if( vlowest > 0.0 )
+						vlowest = 0.0;						/* bar, area should always start at 0 */
+					}
+			}
 		}
 
 	if( lowest == FLT_MAX )
@@ -638,11 +657,17 @@
 		type == GDC_BAR   ||
 		type == GDC_3DBAR ||
 		type == GDC_3DAREA )
+		{
 		if( highest < 0.0 )
+			{
 			highest = 0.0;
+			}
 		else
-		if( lowest > 0.0 )						/* negs should be drawn from 0 */
-			lowest = 0.0;
+			{
+			if( lowest > 0.0 )						/* negs should be drawn from 0 */
+				lowest = 0.0;
+			}
+		}
 
 	if( GDC_requested_ymin != GDC_NOVALUE && GDC_requested_ymin < lowest )
 		lowest = GDC_requested_ymin;
@@ -900,7 +925,7 @@
 				+ ydepth_3Dtotal
 				+ title_hgt
 				+ annote_hgt;
-/*????	if( GDC_hard_size && GDC_hard_yorig )					/* vyorig too? */
+/*????	if( GDC_hard_size && GDC_hard_yorig )					/ * vyorig too? */
 /*????		yorig = GDC_hard_yorig;	FRED - check email */
 	GDC_hard_yorig = yorig;
 
@@ -948,7 +973,7 @@
 			{
 			/* assume GIF */
 			/* should determine type by file extension, option, ... */
-			if( bg_img = gdImageCreateFromGif(in) )					/* = */
+			if( (bg_img = gdImageCreateFromGif(in)) )					/* = */
 				{
 				int	bgxpos = gdImageSX(bg_img)<IMGWIDTH?  IMGWIDTH/2 - gdImageSX(bg_img)/2:  0,
 					bgypos = gdImageSY(bg_img)<IMGHEIGHT? IMGHEIGHT/2 - gdImageSY(bg_img)/2: 0;
@@ -1071,16 +1096,16 @@
 		/* if lowest < 0 < highest                                                  */
 		for( i=-1; i<=1; i+=2 )									/* -1, 1 */
 			{
-			if( i == -1 )	if( lowest >= 0.0 )					/*	all pos plotting */
-								continue;
-							else
-								tmp_y = MIN( 0, highest );		/*	step down to lowest */
-
-			if( i == 1 )	if( highest <= 0.0 )				/*	all neg plotting */
-								continue;
-							else
-								tmp_y = MAX( 0, lowest );		/*	step up to highest */
-
+			if( i == -1 )	{	if( lowest >= 0.0 )					/*	all pos plotting */
+							continue;
+						else
+							tmp_y = MIN( 0, highest );		/*	step down to lowest */
+					}
+			if( i == 1 )	{	if( highest <= 0.0 )				/*	all neg plotting */
+							continue;
+						else
+							tmp_y = MAX( 0, lowest );		/*	step up to highest */
+					}
 
 /*			if( !(highest > 0 && lowest < 0) )					// doesn't straddle 0 */
 /*				{ */
@@ -1124,6 +1149,7 @@
 						}
 					}
 				if( GDC_yaxis )
+					{
 					if( do_ylbl_fractions )
 						{
 						if( w || (!w && !n && !d) )
@@ -1166,13 +1192,15 @@
 							}
 						}
 					else
+						{
 						gdImageString( im,
 									   GDC_fontc[GDC_yaxisfont_size].f,
 									   PX(0)-2-strlen(ylbl_str)*GDC_fontc[GDC_yaxisfont_size].w,
 									   PY(tmp_y)-GDC_fontc[GDC_yaxisfont_size].h/2,
 									   (unsigned char*)ylbl_str,
 									   labelcolor );
-
+						}
+					}
 
 				if( do_vol && GDC_yaxis2 )
 					{
@@ -1303,7 +1331,9 @@
 			setno = 0;												/* reset to foremost */
 
 			if( i == 0 )											/* catch 3D Y back corner */
+				{
 				DO_GRID(x1,y1,x2,y2);
+				}
 
 			/* labeled points */
 			if( (!GDC_xlabel_ctl && ( (i%(1+num_points/num_xlbls) == 0) ||	/* # x labels are regulated */
@@ -1341,29 +1371,35 @@
 											  NULL );
 							}
 						else
-						if( gdc_xaxis_rad == 0.0 )
-							GDCImageStringNL( im,
-											  &GDC_fontc[GDC_xaxisfont_size],
-											  gdc_xaxis_font, gdc_xaxis_ptsize,
-											  0.0,
-											  PX(i)-1 - (lftsz.w/2),
-											  PY(lowest) + 2 + 1,
-											  xlbl[xi],
-											  labelcolor,
-											  GDC_JUSTIFY_CENTER,
-											  NULL );
-						else
-							GDCImageStringNL( im,
-											  &GDC_fontc[GDC_xaxisfont_size],
-											  gdc_xaxis_font, gdc_xaxis_ptsize,
-											  gdc_xaxis_rad,
-											  PX(i)-1 - (int)((double)lftsz.w*cos_xangle
-													        + (double)lftsz.h*gdc_xaxis_rad/(M_PI/2.0)/2.0),
-											  PY(lowest) + 2 + 1 + (int)((double)lftsz.w*sin_xangle),
-											  xlbl[xi],
-											  labelcolor,
-											  GDC_JUSTIFY_RIGHT,
-											  NULL );
+							{
+							if( gdc_xaxis_rad == 0.0 )
+								{
+								GDCImageStringNL( im,
+												  &GDC_fontc[GDC_xaxisfont_size],
+												  gdc_xaxis_font, gdc_xaxis_ptsize,
+												  0.0,
+												  PX(i)-1 - (lftsz.w/2),
+												  PY(lowest) + 2 + 1,
+												  xlbl[xi],
+												  labelcolor,
+												  GDC_JUSTIFY_CENTER,
+												  NULL );
+								}
+							else
+								{
+								GDCImageStringNL( im,
+												  &GDC_fontc[GDC_xaxisfont_size],
+												  gdc_xaxis_font, gdc_xaxis_ptsize,
+												  gdc_xaxis_rad,
+												  PX(i)-1 - (int)((double)lftsz.w*cos_xangle
+																+ (double)lftsz.h*gdc_xaxis_rad/(M_PI/2.0)/2.0),
+												  PY(lowest) + 2 + 1 + (int)((double)lftsz.w*sin_xangle),
+												  xlbl[xi],
+												  labelcolor,
+												  GDC_JUSTIFY_RIGHT,
+												  NULL );
+								}
+							}
 						}
 				}
 			/* every point, on-point */
@@ -1975,11 +2011,15 @@
 							fo       = 0;
 
 					if( !do_bar )
+						{
 						if( (GDC_scatter+i)->point == 0 )
 							{ s = 270; e = 270+180; fo = 1; }
 						else
-						if( (GDC_scatter+i)->point == num_points-1 )
-							{ s = 90; e = 90+180; fo = -1; }
+							{
+							if( (GDC_scatter+i)->point == num_points-1 )
+								{ s = 90; e = 90+180; fo = -1; }
+							}
+						}
 					if( uniq_clr != -1L )							/* the safe way */
 						{
 						int	uc = gdImageColorAllocate( im, l2gdcal(uniq_clr) );
@@ -2025,11 +2065,17 @@
 					ct[2].x = scat_x + hlf_scatterwdth;
 					ct[2].y = scat_y + hlf_scatterwdth;
 					if( !do_bar )
+						{
 						if( (GDC_scatter+i)->point == 0 )
+							{
 							ct[1].x = scat_x;
+							}
 						else
-						if( (GDC_scatter+i)->point == num_points-1 )
-							ct[2].x = scat_x;
+							{
+							if( (GDC_scatter+i)->point == num_points-1 )
+								ct[2].x = scat_x;
+							}
+						}
 					gdImageFilledPolygon( im, ct, 3, scatter_clr[i] );
 					break;
 				case GDC_SCATTER_TRIANGLE_DOWN:
@@ -2040,11 +2086,17 @@
 					ct[2].x = scat_x + hlf_scatterwdth;
 					ct[2].y = scat_y - hlf_scatterwdth;
 					if( !do_bar )
+						{
 						if( (GDC_scatter+i)->point == 0 )
+							{
 							ct[1].x = scat_x;
+							}
 						else
-						if( (GDC_scatter+i)->point == num_points-1 )
-							ct[2].x = scat_x;
+							{
+							if( (GDC_scatter+i)->point == num_points-1 )
+								ct[2].x = scat_x;
+							}
+						}
 					gdImageFilledPolygon( im, ct, 3, scatter_clr[i] );
 					break;
 				}
Index: gdc_pie.c
===================================================================
--- gdc_pie.c.orig
+++ gdc_pie.c
@@ -17,6 +17,7 @@
 #include "gdc.h"	/* gdc.h before system includes to pick up features */
 
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "gdcpie.h"
 
@@ -76,7 +77,7 @@
  * order by angle opposite (180) of depth angle
  * comparing across 0-360 line
 \* ------------------------------------------------------- */
-static int
+int
 ocmpr( struct tmp_slice_t *a,
 	   struct tmp_slice_t *b )
 {
@@ -87,11 +88,11 @@
 
 	/* a tie (will happen between each slice) */
 	/* are we within pie_3D_rad */
-	if( (a->angle < pie_3D_rad) && (pie_3D_rad < a->slice) ||
-		(a->slice < pie_3D_rad) && (pie_3D_rad < a->angle) )
+	if( ((a->angle < pie_3D_rad) && (pie_3D_rad < a->slice)) ||
+		((a->slice < pie_3D_rad) && (pie_3D_rad < a->angle)) )
 		return 1;
-	if( (b->slice < pie_3D_rad) && (pie_3D_rad < b->angle) ||
-		(b->angle < pie_3D_rad) && (pie_3D_rad < b->slice) )
+	if( ((b->slice < pie_3D_rad) && (pie_3D_rad < b->angle)) ||
+		((b->angle < pie_3D_rad) && (pie_3D_rad < b->slice)) )
 		return -1;
 
 	/* let slice angle decide */
@@ -128,6 +129,7 @@
 				PlotColor,
 				EdgeColor,
 				EdgeColorShd;
+	EdgeColorShd = 0;
 	CREATE_ARRAY1( SliceColor, int, num_points );		/* int SliceColor[num_points] */
 	CREATE_ARRAY1( SliceColorShd, int, num_points );	/* int SliceColorShd[num_points] */
 
@@ -594,7 +596,7 @@
 				int		lblx,  pctx,
 						lbly,  pcty,
 						linex, liney;
-
+				pcty = 0;
 				lbly = (liney = IY(i,0,0))-lbl_ftsz[i].h / 2;
 				lblx = pctx = linex = IX(i,0,0);
 
Index: gdc.h
===================================================================
--- gdc.h.orig
+++ gdc.h
@@ -155,4 +155,5 @@
 				 unsigned long	LineColor,
 				 char			*str );
 
+
 #endif /*!_GDC_H*/
openSUSE Build Service is sponsored by