[AC21.4] Fix potential progress gauge problems

Vin Shelton acs at alumni.princeton.edu
Thu Aug 23 16:52:34 EDT 2007


APPROVE COMMIT 21.4

Thanks for the patch, Stephen.

It has been committed to the 21.4 branch and will appear
in the 21.4.21 release.

  - Vin

On 5/20/07, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> APPROVE COMMIT 21.5 RECOMMEND 21.4
>
> I decided to see if I could do something about the perennial progress
> bar crash.  I'm unable to reproduce at the moment and haven't found a
> report that localizes it very well, but based on one report that has a
> backtrace with XFillRectangle crashing, I'm guessing that it has to do
> with the function GaugeMercury (which won't appear in most backtraces
> because it's static).
>
> The attached patch fixes a genuine bug, which has some chance of being
> related to the crash.  All of the callers of GaugeMercury pass it ints
> in the val0 and val1 arguments, but they are declared Cardinal, which
> is X-ese for "unsigned".  Having done a bunch of fontlocking with it,
> as least I can say it doesn't cause a new crach for me.  However, I
> can't say for sure it will help.
>
> And as usual there's a gratuitous (but related) doc change.  I never
> saw a docstring that didn't need fussing with. :-)
>
> Index: lisp/ChangeLog
> ===================================================================
> RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
> retrieving revision 1.795
> diff -u -r1.795 ChangeLog
> --- lisp/ChangeLog      12 May 2007 13:12:26 -0000      1.795
> +++ lisp/ChangeLog      20 May 2007 14:32:02 -0000
> @@ -0,0 +1,4 @@
> +2007-05-20  Stephen J. Turnbull  <stephen at xemacs.org>
> +
> +       * gutter-items.el (progress-feedback-with-label): Clarify docstring.
> +
> Index: lwlib/ChangeLog
> ===================================================================
> RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/ChangeLog,v
> retrieving revision 1.91
> diff -u -r1.91 ChangeLog
> --- lwlib/ChangeLog     17 May 2007 15:06:04 -0000      1.91
> +++ lwlib/ChangeLog     20 May 2007 14:32:02 -0000
> @@ -0,0 +1,13 @@
> +2007-05-20  Stephen J. Turnbull  <stephen at xemacs.org>
> +
> +       Gauge values are signed integers (ints).
> +       (XawGaugeGetValue): Declare return value as int.
> +       (XawGaugeSetValue): Declare value as int.
> +
> +       * xlwgauge.h: Get rid of references to Cardinal in comment.
> +
> +       * xlwgauge.c (GaugeGetValue): Declare value as int.
> +       (GaugeMercury): Declare val0 and val1 as int.  Remove redundant casts.
> +       (XawGaugeGetValue): Declare return value as int.
> +       (XawGaugeSetValue): Declare value as int.
> +
>
> Index: lisp/gutter-items.el
> ===================================================================
> RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/gutter-items.el,v
> retrieving revision 1.8
> diff -u -r1.8 gutter-items.el
> --- lisp/gutter-items.el        18 Mar 2003 06:58:20 -0000      1.8
> +++ lisp/gutter-items.el        20 May 2007 14:32:02 -0000
> @@ -679,8 +679,10 @@
>
>  (defun progress-feedback-with-label (label fmt &optional value &rest args)
>    "Print a progress gauge and message in the bottom gutter area of the frame.
> -First argument LABEL is an identifier for this progress gauge.  The rest of the
> -arguments are the same as to `format'."
> +LABEL is an identifier for this progress gauge.
> +FMT is a format string to be passed to `format' along with ARGS.
> +Optional VALUE is the current degree of progress, an integer 0-100.
> +The remaining ARGS are passed with FMT `(apply #'format FMT ARGS)'."
>    ;; #### sometimes the buffer gets changed temporarily. I don't know
>    ;; why this is, so protect against it.
>    (save-excursion
> Index: lwlib/xlwgauge.c
> ===================================================================
> RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwgauge.c,v
> retrieving revision 1.7
> diff -u -r1.7 xlwgauge.c
> --- lwlib/xlwgauge.c    2 May 2006 15:30:32 -0000       1.7
> +++ lwlib/xlwgauge.c    20 May 2007 14:32:02 -0000
> @@ -132,7 +132,7 @@
>  static void DisableUpdate (GaugeWidget);
>
>  static void GaugeGetValue (XtPointer, XtIntervalId *);
> -static void GaugeMercury (Display *, Window, GC, GaugeWidget, Cardinal, Cardinal);
> +static void GaugeMercury (Display *, Window, GC, GaugeWidget, int, int);
>
>  static Boolean GaugeConvert (Widget, Atom *, Atom *, Atom *,
>                              XtPointer *, unsigned long *, int *);
> @@ -817,8 +817,7 @@
>          */
>
>  void
> -XawGaugeSetValue (Widget   w,
> -                 Cardinal value)
> +XawGaugeSetValue (Widget w, int value)
>  {
>         GaugeWidget gw = (GaugeWidget)w ;
>         int     oldvalue ;
> @@ -850,7 +849,7 @@
>  }
>
>
> -Cardinal
> +int
>  XawGaugeGetValue (Widget w)
>  {
>         GaugeWidget gw = (GaugeWidget)w ;
> @@ -873,8 +872,8 @@
>               Window      win,
>               GC          gc,
>               GaugeWidget gw,
> -             Cardinal    val0,
> -             Cardinal    val1)
> +             int    val0,
> +             int    val1)
>  {
>         int     v0 = gw->gauge.v0 ;
>         int     v1 = gw->gauge.v1 ;
> @@ -893,10 +892,10 @@
>
>         if( vd <= 0 ) vd = 1 ;
>
> -       if( (int) val0 < v0 ) val0 = v0 ;
> -       else if( (int) val0 > v1 ) val0 = v1 ;
> -       if( (int) val1 < v0 ) val1 = v0 ;
> -       else if( (int) val1 > v1 ) val1 = v1 ;
> +       if( val0 < v0 ) val0 = v0 ;
> +       else if( val0 > v1 ) val0 = v1 ;
> +       if( val1 < v0 ) val1 = v0 ;
> +       else if( val1 > v1 ) val1 = v1 ;
>
>         p0 = (val0-v0)*(e1-e0-1)/vd ;
>         p1 = (val1-v0)*(e1-e0-1)/vd ;
> @@ -1108,7 +1107,7 @@
>                XtIntervalId *UNUSED (intervalId))
>  {
>         GaugeWidget     gw = (GaugeWidget)clientData ;
> -       Cardinal        value ;
> +       int     value ;
>
>         if( gw->gauge.update > 0 )
>           EnableUpdate(gw) ;
> Index: lwlib/xlwgauge.h
> ===================================================================
> RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwgauge.h,v
> retrieving revision 1.2
> diff -u -r1.2 xlwgauge.h
> --- lwlib/xlwgauge.h    12 Apr 2001 18:21:53 -0000      1.2
> +++ lwlib/xlwgauge.h    20 May 2007 14:32:02 -0000
> @@ -48,9 +48,9 @@
>
>   Name                  Class           RepType         Default Value
>   ----                  -----           -------         -------------
> - value                 Value           Cardinal        0
> - minValue              MinValue        Cardinal        0
> - maxValue              MaxValue        Cardinal        100
> + value                 Value           Int     0
> + minValue              Int     Cardinal        0
> + maxValue              Int     Cardinal        100
>   ntics                 NTics           Cardinal        0       +
>   nlabels               NLabels         Cardinal        0       ++
>   labels                        Labels          String *        NULL    +++
> @@ -100,7 +100,7 @@
>                 XtPointer client ;
>                 XtPointer rval ;
>         {
> -         *(Cardinal *)rval = value ;
> +         *(int *)rval = value ;
>         }
>
>  */
> @@ -169,11 +169,11 @@
>  extern void    XawGaugeSetValue(
>  #if NeedFunctionPrototypes
>         Widget  gauge,
> -       Cardinal value
> +       int value
>  #endif
>  );
>
> -extern Cardinal XawGaugeGetValue(
> +extern int XawGaugeGetValue(
>  #if NeedFunctionPrototypes
>         Widget  gauge
>  #endif
>
> _______________________________________________
> XEmacs-Patches mailing list
> XEmacs-Patches at xemacs.org
> http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
>


-- 
The Journey by Mary Oliver
http://www.poemhunter.com/p/m/poem.asp?poet=6771&poem=30506



More information about the XEmacs-Patches mailing list