Bug 101037 - compiler warnings in gthumb
Summary: compiler warnings in gthumb
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gthumb
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Christopher Aillon
QA Contact:
URL:
Whiteboard:
: 110809 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-07-28 18:59 UTC by d.binderman
Modified: 2007-04-18 16:56 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-08-24 21:02:42 UTC
Embargoed:


Attachments (Terms of Use)

Description d.binderman 2003-07-28 18:59:23 UTC
Description of problem:
Hello there,

I have just tried to compile package gthumb-2.0.1-1 from Redhat 9.0
with compiler flag -Wall.

The compiler said

preferences.c:351: warning: operation on `i' may be undefined
preferences.c:352: warning: operation on `i' may be undefined
preferences.c:353: warning: operation on `i' may be undefined
preferences.c:397: warning: operation on `i' may be undefined
preferences.c:398: warning: operation on `i' may be undefined
preferences.c:399: warning: operation on `i' may be undefined

The source code is

        *r = dec (hex[i++]) * 16 + dec (hex[i++]);
        *g = dec (hex[i++]) * 16 + dec (hex[i++]);
        *b = dec (hex[i++]) * 16 + dec (hex[i++]);
It is a basic fact of the C language that this kind of increment
produces undefined code. Much better to write it something like

        *r = dec (hex[i]) * 16 + dec (hex[i + 1]);
        i += 2;
        *g = dec (hex[i]) * 16 + dec (hex[i + 1]);
        i += 2;
        *b = dec (hex[i]) * 16 + dec (hex[i + 1]);
        i += 2;


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


How reproducible:


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


Expected results:


Additional info:

Comment 1 Christopher Aillon 2004-08-26 05:50:41 UTC
*** Bug 110809 has been marked as a duplicate of this bug. ***


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