Index: FL/fl_utf8.h
===================================================================
--- FL/fl_utf8.h	(revision 11211)
+++ FL/fl_utf8.h	(working copy)
@@ -124,7 +124,7 @@
 FL_EXPORT unsigned fl_utf8froma (char *dst, unsigned dstlen, const char *src, unsigned srclen);
 
 /* F2: Returns true if the current O/S locale is UTF-8 */
-FL_EXPORT int fl_utf8locale();
+FL_EXPORT int fl_utf8locale(void);
 
 /* F2: Examine the first len characters of src, to determine if the input text is UTF-8 or not
  * NOTE: The value returned is not simply boolean - it contains information about the probable
Index: fluid/CodeEditor.cxx
===================================================================
--- fluid/CodeEditor.cxx	(revision 11211)
+++ fluid/CodeEditor.cxx	(working copy)
@@ -359,7 +359,7 @@
   char *text = e->buffer()->text_range(start, pos);
   char *ptr;
 
-  for (ptr = text; isspace(*ptr); ptr ++);
+  for (ptr = text; isspace(*ptr); ptr ++) {}
   *ptr = '\0';  
   if (*text) {
     // use only a single 'insert' call to avoid redraw issues
Index: fluid/Fl_Type.cxx
===================================================================
--- fluid/Fl_Type.cxx	(revision 11211)
+++ fluid/Fl_Type.cxx	(working copy)
@@ -522,7 +522,7 @@
 	  k->visible = 1;
 	  if (k->is_parent() && !k->open_) {
 	    Fl_Type *j;
-	    for (j = k->next; j && j->level>k->level; j = j->next);
+	    for (j = k->next; j && j->level>k->level; j = j->next) {}
 	    k = j;
 	  } else
 	    k = k->next;
@@ -579,7 +579,7 @@
   Fl_Type *q;
   int newlevel;
   if (p) {
-    for (q = p->next; q && q->level > p->level; q = q->next);
+    for (q = p->next; q && q->level > p->level; q = q->next) {}
     newlevel = p->level+1;
   } else {
     q = 0;
@@ -774,7 +774,7 @@
   Fl_Type *p = Fl_Type::current ? Fl_Type::current->parent : 0;
   if (in_this_only) {
     Fl_Type *t = p;
-    for (; t && t != in_this_only; t = t->parent);
+    for (; t && t != in_this_only; t = t->parent) {}
     if (t != in_this_only) p = in_this_only;
   }
   for (;;) {
@@ -798,7 +798,7 @@
   Fl_Type *p = Fl_Type::current ? Fl_Type::current->parent : 0;
   if (in_this_only) {
     Fl_Type *t = p;
-    for (; t && t != in_this_only; t = t->parent);
+    for (; t && t != in_this_only; t = t->parent) {}
     if (t != in_this_only) p = in_this_only;
   }
   for (;;) {
@@ -820,7 +820,7 @@
 
 static void delete_children(Fl_Type *p) {
   Fl_Type *f;
-  for (f = p; f && f->next && f->next->level > p->level; f = f->next);
+  for (f = p; f && f->next && f->next->level > p->level; f = f->next) {}
   for (; f != p; ) {
     Fl_Type *g = f->prev;
     delete f;
@@ -851,7 +851,7 @@
   if (level != g->level) printf("move_before levels don't match! %d %d\n",
 				level, g->level);
   Fl_Type* n;
-  for (n = next; n && n->level > level; n = n->next);
+  for (n = next; n && n->level > level; n = n->next) {}
   if (n == g) return;
   Fl_Type *l = n ? n->prev : Fl_Type::last;
   prev->next = n;
@@ -875,7 +875,7 @@
     Fl_Type* nxt = f->next;
     if (f->selected) {
       Fl_Type* g;
-      for (g = f->prev; g && g->level > f->level; g = g->prev);
+      for (g = f->prev; g && g->level > f->level; g = g->prev) {}
       if (g && g->level == f->level && !g->selected) {
         f->move_before(g);
         mod = 1;
@@ -893,7 +893,7 @@
     Fl_Type* prv = f->prev;
     if (f->selected) {
       Fl_Type* g;
-      for (g = f->next; g && g->level > f->level; g = g->next);
+      for (g = f->next; g && g->level > f->level; g = g->next) {}
       if (g && g->level == f->level && !g->selected) {
         g->move_before(f);
         mod = 1;
Index: fluid/Fl_Widget_Type.cxx
===================================================================
--- fluid/Fl_Widget_Type.cxx	(revision 11211)
+++ fluid/Fl_Widget_Type.cxx	(working copy)
@@ -1976,7 +1976,7 @@
   Fl_Type *t = o->prev;
   Fl_Type *tp = o;
   const char *cn = o->class_name(1);
-  for (; t && t->class_name(1) == cn; tp = t, t = t->prev);
+  for (; t && t->class_name(1) == cn; tp = t, t = t->prev) {}
   for (t = tp; t && t->class_name(1) == cn; t = t->next) {
     if (t == o) {sawthis=1; continue;}
     const char *e = t->name();
@@ -2710,7 +2710,7 @@
     if (sscanf(value,"%f %f %f %f",&x,&y,&w,&h) == 4) {
       if (fdesign_flip) {
 	Fl_Type *p;
-	for (p = parent; p && !p->is_window(); p = p->parent);
+	for (p = parent; p && !p->is_window(); p = p->parent) {}
 	if (p && p->is_widget()) y = ((Fl_Widget_Type*)p)->o->h()-(y+h);
       }	  
       x += pasteoffset;
Index: fluid/file.cxx
===================================================================
--- fluid/file.cxx	(revision 11211)
+++ fluid/file.cxx	(working copy)
@@ -339,7 +339,7 @@
       p->write();
       write_string("\n");
       int q = p->level;
-      for (p = p->next; p && p->level > q; p = p->next);
+      for (p = p->next; p && p->level > q; p = p->next) {}
     } else {
       p = p->next;
     }
Index: src/Fl.cxx
===================================================================
--- src/Fl.cxx	(revision 11211)
+++ src/Fl.cxx	(working copy)
@@ -838,7 +838,7 @@
   handler_link *l, *p;
 
   // Search for the handler in the list...
-  for (l = handlers, p = 0; l && l->handle != ha; p = l, l = l->next);
+  for (l = handlers, p = 0; l && l->handle != ha; p = l, l = l->next) {}
 
   if (l) {
     // Found it, so remove it from the list...
Index: src/Fl_File_Chooser2.cxx
===================================================================
--- src/Fl_File_Chooser2.cxx	(revision 11211)
+++ src/Fl_File_Chooser2.cxx	(working copy)
@@ -1404,7 +1404,7 @@
     if (*ptr || ptr == preview_text_) {
       for (ptr = preview_text_;
          *ptr && (isprint(*ptr & 255) || isspace(*ptr & 255));
-	 ptr ++);
+	 ptr ++) {}
     }
 
     if (*ptr || ptr == preview_text_) {
Index: src/Fl_File_Icon.cxx
===================================================================
--- src/Fl_File_Icon.cxx	(revision 11211)
+++ src/Fl_File_Icon.cxx	(working copy)
@@ -120,7 +120,7 @@
   // Find the icon in the list...
   for (current = first_, prev = (Fl_File_Icon *)0;
        current != this && current != (Fl_File_Icon *)0;
-       prev = current, current = current->next_);
+       prev = current, current = current->next_) {}
 
   // Remove the icon from the list as needed...
   if (current)
Index: src/Fl_Help_View.cxx
===================================================================
--- src/Fl_Help_View.cxx	(revision 11211)
+++ src/Fl_Help_View.cxx	(working copy)
@@ -1268,7 +1268,7 @@
           // Copy the title in the document...
           for (s = title_;
 	       *ptr != '<' && *ptr && s < (title_ + sizeof(title_) - 1);
-	       *s++ = *ptr++);
+	       *s++ = *ptr++) {}
 
 	  *s = '\0';
 	  s = buf;
Index: src/Fl_Input_.cxx
===================================================================
--- src/Fl_Input_.cxx	(revision 11211)
+++ src/Fl_Input_.cxx	(working copy)
@@ -1213,7 +1213,7 @@
       int i = 0;
       // find first different character:
       if (value_) {
-	for (; i<size_ && i<len && str[i]==value_[i]; i++);
+	for (; i<size_ && i<len && str[i]==value_[i]; i++) {}
 	if (i==size_ && i==len) return 0;
       }
       minimal_update(i);
Index: src/Fl_XBM_Image.cxx
===================================================================
--- src/Fl_XBM_Image.cxx	(revision 11211)
+++ src/Fl_XBM_Image.cxx	(working copy)
@@ -90,7 +90,7 @@
         *ptr++ = (uchar)t;
 	i ++;
       }
-      while (*a && *a++ != ',');
+      while (*a && *a++ != ',') {}
     }
   }
 
Index: src/filename_absolute.cxx
===================================================================
--- src/filename_absolute.cxx	(revision 11211)
+++ src/filename_absolute.cxx	(working copy)
@@ -83,7 +83,7 @@
   while (*start == '.') {
     if (start[1]=='.' && isdirsep(start[2])) {
       char *b;
-      for (b = a-1; b >= temp && !isdirsep(*b); b--);
+      for (b = a-1; b >= temp && !isdirsep(*b); b--) {}
       if (b < temp) break;
       a = b;
       start += 3;
Index: src/filename_expand.cxx
===================================================================
--- src/filename_expand.cxx	(revision 11211)
+++ src/filename_expand.cxx	(working copy)
@@ -70,7 +70,7 @@
   int ret = 0;
 
   for (char *a=temp; a<end; ) {	// for each slash component
-    char *e; for (e=a; e<end && !isdirsep(*e); e++); // find next slash
+    char *e; for (e=a; e<end && !isdirsep(*e); e++) {} // find next slash
     const char *value = 0; // this will point at substitute value
     switch (*a) {
     case '~':	// a home directory name
Index: src/fl_draw.cxx
===================================================================
--- src/fl_draw.cxx	(revision 11211)
+++ src/fl_draw.cxx	(working copy)
@@ -174,7 +174,7 @@
       // Start with a symbol...
       for (symptr = symbol[0];
            *str && !isspace(*str) && symptr < (symbol[0] + sizeof(symbol[0]) - 1);
-           *symptr++ = *str++);
+           *symptr++ = *str++) {}
       *symptr = '\0';
       if (isspace(*str)) str++;
       symwidth[0] = (w < h ? w : h);
Index: src/fl_rect.cxx
===================================================================
--- src/fl_rect.cxx	(revision 11211)
+++ src/fl_rect.cxx	(working copy)
@@ -541,6 +541,7 @@
 
 void Fl_Graphics_Driver::restore_clip() {
   fl_clip_state_number++;
+  if (!fl_gc) return;
   Fl_Region r = rstack[rstackptr];
 #if defined(USE_X11)
   if (r) XSetRegion(fl_display, fl_gc, r);
Index: src/fl_set_font.cxx
===================================================================
--- src/fl_set_font.cxx	(revision 11211)
+++ src/fl_set_font.cxx	(working copy)
@@ -88,6 +88,8 @@
 #ifdef __APPLE__
   if (!fl_fonts) fl_fonts = Fl_X::calc_fl_fonts();
 #endif
+  if (fnum >= (table_size ? table_size : FL_FREE_FONT))
+    return 0;
   return fl_fonts[fnum].name;
 }
 
Index: src/fl_utf.c
===================================================================
--- src/fl_utf.c	(revision 11211)
+++ src/fl_utf.c	(working copy)
@@ -130,7 +130,7 @@
 */
 unsigned fl_utf8decode(const char* p, const char* end, int* len)
 {
-  unsigned char c = *(unsigned char*)p;
+  unsigned char c = *(const unsigned char*)p;
   if (c < 0x80) {
     if (len) *len = 1;
     return c;
@@ -149,17 +149,17 @@
       ((p[0] & 0x1f) << 6) +
       ((p[1] & 0x3f));
   } else if (c == 0xe0) {
-    if (((unsigned char*)p)[1] < 0xa0) goto FAIL;
+    if (((const unsigned char*)p)[1] < 0xa0) goto FAIL;
     goto UTF8_3;
 #if STRICT_RFC3629
   } else if (c == 0xed) {
     /* RFC 3629 says surrogate chars are illegal. */
-    if (((unsigned char*)p)[1] >= 0xa0) goto FAIL;
+    if (((const unsigned char*)p)[1] >= 0xa0) goto FAIL;
     goto UTF8_3;
   } else if (c == 0xef) {
     /* 0xfffe and 0xffff are also illegal characters */
-    if (((unsigned char*)p)[1]==0xbf &&
-	((unsigned char*)p)[2]>=0xbe) goto FAIL;
+    if (((const unsigned char*)p)[1]==0xbf &&
+	((const unsigned char*)p)[2]>=0xbe) goto FAIL;
     goto UTF8_3;
 #endif
   } else if (c < 0xf0) {
@@ -171,7 +171,7 @@
       ((p[1] & 0x3f) << 6) +
       ((p[2] & 0x3f));
   } else if (c == 0xf0) {
-    if (((unsigned char*)p)[1] < 0x90) goto FAIL;
+    if (((const unsigned char*)p)[1] < 0x90) goto FAIL;
     goto UTF8_4;
   } else if (c < 0xf4) {
   UTF8_4:
@@ -180,8 +180,8 @@
 #if STRICT_RFC3629
     /* RFC 3629 says all codes ending in fffe or ffff are illegal: */
     if ((p[1]&0xf)==0xf &&
-	((unsigned char*)p)[2] == 0xbf &&
-	((unsigned char*)p)[3] >= 0xbe) goto FAIL;
+	((const unsigned char*)p)[2] == 0xbf &&
+	((const unsigned char*)p)[3] >= 0xbe) goto FAIL;
 #endif
     return
       ((p[0] & 0x07) << 18) +
@@ -189,7 +189,7 @@
       ((p[2] & 0x3f) << 6) +
       ((p[3] & 0x3f));
   } else if (c == 0xf4) {
-    if (((unsigned char*)p)[1] > 0x8f) goto FAIL; /* after 0x10ffff */
+    if (((const unsigned char*)p)[1] > 0x8f) goto FAIL; /* after 0x10ffff */
     goto UTF8_4;
   } else {
   FAIL:
@@ -321,9 +321,9 @@
     return 4;
   } else {
     /* encode 0xfffd: */
-    buf[0] = 0xefU;
-    buf[1] = 0xbfU;
-    buf[2] = 0xbdU;
+    buf[0] = (char)0xef;
+    buf[1] = (char)0xbf;
+    buf[2] = (char)0xbd;
     return 3;
   }
 }
