Bug 117377 - 2 * used before set + 1 nested function
Summary: 2 * used before set + 1 nested function
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: netpbm
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Phil Knirsch
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-03-03 13:26 UTC by d.binderman
Modified: 2015-03-05 01:13 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-07-02 16:23:03 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description d.binderman 2004-03-03 13:26:56 UTC
Description of problem:

I just tried to compile Core2 Test1 package netpbm-10.19-2

The compiler complained of the use of nested functions. Here is
a patch to shut up the compiler and to make the code more
ISO C standard conformant.


--- converter/ppm/ppmtoilbm.c.orig	2004-03-03 11:00:21.547452512 +0000
+++ converter/ppm/ppmtoilbm.c	2004-03-03 11:00:43.101175848 +0000
@@ -2400,16 +2400,6 @@
 
 /************ compression ************/
 
-
-/* runbyte1 algorithm by Robert A. Knop (rknop.edu) */
-static int
-runbyte1(size)
-   int size;
-{
-    int in,out,count,hold;
-    register unsigned char *inbuf = coded_rowbuf;
-    register unsigned char *outbuf = compr_rowbuf;
-
 static void *
 xmalloc2(x,y)
     int x;
@@ -2426,6 +2416,16 @@
 }
 
 
+/* runbyte1 algorithm by Robert A. Knop (rknop.edu) */
+static int
+runbyte1(size)
+   int size;
+{
+    int in,out,count,hold;
+    register unsigned char *inbuf = coded_rowbuf;
+    register unsigned char *outbuf = compr_rowbuf;
+
+
     in=out=0;
     while( in<size ) {
         if( (in<size-1) && (inbuf[in]==inbuf[in+1]) ) {    

The compiler also said

1.

pbmtomda.c(179): remark #592: variable "nOutRows" is used before its
value is set

The source code is

    overflow_add(nOutRows, 3);

Suggest init local variable nOutRows before first use.

2.

winicontoppm.c(407): remark #592: variable "bitmap" is used before its
value is set

The source code is

    u1 * bitmap;
    /* remember - bmp (dib) stored upside down, so reverse */
    u1 * bitcurptr = bitmap + (bytes * width * (height-1) ) * (sizeof
(u1));

Suggest init local variable bitmap before first use.



Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Phil Knirsch 2004-07-02 16:23:03 UTC
All fixed in netpbm-10.22-2 and later.

Read ya, Phil


Note You need to log in before you can comment on or make changes to this bug.