DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2405
Version: 1.3-current


According to Greg's report I changed the patch for Fl_Scroll (see attached
file gcc-4.3.2_file1_v3.patch). It turned out that Boris's patch was
technically correct, but the previous code was wrong (it needed additional
parentheses anyway).


Link: http://www.fltk.org/str.php?L2405
Version: 1.3-current
Index: src/Fl_Tabs.cxx
===================================================================
--- src/Fl_Tabs.cxx     (Revision 7705)
+++ src/Fl_Tabs.cxx     (Arbeitskopie)
@@ -246,7 +246,7 @@
 
 int Fl_Tabs::push(Fl_Widget *o) {
   if (push_ == o) return 0;
-  if (push_ && !push_->visible() || o && !o->visible())
+  if ((push_ && !push_->visible()) || (o && !o->visible()))
     redraw_tabs();
   push_ = o;
   return 1;
Index: src/Fl_Scroll.cxx
===================================================================
--- src/Fl_Scroll.cxx   (Revision 7705)
+++ src/Fl_Scroll.cxx   (Arbeitskopie)
@@ -346,8 +346,8 @@
   }
   if (dw==0 && dh==0) {
     char pad = (scrollbar.visible() && hscrollbar.visible());
-    char al = (scrollbar.align()&FL_ALIGN_LEFT!=0);
-    char at = (scrollbar.align()&FL_ALIGN_TOP!=0);
+    char al = ((scrollbar.align()&FL_ALIGN_LEFT)!=0);
+    char at = ((scrollbar.align()&FL_ALIGN_TOP)!=0);
     scrollbar.position(al?X:X+W-scrollbar.w(), (at&&pad)?Y+hscrollbar.h():Y);
     hscrollbar.position((al&&pad)?X+scrollbar.w():X, at?Y:Y+H-hscrollbar.h());
   } else {
Index: src/Fl_Input_.cxx
===================================================================
--- src/Fl_Input_.cxx   (Revision 7705)
+++ src/Fl_Input_.cxx   (Arbeitskopie)
@@ -844,7 +844,7 @@
 */
 int Fl_Input_::undo() {
   was_up_down = 0;
-  if (undowidget != this || !undocut && !undoinsert) return 0;
+  if (undowidget != this || (!undocut && !undoinsert)) return 0;
 
   int ilen = undocut;
   int xlen = undoinsert;
Index: src/Fl_Input.cxx
===================================================================
--- src/Fl_Input.cxx    (Revision 7705)
+++ src/Fl_Input.cxx    (Arbeitskopie)
@@ -123,12 +123,12 @@
       // find the insert position
       int ip = position()<mark() ? position() : mark();
       // This is complex to allow "0xff12" hex to be typed:
-      if (!ip && (ascii == '+' || ascii == '-') 
+      if ((!ip && (ascii == '+' || ascii == '-'))
           || (ascii >= '0' && ascii <= '9') 
           || (ip==1 && index(0)=='0' && (ascii=='x' || ascii == 'X')) 
           || (ip>1 && index(0)=='0' && (index(1)=='x'||index(1)=='X')
-              && (ascii>='A'&& ascii<='F' || ascii>='a'&& ascii<='f')) 
-          || input_type()==FL_FLOAT_INPUT && ascii && strchr(legal_fp_chars, 
ascii)) 
+              && ((ascii>='A'&& ascii<='F') || (ascii>='a'&& ascii<='f'))) 
+          || (input_type()==FL_FLOAT_INPUT && ascii && strchr(legal_fp_chars, 
ascii)))
       {
        if (readonly()) fl_beep();
        else replace(position(), mark(), &ascii, 1);
@@ -532,8 +532,8 @@
         newpos = position(); 
         position( oldpos, oldmark );
         if (Fl::focus()==this && !Fl::event_state(FL_SHIFT) && 
input_type()!=FL_SECRET_INPUT &&
-            (newpos >= mark() && newpos < position() ||
-             newpos >= position() && newpos < mark())) {
+            ((newpos >= mark() && newpos < position()) ||
+             (newpos >= position() && newpos < mark()))) {
               // user clicked in the selection, may be trying to drag
               drag_start = newpos;
               return 1;
Index: src/Fl_compose.cxx
===================================================================
--- src/Fl_compose.cxx  (Revision 7705)
+++ src/Fl_compose.cxx  (Arbeitskopie)
@@ -186,7 +186,7 @@
 #endif
     // now search for the pair in either order:
     for (const char *p = compose_pairs; *p; p += 2) {
-      if (p[0] == ascii && p[1] == c1 || p[1] == ascii && p[0] == c1) {
+      if ((p[0] == ascii && p[1] == c1) || (p[1] == ascii && p[0] == c1)) {
         int len = fl_utf8encode((p-compose_pairs)/2+0xA0, e_text);
         e_text[len] = '\0';
         e_length = len;
Index: src/Fl_Text_Buffer.cxx
===================================================================
--- src/Fl_Text_Buffer.cxx      (Revision 7705)
+++ src/Fl_Text_Buffer.cxx      (Arbeitskopie)
@@ -414,7 +414,7 @@
 
 int Fl_Text_Buffer::undo(int *cursorPos)
 {
-  if (undowidget != this || !undocut && !undoinsert && !mCanUndo)
+  if (undowidget != this || (!undocut && !undoinsert && !mCanUndo))
     return 0;
   
   int ilen = undocut;
@@ -1176,7 +1176,7 @@
         return 1;
       }
       // FIXME: character is ucs-4
-    } while ((matchCase ? character(bp++) == *sp++ :
+    } while ((matchCase ? (int)character(bp++) == *sp++ :
               toupper(character(bp++)) == toupper(*sp++))
              && bp < length());
     startPos++;
@@ -1201,7 +1201,7 @@
         return 1;
       }
       // FIXME: character is ucs-4
-    } while ((matchCase ? character(bp--) == *sp-- :
+    } while ((matchCase ? (int)character(bp--) == *sp-- :
               toupper(character(bp--)) == toupper(*sp--))
              && bp >= 0);
     startPos--;
Index: src/Fl_Tile.cxx
===================================================================
--- src/Fl_Tile.cxx     (Revision 7705)
+++ src/Fl_Tile.cxx     (Arbeitskopie)
@@ -52,17 +52,17 @@
     int R = X+o->w();
     if (oix) {
       int t = p[0];
-      if (t == oix || t>oix && X<newx || t<oix && X>newx) X = newx;
+      if (t == oix || (t>oix && X<newx) || (t<oix && X>newx)) X = newx;
       t = p[1];
-      if (t == oix || t>oix && R<newx || t<oix && R>newx) R = newx;
+      if (t == oix || (t>oix && R<newx) || (t<oix && R>newx)) R = newx;
     }
     int Y = o->y();
     int B = Y+o->h();
     if (oiy) {
       int t = p[2];
-      if (t == oiy || t>oiy && Y<newy || t<oiy && Y>newy) Y = newy;
+      if (t == oiy || (t>oiy && Y<newy) || (t<oiy && Y>newy)) Y = newy;
       t = p[3];
-      if (t == oiy || t>oiy && B<newy || t<oiy && B>newy) B = newy;
+      if (t == oiy || (t>oiy && B<newy) || (t<oiy && B>newy)) B = newy;
     }
     o->damage_resize(X,Y,R-X,B-Y);
   }
Index: src/fl_color.cxx
===================================================================
--- src/fl_color.cxx    (Revision 7705)
+++ src/fl_color.cxx    (Arbeitskopie)
@@ -202,7 +202,7 @@
   }
   return result;
 #  else
-  return (color&mask) | (~mask)&(mask>>1);
+  return (color&mask) | ((~mask)&(mask>>1));
 #  endif
 }
 
Index: src/Fl_Preferences.cxx
===================================================================
--- src/Fl_Preferences.cxx      (Revision 7705)
+++ src/Fl_Preferences.cxx      (Arbeitskopie)
@@ -666,8 +666,9 @@
   const char *s = src;
   for ( ; *s; s++, len++ )
   {
-    if ( *s == '\\' )
+    if ( *s == '\\' ) {
       if ( isdigit( s[1] ) ) s+=3; else s+=1;
+    }
   }
   char *dst = (char*)malloc( len+1 ), *d = dst;
   for ( s = src; *s; s++ )
Index: src/Fl_Menu.cxx
===================================================================
--- src/Fl_Menu.cxx     (Revision 7705)
+++ src/Fl_Menu.cxx     (Arbeitskopie)
@@ -686,7 +686,7 @@
       }
       return 1;
     case FL_Right:
-      if (pp.menubar && (pp.menu_number<=0 || pp.menu_number==1 && 
pp.nummenus==2))
+      if (pp.menubar && (pp.menu_number<=0 || (pp.menu_number==1 && 
pp.nummenus==2)))
        forward(0);
       else if (pp.menu_number < pp.nummenus-1) forward(pp.menu_number+1);
       return 1;
@@ -775,7 +775,7 @@
     // Mouse must either be held down/dragged some, or this must be
     // the second click (not the one that popped up the menu):
     if (!Fl::event_is_click() || pp.state == PUSH_STATE ||
-       pp.menubar && pp.current_item && !pp.current_item->submenu() // button
+       (pp.menubar && pp.current_item && !pp.current_item->submenu()) // button
        ) {
 #if 0 // makes the check/radio items leave the menu up
       const Fl_Menu_Item* m = pp.current_item;
Index: src/Fl_x.cxx
===================================================================
--- src/Fl_x.cxx        (Revision 7705)
+++ src/Fl_x.cxx        (Arbeitskopie)
@@ -355,7 +355,7 @@
 
   if (!fs) {
     fnt = NULL;//fl_get_font_xfld(0, 14);
-    if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
+    if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;}
     fs = XCreateFontSet(fl_display, fnt, &missing_list,
                         &missing_count, &def_string);
   }
@@ -469,7 +469,7 @@
 #endif /*__GNUC__*/
 
     fnt = NULL; // fl_get_font_xfld(font, size);
-    if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
+    if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;}
     fs = XCreateFontSet(fl_display, fnt, &missing_list,
                         &missing_count, &def_string);
 #else