@@ -556,7 +556,7 @@
   if (dstlen) for (;;) {
     unsigned char c;
     if (p >= e) {dst[count] = 0; return count;}
-    c = *(unsigned char*)p;
+    c = *(const unsigned char*)p;
     if (c < 0xC2) { /* ascii or bad code */
       dst[count] = c;
       p++;
@@ -704,7 +704,7 @@
   if (dstlen) for (;;) {
     unsigned char ucs;
     if (p >= e) {dst[count] = 0; return count;}
-    ucs = *(unsigned char*)p++;
+    ucs = *(const unsigned char*)p++;
     if (ucs < 0x80U) {
       dst[count++] = ucs;
       if (count >= dstlen) {dst[count-1] = 0; break;}
@@ -716,7 +716,7 @@
   }
   /* we filled dst, measure the rest: */
   while (p < e) {
-    unsigned char ucs = *(unsigned char*)p++;
+    unsigned char ucs = *(const unsigned char*)p++;
     if (ucs < 0x80U) {
       count++;
     } else {
@@ -806,7 +806,7 @@
     wchar_t lbuf[1024];
     wchar_t* buf = lbuf;
     unsigned length = fl_utf8towc(src, srclen, buf, 1024);
-    int ret; // note: wcstombs() returns unsigned(length) or unsigned(-1)
+    int ret; /* note: wcstombs() returns unsigned(length) or unsigned(-1) */
     if (length >= 1024) {
       buf = (wchar_t*)(malloc((length+1)*sizeof(wchar_t)));
       fl_utf8towc(src, srclen, buf, length+1);
Index: src/scandir.c
===================================================================
--- src/scandir.c	(revision 11211)
+++ src/scandir.c	(working copy)
@@ -27,6 +27,9 @@
 #  endif /* HAVE_SCANDIR */
 #endif
 
+/* Avoid "ISO C forbids an empty translation unit" warning */
+typedef int dummy;
+
 /*
  * End of "$Id$".
  */
Index: src/screen_xywh.cxx
===================================================================
--- src/screen_xywh.cxx	(revision 11211)
+++ src/screen_xywh.cxx	(working copy)
@@ -326,7 +326,7 @@
   if (num_screens < 0) screen_init();
   
   for (int i = 0; i < num_screens; i ++) {
-    int sx, sy, sw, sh;
+    int sx = 0, sy = 0, sw = 0, sh = 0;
     Fl::screen_xywh(sx, sy, sw, sh, i);
     if ((x >= sx) && (x < (sx+sw)) && (y >= sy) && (y < (sy+sh))) {
       screen = i;
Index: src/vsnprintf.c
===================================================================
--- src/vsnprintf.c	(revision 11211)
+++ src/vsnprintf.c	(working copy)
@@ -254,7 +254,7 @@
   if (bufptr) *bufptr = '\0';
 
   return (bytes);
-#endif //HAVE_VSNPRINTF
+#endif /* HAVE_VSNPRINTF */
 }
 
 int fl_snprintf(char* str, size_t size, const char* fmt, ...) {
Index: src/xutf8/case.c
===================================================================
--- src/xutf8/case.c	(revision 11211)
+++ src/xutf8/case.c	(working copy)
@@ -19,6 +19,10 @@
  * This file is required on all platforms for UTF-8 support
  */
 
+#if !defined(WIN32) && !defined(__APPLE__)
+#  include "../Xutf8.h"
+#endif /* !defined(WIN32) && !defined(__APPLE__) */
+
 #include "headers/case.h"
 #include <stdlib.h>
 
Index: src/xutf8/is_spacing.c
===================================================================
--- src/xutf8/is_spacing.c	(revision 11211)
+++ src/xutf8/is_spacing.c	(working copy)
@@ -18,6 +18,10 @@
  * This file is required on all platforms for utf8 support
  */
 
+#if !defined(WIN32) && !defined(__APPLE__)
+#  include "../Xutf8.h"
+#endif /* !defined(WIN32) && !defined(__APPLE__) */
+
 #include "headers/spacing.h"
 
 unsigned short 
Index: src/xutf8/utf8Wrap.c
===================================================================
--- src/xutf8/utf8Wrap.c	(revision 11211)
+++ src/xutf8/utf8Wrap.c	(working copy)
@@ -379,7 +379,7 @@
       ptr = buf + 128;
     }
 
-    ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+    ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
 
     if (ulen < 1) ulen = 1;
 
@@ -496,7 +496,7 @@
       i = 0;
     }
 
-    ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+    ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
 
     if (ulen < 1) ulen = 1;
 
@@ -629,7 +629,7 @@
       i = 0;
     }
 
-    ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+    ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
 
     if (ulen < 1) ulen = 1;
 
@@ -752,7 +752,7 @@
       i = 0;
     }
 
-    ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+    ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
 
     if (ulen < 1) ulen = 1;
 
Index: test/checkers.cxx
===================================================================
--- test/checkers.cxx	(revision 11211)
+++ test/checkers.cxx	(working copy)
@@ -500,7 +500,7 @@
   node* n = f->son;
   if (!n->jump && n->brother) {if (level<1) return(1); level--;}
   int i;
-  node* sons[32]; for (i=0; (sons[i++] = n); n = n->brother);
+  node* sons[32]; for (i=0; (sons[i++] = n); n = n->brother) {}
   int ret = 1;
   for (i=0; ret && (n = sons[i++]);) {
     makemove(n);
