Bug 117377 - 2 * used before set + 1 nested function
2 * used before set + 1 nested function
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: netpbm (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-03-03 08:26 EST by d.binderman
Modified: 2015-03-04 20:13 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-07-02 12:23:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2004-03-03 08:26:56 EST
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@mop.caltech.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@mop.caltech.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 12:23:03 EDT
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.