@@ -1725,7 +1725,7 @@
 // contents are restored to the area, but this assumes the area
 // is cleared to background color.  So this is disabled in this version.
 // Fl_Window *fl_boxcheat;
-static inline int can_boxcheat(uchar b) {return (b==1 || (b&2) && b<=15);}
+static inline int can_boxcheat(uchar b) {return (b==1 || ((b&2) && b<=15));}
 
 void Fl_Window::show() {
   image(Fl::scheme_bg_);
Index: src/fl_draw_pixmap.cxx
===================================================================
--- src/fl_draw_pixmap.cxx      (Revision 7705)
+++ src/fl_draw_pixmap.cxx      (Arbeitskopie)
@@ -63,7 +63,7 @@
 int fl_measure_pixmap(const char * const *cdata, int &w, int &h) {
   int i = sscanf(cdata[0],"%d%d%d%d",&w,&h,&ncolors,&chars_per_pixel);
   if (i<4 || w<=0 || h<=0 ||
-      chars_per_pixel!=1 && chars_per_pixel!=2) return w=0;
+      (chars_per_pixel!=1 && chars_per_pixel!=2)) return w=0;
   return 1;
 }
 
Index: src/Fl.cxx
===================================================================
--- src/Fl.cxx  (Revision 7705)
+++ src/Fl.cxx  (Arbeitskopie)
@@ -964,7 +964,7 @@
   switch (e) {
 
   case FL_CLOSE:
-    if (grab() || modal() && window != modal()) return 0;
+    if (grab() || (modal() && window != modal())) return 0;
     wi->do_callback();
     return 1;
 
Index: test/checkers.cxx
===================================================================
--- test/checkers.cxx   (Revision 7705)
+++ test/checkers.cxx   (Arbeitskopie)
@@ -191,14 +191,14 @@
   piece aa = tb[target]; piece bb = tb[src];
   tb[target] = EMPTY; tb[src] = EMPTY;
   int safe =
-    (tb[src-4]&FRIEND && tb[src-8]&ENEMY
-     ||tb[src-5]&FRIEND && tb[src-10]&ENEMY
-     ||tb[dst-4]&ENEMY && !tb[dst+4]
-     ||tb[dst-5]&ENEMY && !tb[dst+5]
-     ||tb[src+4]&FRIEND && tb[src+8]==ENEMYKING
-     ||tb[src+5]&FRIEND && tb[src+10]==ENEMYKING
-     ||tb[dst+4]==ENEMYKING && !tb[dst-4]
-     ||tb[dst+5]==ENEMYKING && !tb[dst-5]);
+    ((tb[src-4]&FRIEND && tb[src-8]&ENEMY)
+     ||(tb[src-5]&FRIEND && tb[src-10]&ENEMY)
+     ||(tb[dst-4]&ENEMY && !tb[dst+4])
+     ||(tb[dst-5]&ENEMY && !tb[dst+5])
+     ||(tb[src+4]&FRIEND && tb[src+8]==ENEMYKING)
+     ||(tb[src+5]&FRIEND && tb[src+10]==ENEMYKING)
+     ||(tb[dst+4]==ENEMYKING && !tb[dst-4])
+     ||(tb[dst+5]==ENEMYKING && !tb[dst-5]));
   tb[target] = aa; tb[src] = bb;
   return(safe);
 }
