Bug 101032

Summary: bad source code
Product: [Retired] Red Hat Linux Reporter: d.binderman
Component: Glide3Assignee: Alan Cox <alan>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: mharris
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-10-15 16:16:45 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 2003-07-28 18:46:27 UTC
Description of problem:


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


How reproducible:


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


Expected results:


Additional info:

Comment 1 d.binderman 2003-07-28 18:48:04 UTC
Hello there,

I have just tried to compile package Glide4-20010520-25 from Redhat 9.0
with compiler flag -Wall.

The compiler said

../../../../swlibs/texus2/lib/nccnnet.c:414: warning: conversion lacks type at
end of format
../../../../swlibs/texus2/lib/nccnnet.c:414: warning: conversion lacks type at
end of format
../../../../swlibs/texus2/lib/nccnnet.c:414: warning: unknown conversion type
character `)' in format
../../../../swlibs/texus2/lib/nccnnet.c:414: warning: conversion lacks type at
end of format
../../../../swlibs/texus2/lib/nccnnet.c:414: warning: conversion lacks type at
end of format
../../../../swlibs/texus2/lib/nccnnet.c:414: warning: unknown conversion type
character `)' in format
../../../../swlibs/texus2/lib/nccnnet.c:414: warning: too many arguments for format
The source code is

        printf("eMax=(%3l%3l%3l)...eAvg=(%3l%3l%3l)\n",
               errG, errR, errB,
               totG/ncolors, totR/ncolors, totB/ncolors
               );

In fact, %l is only a modifier, not a specifier. You might be
better off with something like

        printf("eMax=(%3ld%3ld%3ld)...eAvg=(%3ld%3ld%3ld)\n",
               errG, errR, errB,
               totG/ncolors, totR/ncolors, totB/ncolors
               );

The compiler also said

../../../../h5/glide3/src/g3df.c:479: warning: operation on `tempStr' may be
undefined

The source code is
    while(*tempStr != '\0') *tempStr++ = toupper(*tempStr);

You most certainly will be better off with source code like

    while(*tempStr != '\0')
    {
        *tempStr = toupper(*tempStr);
        ++tempStr;
    }

to avoid undefined behaviour.


Comment 2 Mike A. Harris 2004-06-24 00:12:43 UTC
If you could please submit your patch to the upstream Glide3 project
directly on sourceforge, or email it to Daniel Borca the project
maintainer, he'll likely include it in future Glide3 releases, and
it will trickle into future Red Hat OS distributions as well.

Closing bug as UPSTREAM

Comment 3 Alan Cox 2004-10-15 16:16:45 UTC
Except he forgot to mark it so