Package: svgalib
Version: 1:1.4.3-27
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu karmic ubuntu-patch

In Ubuntu, we've applied the attached patch to achieve the following:

  * 041_rename_round.patch: rename round() in utils/gtf/gtfcalc.c to fix 
    FTBFS due to conflict with the one defined in math.h (LP: #449747).

We thought you might be interested in doing the same. 

The build fails with the following error:

cc -Wall -Wstrict-prototypes -Wall -Wstrict-prototypes -fPIC 
-I/build/buildd/svgalib-1.4.3/include -I. -Wall -Wstrict-prototypes -fPIC 
-I/build/buildd/svgalib-1.4.3/include -I. -g -O2   -I../include 
-I/build/buildd/svgalib-1.4.3/src -L/build/buildd/svgalib-1.4.3/sharedlib -o 
gtfcalc -DTESTING_GTF gtf/gtfcalc.c -lvga -lm
gtf/gtfcalc.c:67: error: static declaration of 'round' follows non-static 
declaration
make[2]: *** [gtfcalc] Error 1

http://launchpadlibrarian.net/32346787/buildlog_ubuntu-karmic-i386.svgalib_1%3A1.4.3-27_FAILEDTOBUILD.txt.gz

-- System Information:
Debian Release: 5.0
  APT prefers jaunty-updates
  APT policy: (500, 'jaunty-updates'), (500, 'jaunty-security'), (500, 
'jaunty-proposed'), (500, 'jaunty-backports'), (500, 'jaunty')
Architecture: i386 (i686)

Kernel: Linux 2.6.28-15-generic (SMP w/2 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Ubuntu: https://bugs.launchpad.net/ubuntu/+source/svgalib/+bug/449747 
Description: rename round() in utils/gtf/gtfcalc.c to fix FTBFS due to 
 conflict with the one defined in math.h
Index: svgalib-1.4.3/utils/gtf/gtfcalc.c
===================================================================
--- svgalib-1.4.3.orig/utils/gtf/gtfcalc.c	2009-10-12 22:05:29.000000000 +0400
+++ svgalib-1.4.3/utils/gtf/gtfcalc.c	2009-10-12 22:06:00.000000000 +0400
@@ -64,7 +64,7 @@
 
 /*-------------------------- Implementation -------------------------------*/
 
-static double round(double v)
+static double round_local(double v)
 {
 	return floor(v + 0.5);
 }
@@ -84,9 +84,9 @@
 ****************************************************************************/
 {
 	c->margin = GC.margin;
-	c->cellGran = round(GC.cellGran);
-	c->minPorch = round(GC.minPorch);
-	c->vSyncRqd = round(GC.vSyncRqd);
+	c->cellGran = round_local(GC.cellGran);
+	c->minPorch = round_local(GC.minPorch);
+	c->vSyncRqd = round_local(GC.vSyncRqd);
 	c->hSync = GC.hSync;
 	c->minVSyncBP = GC.minVSyncBP;
 	if (GC.k == 0)
@@ -140,13 +140,13 @@
 	vFreq = hFreq = dotClock = freq;
 
 	/* Round pixels to character cell granularity */
-	hPixels = round(hPixels / c.cellGran) * c.cellGran;
+	hPixels = round_local(hPixels / c.cellGran) * c.cellGran;
 
 	/* For interlaced mode halve the vertical parameters, and double
 	 * the required field refresh rate.
 	 */
 	if (wantInterlace) {
-		vLines = round(vLines / 2);
+		vLines = round_local(vLines / 2);
 		vFieldRate = vFreq * 2;
 		dotClock = dotClock * 2;
 		interlace = 0.5;
@@ -158,8 +158,8 @@
 
 	/* Determine the lines for margins */
 	if (wantMargins) {
-		topMarginLines = round(c.margin / 100 * vLines);
-		botMarginLines = round(c.margin / 100 * vLines);
+		topMarginLines = round_local(c.margin / 100 * vLines);
+		botMarginLines = round_local(c.margin / 100 * vLines);
 		}
 	else {
 		topMarginLines = 0;
@@ -173,11 +173,11 @@
 				(vLines + (2*topMarginLines) + c.minPorch + interlace) * 1000000;
 
 			/* Find the number of lines in vSync + back porch */
-			vSyncBP = round(c.minVSyncBP / hPeriodEst);
+			vSyncBP = round_local(c.minVSyncBP / hPeriodEst);
 			}
 		else if (type == GTF_lockHF) {
 			/* Find the number of lines in vSync + back porch */
-			vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
+			vSyncBP = round_local((c.minVSyncBP * hFreq) / 1000);
 			}
 
 		/* Find the number of lines in the V back porch alone */
@@ -205,8 +205,8 @@
 
 	/* Find the number of pixels in the left and right margins */
 	if (wantMargins) {
-		leftMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
-		rightMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
+		leftMarginPixels = round_local(hPixels * c.margin) / (100 * c.cellGran);
+		rightMarginPixels = round_local(hPixels * c.margin) / (100 * c.cellGran);
 		}
 	else {
 		leftMarginPixels = 0;
@@ -235,17 +235,17 @@
 		}
 
 	/* Find the number of pixels in blanking time */
-	hBlankPixels = round((hTotalActivePixels * idealDutyCycle) /
+	hBlankPixels = round_local((hTotalActivePixels * idealDutyCycle) /
 		((100 - idealDutyCycle) * 2 * c.cellGran)) * (2 * c.cellGran);
 
 	/* Find the total number of pixels */
 	hTotalPixels = hTotalActivePixels + hBlankPixels;
 
 	/* Find the horizontal back porch */
-	hBackPorch = round((hBlankPixels / 2) / c.cellGran) * c.cellGran;
+	hBackPorch = round_local((hBlankPixels / 2) / c.cellGran) * c.cellGran;
 
 	/* Find the horizontal sync width */
-	hSyncWidth = round(((c.hSync/100) * hTotalPixels) / c.cellGran) * c.cellGran;
+	hSyncWidth = round_local(((c.hSync/100) * hTotalPixels) / c.cellGran) * c.cellGran;
 
 	/* Find the horizontal sync + back porch */
 	hSyncBP = hBackPorch + hSyncWidth;
@@ -258,7 +258,7 @@
 		hPeriod = 1000 / hFreq;
 
 		/* Find the number of lines in vSync + back porch */
-		vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
+		vSyncBP = round_local((c.minVSyncBP * hFreq) / 1000);
 
 		/* Find the number of lines in the V back porch alone */
 		vBackPorch = vSyncBP - c.vSyncRqd;

Reply via email to