@@ -286,7 +286,7 @@
   for (i=9; i<40; i++) {
     int x = (gradient[i-4]+gradient[i-5])/2;
     if (tb[i]==FRIEND) total += x;
-    gradient[i] = (tb[i]&FRIEND || !tb[i] && !is_protected[i]) ? x : 0;
+    gradient[i] = (tb[i]&FRIEND || (!tb[i] && !is_protected[i])) ? x : 0;
   }
   n->gradient = total;
 
@@ -1008,7 +1008,7 @@
 
 // drag the piece on square i to dx dy, or undo drag if i is zero:
 void Board::drag_piece(int j, int dx, int dy) {
-  dy = (dy&-2) | dx&1; // make halftone shadows line up
+  dy = (dy&-2) | (dx&1); // make halftone shadows line up
   if (j != erase_this) drop_piece(erase_this); // should not happen
   if (!erase_this) { // pick up old piece
     dragx = squarex(j); dragy = squarey(j);
Index: test/navigation.cxx
===================================================================
--- test/navigation.cxx (Revision 7705)
+++ test/navigation.cxx (Arbeitskopie)
@@ -57,7 +57,7 @@
       Fl_Widget *o = window.child(n);
       if (x<o->x()+o->w() && x+w>o->x() &&
          y<o->y()+o->h() && y+h>o->y()) break;
-      if (!j && (y < o->y() || y == o->y() && x < o->x())) j = o;
+      if (!j && (y < o->y() || (y == o->y() && x < o->x()))) j = o;
     }
     // skip if intersection:
     if (n < window.children()) continue;
Index: fluid/Fl_Menu_Type.cxx
===================================================================
--- fluid/Fl_Menu_Type.cxx      (Revision 7705)
+++ fluid/Fl_Menu_Type.cxx      (Arbeitskopie)
@@ -112,10 +112,10 @@
   Fl_Type* q = Fl_Type::current;
   Fl_Type* p = q;
   if (p) {
-    if (force_parent && q->is_menu_item() || !q->is_parent()) p = p->parent;
+    if ((force_parent && q->is_menu_item()) || !q->is_parent()) p = p->parent;
   }
   force_parent = 0;
-  if (!p || !(p->is_menu_button() || p->is_menu_item() && p->is_parent())) {
+  if (!p || !(p->is_menu_button() || (p->is_menu_item() && p->is_parent()))) {
     fl_message("Please select a menu to add to");
     return 0;
   }
@@ -565,14 +565,14 @@
   if (e == FL_KEYBOARD) {
     if (!value()) return 0;
     int v = Fl::event_text()[0];
-    if (v > 32 && v < 0x7f || v > 0xa0 && v <= 0xff) {
+    if ((v > 32 && v < 0x7f) || (v > 0xa0 && v <= 0xff)) {
       if (isupper(v)) {
         v = tolower(v);
         v |= FL_SHIFT;
       }
-      v = v | Fl::event_state()&(FL_META|FL_ALT|FL_CTRL);
+      v = v | (Fl::event_state()&(FL_META|FL_ALT|FL_CTRL));
     } else {
-      v = Fl::event_state()&(FL_META|FL_ALT|FL_CTRL|FL_SHIFT) | 
Fl::event_key();
+      v = (Fl::event_state()&(FL_META|FL_ALT|FL_CTRL|FL_SHIFT)) | 
Fl::event_key();
       if (v == FL_BackSpace && svalue) v = 0;
     }
                if (v != svalue) {svalue = v; set_changed(); redraw(); 
do_callback(); }
Index: fluid/Fl_Widget_Type.cxx
===================================================================
--- fluid/Fl_Widget_Type.cxx    (Revision 7705)
+++ fluid/Fl_Widget_Type.cxx    (Arbeitskopie)
@@ -260,7 +260,7 @@
 Fl_Type *sort(Fl_Type *parent) {
   Fl_Type *f,*n=0;
   for (f = parent ? parent->next : Fl_Type::first; ; f = n) {
-    if (!f || parent && f->level <= parent->level) return f;
+    if (!f || (parent && f->level <= parent->level)) return f;
     n = sort(f);
     if (!f->selected || (!f->is_widget() || f->is_menu_item())) continue;
     Fl_Widget* fw = ((Fl_Widget_Type*)f)->o;
@@ -1940,7 +1940,7 @@
     if (!e) continue;
     if (strncmp(c,e,d-c)) continue;
     int n1 = atoi(e+(d-c)+1);
-    if (n1 > num || n1==num && sawthis) return 0;
+    if (n1 > num || (n1==num && sawthis)) return 0;
   }
   static char buffer[128];
   // MRS: we want strncpy() here...
Index: fluid/Fl_Function_Type.cxx
===================================================================
--- fluid/Fl_Function_Type.cxx  (Revision 7705)
+++ fluid/Fl_Function_Type.cxx  (Arbeitskopie)
@@ -332,7 +332,7 @@
           skipc = skipc ? 0 : 1;
         if(!skips && !skipc && plevel==1 && *nptr =='=' && 
            !(nc && *(nptr-1)=='\'') ) // ignore '=' case 
-          while(*++nptr  && (skips || skipc || (*nptr!=',' && *nptr!=')' || 
plevel!=1) )) {
+          while(*++nptr  && (skips || skipc || ((*nptr!=',' && *nptr!=')') || 
plevel!=1) )) {
             if ( *nptr=='"' &&  *(nptr-1)!='\\' ) 
               skips = skips ? 0 : 1;
             else if(!skips && *nptr=='\'' &&  *(nptr-1)!='\\')
@@ -374,7 +374,7 @@
           skipc = skipc ? 0 : 1;
         if(!skips && !skipc && plevel==1 && *nptr =='=' && 
            !(nc && *(nptr-1)=='\'') ) // ignore '=' case 
-          while(*++nptr  && (skips || skipc || (*nptr!=',' && *nptr!=')' || 
plevel!=1) )) {
+          while(*++nptr  && (skips || skipc || ((*nptr!=',' && *nptr!=')') || 
plevel!=1) )) {
             if ( *nptr=='"' &&  *(nptr-1)!='\\' ) 
               skips = skips ? 0 : 1;
             else if(!skips && *nptr=='\'' &&  *(nptr-1)!='\\')
@@ -669,10 +669,10 @@
   if (!c) return;
   // handle a few keywords differently if inside a class
   if (is_in_class() && (
-                        !strncmp(c,"class",5) && isspace(c[5])
-                        || !strncmp(c,"typedef",7) && isspace(c[7])
-                        || !strncmp(c,"FL_EXPORT",9) && isspace(c[9])
-                        || !strncmp(c,"struct",6) && isspace(c[6])
+                        (!strncmp(c,"class",5) && isspace(c[5]))
+                        || (!strncmp(c,"typedef",7) && isspace(c[7]))
+                        || (!strncmp(c,"FL_EXPORT",9) && isspace(c[9]))
+                        || (!strncmp(c,"struct",6) && isspace(c[6]))
                         ) ) {
     write_public(public_);
     write_comment_h("  ");
@@ -680,13 +680,13 @@
     return;
   }
   // handle putting #include, extern, using or typedef into decl:
-  if (!isalpha(*c) && *c != '~'
-      || !strncmp(c,"extern",6) && isspace(c[6])
-      || !strncmp(c,"class",5) && isspace(c[5])
-      || !strncmp(c,"typedef",7) && isspace(c[7])
-      || !strncmp(c,"using",5) && isspace(c[5])
-      || !strncmp(c,"FL_EXPORT",9) && isspace(c[9])
-      //    || !strncmp(c,"struct",6) && isspace(c[6])
+  if ((!isalpha(*c) && *c != '~')
+      || (!strncmp(c,"extern",6) && isspace(c[6]))
+      || (!strncmp(c,"class",5) && isspace(c[5]))
+      || (!strncmp(c,"typedef",7) && isspace(c[7]))
+      || (!strncmp(c,"using",5) && isspace(c[5]))
+      || (!strncmp(c,"FL_EXPORT",9) && isspace(c[9]))
+      //    || (!strncmp(c,"struct",6) && isspace(c[6]))
       ) {
     if (public_) {
       write_comment_h();
Index: fluid/Fl_Window_Type.cxx
===================================================================
--- fluid/Fl_Window_Type.cxx    (Revision 7705)
+++ fluid/Fl_Window_Type.cxx    (Arbeitskopie)
@@ -573,10 +573,10 @@
     R += dx;
     T += dy;
   } else {
-    if (drag&LEFT) if (X==bx) X += dx; else if (X<bx+dx) X = bx+dx;
-    if (drag&TOP) if (Y==by) Y += dy; else if (Y<by+dy) Y = by+dy;
-    if (drag&RIGHT) if (R==br) R += dx; else if (R>br+dx) R = br+dx;
-    if (drag&BOTTOM) if (T==bt) T += dy; else if (T>bt+dx) T = bt+dx;
+    if (drag&LEFT) { if (X==bx) X += dx; else if (X<bx+dx) X = bx+dx; }
+    if (drag&TOP) { if (Y==by) Y += dy; else if (Y<by+dy) Y = by+dy; }
+    if (drag&RIGHT) { if (R==br) R += dx; else if (R>br+dx) R = br+dx; }
+    if (drag&BOTTOM) { if (T==bt) T += dy; else if (T>bt+dx) T = bt+dx; }
   }
   if (R<X) {int n = X; X = R; R = n;}
   if (T<Y) {int n = Y; Y = T; T = n;}
Index: fluid/code.cxx
===================================================================
--- fluid/code.cxx      (Revision 7705)
+++ fluid/code.cxx      (Arbeitskopie)
@@ -47,7 +47,7 @@
 // return true if c can be in a C identifier.  I needed this so
 // it is not messed up by locale settings:
 int is_id(char c) {
-  return c>='a' && c<='z' || c>='A' && c<='Z' || c>='0' && c<='9' || c=='_';
+  return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || 
c=='_';
 }
 
 ////////////////////////////////////////////////////////////////
@@ -215,7 +215,7 @@
       // consume them as part of the quoted sequence.  Use string constant
       // pasting to avoid this:
       c = *w;
-      if (w < e && (c>='0'&&c<='9' || c>='a'&&c<='f' || c>='A'&&c<='F')) {
+      if (w < e && ((c>='0'&&c<='9') || (c>='a'&&c<='f') || (c>='A'&&c<='F'))) 
{
        putc('\"', code_file); linelength++;
        if (linelength >= 79) {fputs("\n",code_file); linelength = 0;}
        putc('\"', code_file); linelength++;
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to