Bug 117377

Summary: 2 * used before set + 1 nested function
Product: [Fedora] Fedora Reporter: d.binderman
Component: netpbmAssignee: Phil Knirsch <pknirsch>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-07-02 16:23:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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