Bug 132848 - mgdiff-1.0-1071 : local variable used before set
Summary: mgdiff-1.0-1071 : local variable used before set
Status: RESOLVED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Final
Hardware: All SuSE Linux 10.0
: P5 - None : Minor
Target Milestone: ---
Assignee: Dr. Werner Fink
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-08 23:25 UTC by David Binderman
Modified: 2005-11-10 11:22 UTC (History)
0 users

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2005-11-08 23:25:57 UTC
I just tried to compile package mgdiff-1.0-1071 with the Intel C
compiler.

It said

mgdiff.c(1888): warning #592: variable "newcbs" is used before its value is set

The source code is

	if (newcbs.value > (maximum - slidersize)) {

I agree with the compiler. Suggest code rework.

BTW, the email address [ dan@sass.com ] of the author of this package
appears to be broken.
Comment 1 Dr. Werner Fink 2005-11-09 17:49:38 UTC
FIXED
Comment 2 David Binderman 2005-11-09 18:03:36 UTC
(In reply to comment #1)
> FIXED

Excellent news.

Would you be willing to give us a clue 
about which version has this fix ?

Comment 3 Dr. Werner Fink 2005-11-09 18:10:00 UTC
Next SuSE LINUX 10.1 or openSuSE
Comment 4 David Binderman 2005-11-09 20:23:00 UTC
(In reply to comment #3)
> Next SuSE LINUX 10.1 or openSuSE

No surprises there then ;->

Which version *of the mgdiff package* has this fix, please ?

Is there a new and working email address for the author ?

Comment 5 Dr. Werner Fink 2005-11-10 11:22:27 UTC
AFAIK there is no working email address for Dan Williams.
I've added a patch from the debians people.  The changes
are done by Erik de Castro Lopo <erikd@mega-nerd.com>.

The patch its self is simple:

@@ -1921,19 +1928,20 @@
 
            value = (b->sline >= lines_of_context) ? (b->sline - lines_of_context) : b->sline;
            XtVaGetValues (sb, XmNmaximum, &maximum, XmNsliderSize, &slidersize, NULL);
-           if (value > (maximum - slidersize))
-               value = maximum - slidersize;
 
            if ((w == sbl) || (w == sbr)) {
                int side = (w == sbl) ? LEFT : RIGHT;
 
-               if (newcbs.value > (maximum - slidersize)) {
-                   newcbs.value = maximum - slidersize;
-                   XtVaSetValues (w, XmNvalue, newcbs.value - b->sline + b->arr[side].fline, NULL);
+               if (value > (maximum - slidersize)) {
+                   value = maximum - slidersize;
+                   XtVaSetValues (w, XmNvalue, value - b->sline + b->arr[side].fline, NULL);
                    return;
                }
            }
 
+           if (value > (maximum - slidersize))
+               value = maximum - slidersize;
+
            newcbs.reason = XmCR_VALUE_CHANGED;
            newcbs.event = NULL;
            newcbs.value = value;