summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx2
-rw-r--r--src/Fl_File_Chooser2.cxx2
-rw-r--r--src/Fl_File_Icon.cxx2
-rw-r--r--src/Fl_Help_View.cxx2
-rw-r--r--src/Fl_Input_.cxx2
-rw-r--r--src/Fl_XBM_Image.cxx2
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx6
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx8
-rw-r--r--src/filename_absolute.cxx2
-rw-r--r--src/filename_expand.cxx2
-rw-r--r--src/fl_call_main.c4
-rw-r--r--src/fl_draw.cxx2
-rw-r--r--src/fl_utf.c34
-rw-r--r--src/scandir.c3
-rw-r--r--src/vsnprintf.c2
-rw-r--r--src/xutf8/case.c4
-rw-r--r--src/xutf8/is_right2left.c2
-rw-r--r--src/xutf8/is_spacing.c4
-rw-r--r--src/xutf8/keysym2Ucs.c2
-rw-r--r--src/xutf8/lcUniConv/cp936ext.h8
-rw-r--r--src/xutf8/utf8Input.c2
-rw-r--r--src/xutf8/utf8Utils.c2
-rw-r--r--src/xutf8/utf8Wrap.c10
23 files changed, 62 insertions, 47 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index a27a187fd..c086d63e7 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -870,7 +870,7 @@ void Fl::remove_handler(Fl_Event_Handler ha) {
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) {/*empty*/}
if (l) {
// Found it, so remove it from the list...
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx
index 72ecac18e..fea0b3328 100644
--- a/src/Fl_File_Chooser2.cxx
+++ b/src/Fl_File_Chooser2.cxx
@@ -1410,7 +1410,7 @@ Fl_File_Chooser::update_preview()
if (*ptr || ptr == preview_text_) {
for (ptr = preview_text_;
*ptr && (isprint(*ptr & 255) || isspace(*ptr & 255));
- ptr ++);
+ ptr ++) {/*empty*/}
}
if (*ptr || ptr == preview_text_) {
diff --git a/src/Fl_File_Icon.cxx b/src/Fl_File_Icon.cxx
index e6cfe76ea..08832a7f3 100644
--- a/src/Fl_File_Icon.cxx
+++ b/src/Fl_File_Icon.cxx
@@ -125,7 +125,7 @@ Fl_File_Icon::~Fl_File_Icon() {
// 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_) {/*empty*/}
// Remove the icon from the list as needed...
if (current)
diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx
index 9800cb22c..4ae4f298c 100644
--- a/src/Fl_Help_View.cxx
+++ b/src/Fl_Help_View.cxx
@@ -1268,7 +1268,7 @@ void Fl_Help_View::format() {
// Copy the title in the document...
for (s = title_;
*ptr != '<' && *ptr && s < (title_ + sizeof(title_) - 1);
- *s++ = *ptr++);
+ *s++ = *ptr++) {/*empty*/}
*s = '\0';
s = buf;
diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx
index 085ca80a6..f80b59c8e 100644
--- a/src/Fl_Input_.cxx
+++ b/src/Fl_Input_.cxx
@@ -1220,7 +1220,7 @@ int Fl_Input_::static_value(const char* str, int len) {
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++) {/*empty*/}
if (i==size_ && i==len) return 0;
}
minimal_update(i);
diff --git a/src/Fl_XBM_Image.cxx b/src/Fl_XBM_Image.cxx
index a2922238a..40afbbef9 100644
--- a/src/Fl_XBM_Image.cxx
+++ b/src/Fl_XBM_Image.cxx
@@ -90,7 +90,7 @@ Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) {
*ptr++ = (uchar)t;
i ++;
}
- while (*a && *a++ != ',');
+ while (*a && *a++ != ',') {/*empty*/}
}
}
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
index ab416b134..fdff2fe1b 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
@@ -243,8 +243,10 @@ void Fl_GDI_Graphics_Driver::pop_clip() {
void Fl_GDI_Graphics_Driver::restore_clip() {
fl_clip_state_number++;
- Fl_Region r = rstack[rstackptr];
- SelectClipRgn(gc_, r); //if r is NULL, clip is automatically cleared
+ if (gc_) {
+ Fl_Region r = rstack[rstackptr];
+ SelectClipRgn(gc_, r); // if r is NULL, clip is automatically cleared
+ }
}
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
index c6ca9b674..2d239cc0e 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
@@ -339,9 +339,11 @@ void Fl_Xlib_Graphics_Driver::pop_clip() {
void Fl_Xlib_Graphics_Driver::restore_clip() {
fl_clip_state_number++;
- Fl_Region r = rstack[rstackptr];
- if (r) XSetRegion(fl_display, gc_, r);
- else XSetClipMask(fl_display, gc_, 0);
+ if (gc_) {
+ Fl_Region r = rstack[rstackptr];
+ if (r) XSetRegion(fl_display, gc_, r);
+ else XSetClipMask(fl_display, gc_, 0);
+ }
}
#endif // FL_CFG_GFX_XLIB_RECT_CXX
diff --git a/src/filename_absolute.cxx b/src/filename_absolute.cxx
index 867f2af04..be1bb0888 100644
--- a/src/filename_absolute.cxx
+++ b/src/filename_absolute.cxx
@@ -83,7 +83,7 @@ int fl_filename_absolute(char *to, int tolen, const char *from) {
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--) {/*empty*/}
if (b < temp) break;
a = b;
start += 3;
diff --git a/src/filename_expand.cxx b/src/filename_expand.cxx
index 383e5dcd4..ff687f7d5 100644
--- a/src/filename_expand.cxx
+++ b/src/filename_expand.cxx
@@ -70,7 +70,7 @@ int fl_filename_expand(char *to,int tolen, const char *from) {
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++) {/*empty*/} // find next slash
const char *value = 0; // this will point at substitute value
switch (*a) {
case '~': // a home directory name
diff --git a/src/fl_call_main.c b/src/fl_call_main.c
index 113aec17c..8c21c9307 100644
--- a/src/fl_call_main.c
+++ b/src/fl_call_main.c
@@ -1,7 +1,7 @@
/*
* "$Id$"
*
- * Copyright 1998-2010 by Bill Spitzak and others.
+ * Copyright 1998-2016 by Bill Spitzak and others.
*
* fl_call_main() calls main() for you Windows people. Needs to be done in C
* because Borland C++ won't let you call main() from C++.
@@ -37,7 +37,7 @@
* Microsoft(r) Windows(r) that allows for it.
*/
-#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_System_Driver - platform main()
+#if defined(WIN32) || defined(__APPLE__) /* PORTME: Fl_System_Driver - platform main() */
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: implement 'main()' here if your platform provides another app entry point"
#else
diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx
index e74df72d2..bf02f9d8e 100644
--- a/src/fl_draw.cxx
+++ b/src/fl_draw.cxx
@@ -163,7 +163,7 @@ void fl_draw(
// Start with a symbol...
for (symptr = symbol[0];
*str && !isspace(*str) && symptr < (symbol[0] + sizeof(symbol[0]) - 1);
- *symptr++ = *str++);
+ *symptr++ = *str++) {/*empty*/}
*symptr = '\0';
if (isspace(*str)) str++;
symwidth[0] = (w < h ? w : h);
diff --git a/src/fl_utf.c b/src/fl_utf.c
index 8cd0b6918..bfb5b4f02 100644
--- a/src/fl_utf.c
+++ b/src/fl_utf.c
@@ -22,7 +22,7 @@
#include <string.h>
#include <stdlib.h>
-#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode
+#if defined(WIN32) || defined(__APPLE__) /* PORTME: Fl_Screen_Driver - platform unicode */
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: look out for some unicode functions here. Default should be fine though."
#else
@@ -136,7 +136,7 @@ static unsigned short cp1252[32] = {
*/
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;
@@ -155,17 +155,17 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
((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) {
@@ -177,7 +177,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
((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:
@@ -186,8 +186,8 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
#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) +
@@ -195,7 +195,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
((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:
@@ -327,9 +327,9 @@ int fl_utf8encode(unsigned ucs, char* buf) {
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;
}
}
@@ -562,7 +562,7 @@ unsigned fl_utf8toa(const char* src, unsigned srclen,
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++;
@@ -710,7 +710,7 @@ unsigned fl_utf8froma(char* dst, unsigned dstlen,
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;}
@@ -722,7 +722,7 @@ unsigned fl_utf8froma(char* dst, unsigned dstlen,
}
/* 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 {
@@ -812,7 +812,7 @@ unsigned fl_utf8to_mb(const char* src, unsigned srclen,
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);
diff --git a/src/scandir.c b/src/scandir.c
index c08e48f0c..c3d5d63a0 100644
--- a/src/scandir.c
+++ b/src/scandir.c
@@ -27,6 +27,9 @@
# endif /* HAVE_SCANDIR */
#endif
+/* Avoid "ISO C forbids an empty translation unit" warning */
+typedef int dummy;
+
/*
* End of "$Id$".
*/
diff --git a/src/vsnprintf.c b/src/vsnprintf.c
index 0fae17ca5..a4e5bc9c0 100644
--- a/src/vsnprintf.c
+++ b/src/vsnprintf.c
@@ -254,7 +254,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) {
if (bufptr) *bufptr = '\0';
return (bytes);
-#endif //HAVE_VSNPRINTF
+#endif /* HAVE_VSNPRINTF */
}
int fl_snprintf(char* str, size_t size, const char* fmt, ...) {
diff --git a/src/xutf8/case.c b/src/xutf8/case.c
index f55d08e36..8efc0e397 100644
--- a/src/xutf8/case.c
+++ b/src/xutf8/case.c
@@ -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>
diff --git a/src/xutf8/is_right2left.c b/src/xutf8/is_right2left.c
index d44f05937..e79a55f25 100644
--- a/src/xutf8/is_right2left.c
+++ b/src/xutf8/is_right2left.c
@@ -14,7 +14,7 @@
* http://www.fltk.org/str.php
*/
-#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode
+#if defined(WIN32) || defined(__APPLE__) /* PORTME: Fl_Screen_Driver - platform unicode */
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: utf8 functionality"
#else
diff --git a/src/xutf8/is_spacing.c b/src/xutf8/is_spacing.c
index c97222420..6e3d6abd3 100644
--- a/src/xutf8/is_spacing.c
+++ b/src/xutf8/is_spacing.c
@@ -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
diff --git a/src/xutf8/keysym2Ucs.c b/src/xutf8/keysym2Ucs.c
index b83b5ef8f..b811d4054 100644
--- a/src/xutf8/keysym2Ucs.c
+++ b/src/xutf8/keysym2Ucs.c
@@ -17,7 +17,7 @@
#define KEYSYM2UCS_INCLUDED
#if defined(WIN32)
-#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode
+#elif defined(__APPLE__) /* PORTME: Fl_Screen_Driver - platform unicode */
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h?"
#else
diff --git a/src/xutf8/lcUniConv/cp936ext.h b/src/xutf8/lcUniConv/cp936ext.h
index 8d0207ff8..64bd0fc97 100644
--- a/src/xutf8/lcUniConv/cp936ext.h
+++ b/src/xutf8/lcUniConv/cp936ext.h
@@ -3,7 +3,7 @@
*
* Character encoding support for the Fast Light Tool Kit (FLTK).
*
- * Copyright 1998-2010 by Bill Spitzak and others.
+ * Copyright 1998-2016 by Bill Spitzak and others.
*
* This library is free software. Distribution and use rights are outlined in
* the file "COPYING" which should have been included with this file. If this
@@ -16,9 +16,9 @@
* http://www.fltk.org/str.php
*/
-#if defined(WIN32) || defined(__APPLE__) // PORTME: is this really needed? It's huge!
+#if defined(WIN32) || defined(__APPLE__) /* PORTME: is this really needed? It's huge! */
- // not needed
+ /* not needed */
#elif defined(FL_PORTING)
@@ -6251,7 +6251,7 @@ cp936ext_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
#endif /* CP936 */
-#endif /* __APPLE__ WIN32 */ // PORTME: Unicode stuff
+#endif /* __APPLE__ WIN32 */ /* PORTME: Unicode stuff */
/*
* End of "$Id$".
diff --git a/src/xutf8/utf8Input.c b/src/xutf8/utf8Input.c
index 2eef627aa..bba400271 100644
--- a/src/xutf8/utf8Input.c
+++ b/src/xutf8/utf8Input.c
@@ -15,7 +15,7 @@
*/
#if defined(WIN32)
-#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode
+#elif defined(__APPLE__) /* PORTME: Fl_Screen_Driver - platform unicode */
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: do you want to include Xutf8.h?"
#else
diff --git a/src/xutf8/utf8Utils.c b/src/xutf8/utf8Utils.c
index 0af7bf48c..41343f459 100644
--- a/src/xutf8/utf8Utils.c
+++ b/src/xutf8/utf8Utils.c
@@ -14,7 +14,7 @@
* http://www.fltk.org/str.php
*/
-#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode
+#if defined(WIN32) || defined(__APPLE__) /* PORTME: Fl_Screen_Driver - platform unicode */
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: utf8"
#else
diff --git a/src/xutf8/utf8Wrap.c b/src/xutf8/utf8Wrap.c
index cbff3ecb4..27e048cfe 100644
--- a/src/xutf8/utf8Wrap.c
+++ b/src/xutf8/utf8Wrap.c
@@ -14,7 +14,7 @@
* http://www.fltk.org/str.php
*/
-#if defined(WIN32) || defined(__APPLE__) // PORTME: Fl_Screen_Driver - platform unicode
+#if defined(WIN32) || defined(__APPLE__) /* PORTME: Fl_Screen_Driver - platform unicode */
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: utf8"
#else
@@ -389,7 +389,7 @@ XUtf8DrawRtlString(Display *display,
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;
@@ -506,7 +506,7 @@ XUtf8DrawString(Display *display,
i = 0;
}
- ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+ ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
if (ulen < 1) ulen = 1;
@@ -639,7 +639,7 @@ XUtf8_measure_extents(
i = 0;
}
- ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+ ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
if (ulen < 1) ulen = 1;
@@ -762,7 +762,7 @@ XUtf8TextWidth(XUtf8FontStruct *font_set,
i = 0;
}
- ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+ ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
if (ulen < 1) ulen = 1;