Subject: pkg/24515: libgphoto2 is broken with gcc2.95
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mlelstv@serpens.de>
List: netbsd-bugs
Date: 02/21/2004 22:47:29
>Number: 24515
>Category: pkg
>Synopsis: libgphoto2 breaks with gcc2.95
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Feb 21 21:48:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Michael van Elst
>Release: NetBSD 1.6.2_RC4
>Organization:
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."
>Environment:
System: NetBSD pepew 1.6.2_RC4 NetBSD 1.6.2_RC4 (PEPEW) #2: Sat Jan 17 11:06:04 MET 2004 src@pepew:/amd/fud/d/0/src/sys/arch/i386/compile/PEPEW i386
Architecture: i386
Machine: i386
>Description:
Building libgphoto2-2.1.4 breaks with the system C compiler. The build
aborts with syntax errors in camlib/aox/library.c:225.
The particular line contains a declaration of the variable header_len.
Mixing of declarations and code is not allowed in ISO C.
gcc3 allows such constructs, even with -pedantic it produces only
a warning.
There are more occurences of the same problem in camlib/aox/aox.c.
>How-To-Repeat:
Build devel/libgphoto2 on a stock NetBSD1.6.2 system and don't use gcc3.
>Fix:
--- camlibs/aox/library.c.dist Sat Feb 21 22:34:35 2004
+++ camlibs/aox/library.c Sat Feb 21 22:34:45 2004
@@ -202,6 +202,7 @@
gp_file_adjust_name_for_mime_type (file);
}
if ((w == 640)){
+ int header_len;
/* Stripping useless header */
p_data = data + 0x98;
/* Picture is mirror-imaged.*/
@@ -222,7 +223,7 @@
GP_DEBUG("size of data = %i\n", sizeof(data));
GP_DEBUG("size of p_data = %i\n", sizeof(p_data));
/* And now create a ppm file, with our own header */
- int header_len = snprintf(header, 127,
+ header_len = snprintf(header, 127,
"P6\n"
"# CREATOR: gphoto2, aox library\n"
"%d %d\n"
--- camlibs/aox/aox.c.dist Sat Feb 21 22:35:45 2004
+++ camlibs/aox/aox.c Sat Feb 21 22:36:27 2004
@@ -39,10 +39,10 @@
int aox_init (GPPort *port, Model *model, Info *info)
{
unsigned char c[4];
- memset(c,0,sizeof(c));
unsigned char hi[2];
- memset (hi,0,2);
unsigned char lo[2];
+ memset(c,0,sizeof(c));
+ memset (hi,0,2);
memset (lo,0,2);
GP_DEBUG("Running aox_init\n");
@@ -86,11 +86,12 @@
int aox_get_picture_size (GPPort *port, int lo, int hi, int n, int k)
{
+ unsigned char c[4];
+ unsigned int size;
+
GP_DEBUG("Running aox_get_picture_size\n");
- unsigned char c[4];
memset (c,0,4);
- unsigned int size;
if ( ( (lo) && ( n ==k ) && (k ==0)) ) {
READ(port, 0x04, 0x1, 0x1, c, 2);
>Release-Note:
>Audit-Trail:
>Unformatted: