Bug 101032 - bad source code
Summary: bad source code
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: Glide3
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Alan Cox
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-07-28 18:46 UTC by d.binderman
Modified: 2007-04-18 16:56 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-15 16:16:45 UTC
Embargoed:


Attachments (Terms of Use)

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


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