]> git.saurik.com Git - wxWidgets.git/commitdiff
first round of Intel compiler warning fixes: down from a few thousands just to slight...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 25 Sep 2005 19:59:19 +0000 (19:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 25 Sep 2005 19:59:19 +0000 (19:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

86 files changed:
build/bakefiles/files.bkl
configure
configure.in
include/wx/app.h
include/wx/build.h
include/wx/dataobj.h
include/wx/defs.h
include/wx/dynarray.h
include/wx/gtk/tglbtn.h
include/wx/gtk1/tglbtn.h
include/wx/longlong.h
include/wx/math.h
include/wx/motif/font.h
include/wx/platform.h
include/wx/ptr_scpd.h
include/wx/unix/private.h [new file with mode: 0644]
src/common/appbase.cpp
src/common/cshelp.cpp
src/common/datetime.cpp
src/common/datstrm.cpp
src/common/debugrpt.cpp
src/common/dynarray.cpp
src/common/extended.c
src/common/ffile.cpp
src/common/fileconf.cpp
src/common/filename.cpp
src/common/fmapbase.cpp
src/common/intl.cpp
src/common/longlong.cpp
src/common/mstream.cpp
src/common/popupcmn.cpp
src/common/sckaddr.cpp
src/common/socket.cpp
src/common/strconv.cpp
src/common/stream.cpp
src/common/string.cpp
src/common/txtstrm.cpp
src/common/uri.cpp
src/generic/accel.cpp
src/generic/datectlg.cpp
src/generic/dirdlgg.cpp
src/generic/filedlgg.cpp
src/generic/grid.cpp
src/generic/laywin.cpp
src/generic/listctrl.cpp
src/generic/prntdlgg.cpp
src/generic/splash.cpp
src/gtk/app.cpp
src/gtk/bitmap.cpp
src/gtk/combobox.cpp
src/gtk/dcclient.cpp
src/gtk/eggtrayicon.c
src/gtk/listbox.cpp
src/gtk/scrolwin.cpp
src/gtk/settings.cpp
src/gtk/tbargtk.cpp
src/gtk/win_gtk.c
src/gtk/window.cpp
src/gtk1/app.cpp
src/gtk1/bitmap.cpp
src/gtk1/combobox.cpp
src/gtk1/dcclient.cpp
src/gtk1/eggtrayicon.c
src/gtk1/listbox.cpp
src/gtk1/scrolwin.cpp
src/gtk1/settings.cpp
src/gtk1/tbargtk.cpp
src/gtk1/win_gtk.c
src/gtk1/window.cpp
src/html/helpdata.cpp
src/html/htmlcell.cpp
src/html/htmlpars.cpp
src/html/htmlwin.cpp
src/html/m_image.cpp
src/motif/evtloop.cpp
src/unix/dlunix.cpp
src/unix/fontenum.cpp
src/unix/gsocket.cpp
src/unix/joystick.cpp
src/unix/mimetype.cpp
src/unix/threadpsx.cpp
src/unix/utilsunx.cpp
src/unix/utilsx11.cpp
src/x11/evtloop.cpp
src/xrc/xmlres.cpp
utils/wxrc/wxrc.cpp

index 372adc9c8c444a2b3ecedebc149078a12a3c94fe..3f55074e72fbb1c72d8cf211735c10a9ae68e686 100644 (file)
@@ -72,6 +72,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/unix/execute.h
     wx/unix/mimetype.h
     wx/unix/pipe.h
+    wx/unix/private.h
     wx/unix/stackwalk.h
     wx/unix/stdpaths.h
 </set>
index ed545dfce9acd5c479214291908586076f7a1bf8..50b6b3202d4d1f0999356a446e6c9651d7e703f0 100755 (executable)
--- a/configure
+++ b/configure
@@ -14043,7 +14043,6 @@ if test "x$XLCXX" = "xyes" -a "x$USE_AIX" = "x1"; then
     CXXFLAGS="$CXXFLAGS -qunique"
 fi
 
-
 case "${host}" in
   powerpc-*-darwin* )
     echo "$as_me:$LINENO: checking if __POWERPC__ is already defined" >&5
 INCLUDES="-I\${top_builddir}lib/wx/include/${TOOLCHAIN_FULLNAME} \
 -I\${top_srcdir}/include $TOOLKIT_INCLUDE"
 
-if test "$GXX" = yes ; then
-        CWARNINGS="-Wall -Wundef"
-    CXXWARNINGS="$CWARNINGS -Wno-ctor-dtor-privacy"
+if test "$GCC" = yes ; then
+                                        CWARNINGS="-Wall -wd810,869,981,1418,1572,1684"
+elif test "$GCC" = yes ; then
+    CWARNINGS="-Wall -Wundef"
+fi
+
+if test "$INTELCXX" = yes ; then
+                                                            CXXWARNINGS="-Wall -wd279,383,444,869,981,1418,1419"
+elif test "$GXX" = yes ; then
+        CXXWARNINGS="-Wall -Wundef -Wno-ctor-dtor-privacy"
 fi
 
 EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE"
index 2832f1d18014210447f7a6cd4d4548bf3d5495dc..50e59641de9bec0ca86180099d9fe9ed6149e944 100644 (file)
@@ -1517,7 +1517,6 @@ if test "x$XLCXX" = "xyes" -a "x$USE_AIX" = "x1"; then
     CXXFLAGS="$CXXFLAGS -qunique"
 fi
 
-
 dnl This case is for PowerPC OS X vs. everything else
 case "${host}" in
   powerpc-*-darwin* )
@@ -6850,10 +6849,42 @@ INCLUDES="-I\${top_builddir}lib/wx/include/${TOOLCHAIN_FULLNAME} \
 -I\${top_srcdir}/include $TOOLKIT_INCLUDE"
 
 dnl C/C++ compiler options used to compile wxWidgets
-if test "$GXX" = yes ; then
-    dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
+dnl
+dnl check for icc before gcc as icc is also recognized as gcc
+if test "$GCC" = yes ; then
+    dnl Warnings which can't be easily suppressed in C code are disabled:
+    dnl
+    dnl     remark #810: conversion from "x" to "y" may lose significant bits
+    dnl     remark #869: parameter "foo" was never referenced
+    dnl     remark #1572: floating-point equality and inequality comparisons
+    dnl                   are unreliable
+    dnl     remark #1684: conversion from pointer to same-sized integral type
+    dnl
+    dnl (for others see below)
+    CWARNINGS="-Wall -wd810,869,981,1418,1572,1684"
+elif test "$GCC" = yes ; then
     CWARNINGS="-Wall -Wundef"
-    CXXWARNINGS="$CWARNINGS -Wno-ctor-dtor-privacy" 
+fi
+
+if test "$INTELCXX" = yes ; then
+    dnl Intel compiler gives some warnings which simply can't be worked
+    dnl around or of which we have too many (810, 869) so it's impractical to
+    dnl keep them enabled even if in theory it would be nice and some others
+    dnl (279) are generated for standard macros and so there is nothing we can
+    dnl do about them
+    dnl
+    dnl     remark #279: controlling expression is constant
+    dnl     remark #383: value copied to temporary, reference to temporary used
+    dnl     remark #444: destructor for base class "xxx" is not virtual
+    dnl     remark #810: conversion from "x" to "y" may lose significant bits
+    dnl     remark #869: parameter "foo" was never referenced
+    dnl     remark #981: operands are evaluated in unspecified order
+    dnl     remark #1418: external definition with no prior declaration
+    dnl     remark #1419: external declaration in primary source file
+    CXXWARNINGS="-Wall -wd279,383,444,869,981,1418,1419"
+elif test "$GXX" = yes ; then
+    dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
+    CXXWARNINGS="-Wall -Wundef -Wno-ctor-dtor-privacy" 
 fi
 
 EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE"
index 02c5aee54d3bfee1fada5b7cb6a710af94adaf63..4508ef1bca30d156a784b015cda2b5a148538e4f 100644 (file)
@@ -661,6 +661,7 @@ public:
     }                                                                       \
     wxAppInitializer                                                        \
         wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp);        \
+    DECLARE_APP(appname)                                                    \
     appname& wxGetApp() { return *(appname *)wxTheApp; }
 
 // Same as IMPLEMENT_APP() normally but doesn't include themes support in
@@ -684,5 +685,13 @@ public:
 // function
 #define DECLARE_APP(appname) extern appname& wxGetApp();
 
+
+// declare the stuff defined by IMPLEMENT_APP() macro, it's not really needed
+// anywhere else but at the very least it suppresses icc warnings about
+// defining extern symbols without prior declaration, and it shouldn't do any
+// harm
+extern wxAppConsole *wxCreateApp();
+extern wxAppInitializer wxTheAppInitializer;
+
 #endif // _WX_APP_H_BASE_
 
index b64fb8f5d67f66064010afa77912d238f26aa9ca..6e0a6dc8ceaca93c79999341df2d9d759628783a 100644 (file)
 // Use this macro to check build options. Adding it to a file in DLL will
 // ensure that the DLL checks build options in same way IMPLEMENT_APP() does.
 #define WX_CHECK_BUILD_OPTIONS(libName)                                 \
-    static bool wxCheckBuildOptions()                                   \
+    static struct wxBuildOptionsChecker                                 \
     {                                                                   \
-        wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE,     \
-                                        libName);                       \
-        return true;                                                    \
-    }                                                                   \
-    static bool gs_buildOptionsCheck = wxCheckBuildOptions();
+        wxBuildOptionsChecker()                                         \
+        {                                                               \
+            wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
+                                            libName);                   \
+        }                                                               \
+    } gs_buildOptionsCheck;
 
 
 #if WXWIN_COMPATIBILITY_2_4
index 57abf2ed311f10ca9995a23e5af1b4597eb185d9..12c2101f10e0a2960982d94ce6c33ac102df21df 100644 (file)
@@ -318,7 +318,13 @@ public:
     // ctor: you can specify the text here or in SetText(), or override
     // GetText()
     wxTextDataObject(const wxString& text = wxEmptyString)
-        : wxDataObjectSimple(wxUSE_UNICODE?wxDF_UNICODETEXT:wxDF_TEXT),
+        : wxDataObjectSimple(
+#if wxUSE_UNICODE
+                             wxDF_UNICODETEXT
+#else
+                             wxDF_TEXT
+#endif
+                            ),
           m_text(text)
         {
         }
@@ -332,19 +338,8 @@ public:
     // implement base class pure virtuals
     // ----------------------------------
 
-#if wxUSE_UNICODE && defined(__WXGTK20__)
-    virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; }
-    virtual void GetAllFormats(wxDataFormat *formats,
-                               wxDataObjectBase::Direction WXUNUSED(dir) = Get) const;
-
-    virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); }
-    virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); }
-    virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); }
-
-    size_t GetDataSize(const wxDataFormat& format) const;
-    bool GetDataHere(const wxDataFormat& format, void *pBuf) const;
-    bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf);
-#elif wxUSE_UNICODE && defined(__WXMAC__)
+    // some platforms have 2 and not 1 format for text data
+#if wxUSE_UNICODE && (defined(__WXGTK20__) || defined(__WXMAC__))
     virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; }
     virtual void GetAllFormats(wxDataFormat *formats,
                                wxDataObjectBase::Direction WXUNUSED(dir) = Get) const;
index b18f62f9d5e2dc0d5cc56104cf87abf1e521797f..53d8655117f171be9dd02c30084245403a70bebe 100644 (file)
@@ -297,7 +297,23 @@ typedef int wxWindowID;
    truncate from a larger to smaller type, static_cast<> can't be used for it
    as it results in warnings when using some compilers (SGI mipspro for example)
  */
-#define wx_truncate_cast(t, x) ((t)(x))
+#if defined(__INTELC__) && defined(__cplusplus)
+    template <typename T, typename X>
+    inline T wx_truncate_cast_impl(X x)
+    {
+        #pragma warning(push)
+        /* explicit conversion of a 64-bit integral type to a smaller integral type */
+        #pragma warning(disable: 1683)
+
+        return (T)x;
+
+        #pragma warning(pop)
+    }
+
+    #define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
+#else /* !__INTELC__ */
+    #define wx_truncate_cast(t, x) ((t)(x))
+#endif /* __INTELC__/!__INTELC__ */
 
 /* for consistency with wxStatic/DynamicCast defined in wx/object.h */
 #define wxConstCast(obj, className) wx_const_cast(className *, obj)
@@ -844,29 +860,43 @@ inline wxUIntPtr wxPtrToUInt(const void *p)
     /*
        VC++ 7.1 gives warnings about casts such as below even when they're
        explicit with /Wp64 option, suppress them as we really know what we're
-       doing here
+       doing here. Same thing with icc with -Wall.
      */
-#ifdef __VISUALC__
-    #pragma warning(disable: 4311) /* pointer truncation from '' to '' */
+#if defined(__VISUALC__) || defined(__INTELC__)
+    #pragma warning(push)
+    #ifdef __VISUALC__
+        /* pointer truncation from '' to '' */
+        #pragma warning(disable: 4311)
+    #elif defined(__INTELC__)
+        /* conversion from pointer to same-sized integral type */
+        #pragma warning(disable: 1684)
+    #endif
 #endif
 
     return wx_reinterpret_cast(wxUIntPtr, p);
 
-#ifdef __VISUALC__
-    #pragma warning(default: 4311)
+#if defined(__VISUALC__) || defined(__INTELC__)
+    #pragma warning(pop)
 #endif
 }
 
 inline void *wxUIntToPtr(wxUIntPtr p)
 {
-#ifdef __VISUALC__
-    #pragma warning(disable: 4312) /* conversion to type of greater size */
+#if defined(__VISUALC__) || defined(__INTELC__)
+    #pragma warning(push)
+    #ifdef __VISUALC__
+        /* conversion to type of greater size */
+        #pragma warning(disable: 4312)
+    #elif defined(__INTELC__)
+        /* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
+        #pragma warning(disable: 171)
+    #endif
 #endif
 
     return wx_reinterpret_cast(void *, p);
 
-#ifdef __VISUALC__
-    #pragma warning(default: 4312)
+#if defined(__VISUALC__) || defined(__INTELC__)
+    #pragma warning(pop)
 #endif
 }
 #endif /*__cplusplus*/
index 4aaf0f8b42998a389344db3d7059a6da24b8f194..a70982e87c86b8e692df5ed5b9061ef81761f5ad 100644 (file)
@@ -967,10 +967,10 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE
 // append all element of one array to another one
 #define WX_APPEND_ARRAY(array, other)                                         \
     {                                                                         \
-        size_t count = (other).size();                                        \
-        for ( size_t n = 0; n < count; n++ )                                  \
+        size_t wxAAcnt = (other).size();                                      \
+        for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ )                    \
         {                                                                     \
-            (array).push_back((other)[n]);                                    \
+            (array).push_back((other)[wxAAn]);                                \
         }                                                                     \
     }
 
@@ -982,10 +982,10 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE
 //     count on it)!
 #define WX_CLEAR_ARRAY(array)                                                 \
     {                                                                         \
-        size_t count = (array).size();                                        \
-        for ( size_t n = 0; n < count; n++ )                                  \
+        size_t wxAAcnt = (array).size();                                      \
+        for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ )                    \
         {                                                                     \
-            delete (array)[n];                                                \
+            delete (array)[wxAAn];                                            \
         }                                                                     \
                                                                               \
         (array).clear();                                                      \
index 8aa54343148bc815e079e7d26dac7acd78f14bbf..98e28f1210984abc75a7fb2552510ce39e6d0422 100644 (file)
@@ -63,7 +63,8 @@ public:
     bool GetValue() const;
 
     // Set the label
-    void SetLabel(const wxBitmap& label);
+    virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
+    virtual void SetLabel(const wxBitmap& label);
     bool Enable(bool enable = TRUE);
 
     static wxVisualAttributes
index 8aa54343148bc815e079e7d26dac7acd78f14bbf..98e28f1210984abc75a7fb2552510ce39e6d0422 100644 (file)
@@ -63,7 +63,8 @@ public:
     bool GetValue() const;
 
     // Set the label
-    void SetLabel(const wxBitmap& label);
+    virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
+    virtual void SetLabel(const wxBitmap& label);
     bool Enable(bool enable = TRUE);
 
     static wxVisualAttributes
index 6d46642dcf5860224a847cc040a0c20ce20edb46..a318c78a2b6b0237759f873833330e1e9fedd235 100644 (file)
@@ -139,10 +139,10 @@ public:
     // accessors
         // get high part
     long GetHi() const
-        { return (long)(m_ll >> 32); }
+        { return wx_truncate_cast(long, m_ll >> 32); }
         // get low part
     unsigned long GetLo() const
-        { return (unsigned long)m_ll; }
+        { return wx_truncate_cast(unsigned long, m_ll); }
 
         // get absolute value
     wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); }
@@ -157,12 +157,12 @@ public:
         wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX),
                       _T("wxLongLong to long conversion loss of precision") );
 
-        return (long)m_ll;
+        return wx_truncate_cast(long, m_ll);
     }
 
 #if wxABI_VERSION >= 20602
         // convert to double
-    double ToDouble() const { return m_ll; }
+    double ToDouble() const { return wx_truncate_cast(double, m_ll); }
 #endif // ABI >= 2.6.2
 
     // don't provide implicit conversion to wxLongLong_t or we will have an
@@ -344,10 +344,10 @@ public:
     // accessors
         // get high part
     unsigned long GetHi() const
-        { return (unsigned long)(m_ll >> 32); }
+        { return wx_truncate_cast(unsigned long, m_ll >> 32); }
         // get low part
     unsigned long GetLo() const
-        { return (unsigned long)m_ll; }
+        { return wx_truncate_cast(unsigned long, m_ll); }
 
         // convert to native ulong long
     wxULongLong_t GetValue() const { return m_ll; }
@@ -358,7 +358,7 @@ public:
         wxASSERT_MSG( m_ll <= LONG_MAX,
                       _T("wxULongLong to long conversion loss of precision") );
 
-        return (unsigned long)m_ll;
+        return wx_truncate_cast(unsigned long, m_ll);
     }
 
     // operations
index 72628269cf7855d11caf4e8c278a9a42c8754e45..a32f1b090192dd8d18bd3e57d2ca218ea8c05588 100644 (file)
@@ -98,4 +98,17 @@ inline bool wxIsSameDouble(double x, double y) { return x == y; }
 #endif /* __cplusplus */
 
 
+#if wxUSE_APPLE_IEEE
+#ifdef __cplusplus
+    extern "C" {
+#endif
+    /* functions from common/extended.c */
+    extern wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes);
+    extern void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes);
+#ifdef __cplusplus
+    }
+#endif
+#endif /* wxUSE_APPLE_IEEE */
+
+
 #endif /* _WX_MATH_H_ */
index d18af9c5c87db42300c26ab30c1ff283ddc1076a..7c5efaf3a369b7a0f39b7dfef547b9a172ded96d 100644 (file)
@@ -13,7 +13,7 @@
 #define _WX_FONT_H_
 
 #if __WXMOTIF20__ && !__WXLESSTIF__
-    #define wxMOTIF_NEW_FONT_HANDLING 0 // safe default, change to 1 to enable
+    #define wxMOTIF_NEW_FONT_HANDLING 1 // safe default, change to 1 to enable
 #else
     #define wxMOTIF_NEW_FONT_HANDLING 0
 #endif
index 601f6d2ce0a231cc07cc98e7750fffee6b7dd75c..606ad4a8d9d7897ad0fc82134f3980ac90db7c6f 100644 (file)
 #    endif
 #endif
 
+#ifdef __INTEL_COMPILER
+#   define __INTELC__
+#endif
+
 /*
    We get "Large Files (ILP32) not supported in strict ANSI mode." #error
    from HP-UX standard headers when compiling with g++ without this:
index 8ab3f3797152ea2ae2f47cd40f6fa20bfada4f2a..2ebb6a67322782e0f4fcc5cddb44f508b880d1f3 100644 (file)
@@ -45,7 +45,7 @@
     #define wxPOST_NO_WARNING_SCOPE(name)
 #else
     #define wxPRE_NO_WARNING_SCOPE(name)  do
-    #define wxPOST_NO_WARNING_SCOPE(name) while ( 0 )
+    #define wxPOST_NO_WARNING_SCOPE(name) while ( wxFalse )
 #endif
 
 #define wxCHECKED_DELETE(ptr)                                                 \
diff --git a/include/wx/unix/private.h b/include/wx/unix/private.h
new file mode 100644 (file)
index 0000000..9d2e338
--- /dev/null
@@ -0,0 +1,47 @@
+///////////////////////////////////////////////////////////////////////////////
+// Name:        wx/unix/private.h
+// Purpose:     miscellaneous private things for Unix wx ports
+// Author:      Vadim Zeitlin
+// Created:     2005-09-25
+// RCS-ID:      $Id$
+// Copyright:   (c) 2005 Vadim Zeitlin <vadim@wxwindows.org>
+// Licence:     wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_PRIVATE_H_
+#define _WX_UNIX_PRIVATE_H_
+
+// standard linux headers produce many warnings when used with icc
+#if defined(__INTELC__) && defined(__LINUX__)
+    inline void wxFD_ZERO(fd_set *fds)
+    {
+        #pragma warning(push)
+        #pragma warning(disable:593)
+        FD_ZERO(fds);
+        #pragma warning(pop)
+    }
+
+    inline void wxFD_SET(int fd, fd_set *fds)
+    {
+        #pragma warning(push, 1)
+        #pragma warning(disable:1469)
+        FD_SET(fd, fds);
+        #pragma warning(pop)
+    }
+
+    inline bool wxFD_ISSET(int fd, fd_set *fds)
+    {
+        #pragma warning(push, 1)
+        #pragma warning(disable:1469)
+        return FD_ISSET(fd, fds);
+        #pragma warning(pop)
+    }
+#else // !__INTELC__
+    #define wxFD_ZERO(fds) FD_ZERO(fds)
+    #define wxFD_SET(fd, fds) FD_SET(fd, fds)
+    #define wxFD_ISSET(fd, fds) FD_ISSET(fd, fds)
+#endif // __INTELC__/!__INTELC__
+
+
+#endif // _WX_UNIX_PRIVATE_H_
+
index 701f23a34272f43a6bcf4e7867738fc92b045b5a..fe7471e1c7993d91938a105c2df9727b49ea2f82 100644 (file)
@@ -721,7 +721,11 @@ static wxString GetAssertStackTrace()
     protected:
         virtual void OnStackFrame(const wxStackFrame& frame)
         {
-            m_stackTrace << wxString::Format(_T("[%02d] "), frame.GetLevel());
+            m_stackTrace << wxString::Format
+                            (
+                              _T("[%02d] "),
+                              wx_truncate_cast(int, frame.GetLevel())
+                            );
 
             wxString name = frame.GetName();
             if ( !name.empty() )
@@ -730,11 +734,8 @@ static wxString GetAssertStackTrace()
             }
             else
             {
-                m_stackTrace << wxString::Format
-                                (
-                                    _T("0x%08lx"),
-                                    (unsigned long)frame.GetAddress()
-                                );
+                m_stackTrace << wxString::Format(_T("0x%08p"),
+                                                 frame.GetAddress());
             }
 
             if ( frame.HasSourceLocation() )
index b4887f7ddb3a00db0ec1309220f2f280a9533f63..7e4d11a93bec3bc56a95fb4f4b292bd0b6b1c4a3 100644 (file)
@@ -330,9 +330,11 @@ wxHelpProvider::~wxHelpProvider()
 // wxSimpleHelpProvider
 // ----------------------------------------------------------------------------
 
+#define WINHASH_KEY(w) wxPtrToUInt(w)
+
 wxString wxSimpleHelpProvider::GetHelp(const wxWindowBase *window)
 {
-    wxLongToStringHashMap::iterator it = m_hashWindows.find((long)window);
+    wxLongToStringHashMap::iterator it = m_hashWindows.find(WINHASH_KEY(window));
 
     if ( it == m_hashWindows.end() )
     {
@@ -346,8 +348,8 @@ wxString wxSimpleHelpProvider::GetHelp(const wxWindowBase *window)
 
 void wxSimpleHelpProvider::AddHelp(wxWindowBase *window, const wxString& text)
 {
-    m_hashWindows.erase((long)window);
-    m_hashWindows[(long)window] = text;
+    m_hashWindows.erase(WINHASH_KEY(window));
+    m_hashWindows[WINHASH_KEY(window)] = text;
 }
 
 void wxSimpleHelpProvider::AddHelp(wxWindowID id, const wxString& text)
@@ -360,7 +362,7 @@ void wxSimpleHelpProvider::AddHelp(wxWindowID id, const wxString& text)
 // removes the association
 void wxSimpleHelpProvider::RemoveHelp(wxWindowBase* window)
 {
-    m_hashWindows.erase((long)window);
+    m_hashWindows.erase(WINHASH_KEY(window));
 }
 
 bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window)
index c4425617ed0fcd4d2255a0aab1cf28569e507287..6622496e339856f70fdd4ccba7202930cbda7aee 100644 (file)
@@ -2373,23 +2373,23 @@ wxString wxDateTime::Format(const wxChar *format, const TimeZone& tz) const
 
                         // find two strings not occurring in format (this is surely
                         // not the optimal way of doing it... improvements welcome!)
-                        wxString fmt = format;
+                        wxString fmt2 = format;
                         wxString replacement = (wxChar)-1;
-                        while ( fmt.Find(replacement) != wxNOT_FOUND )
+                        while ( fmt2.Find(replacement) != wxNOT_FOUND )
                         {
                             replacement << (wxChar)-1;
                         }
 
                         wxString replacement2 = (wxChar)-2;
-                        while ( fmt.Find(replacement) != wxNOT_FOUND )
+                        while ( fmt2.Find(replacement) != wxNOT_FOUND )
                         {
                             replacement << (wxChar)-2;
                         }
 
                         // replace all occurrences of year with it
-                        bool wasReplaced = fmt.Replace(strYear, replacement) > 0;
+                        bool wasReplaced = fmt2.Replace(strYear, replacement) > 0;
                         if ( !wasReplaced )
-                            wasReplaced = fmt.Replace(strYear2, replacement2) > 0;
+                            wasReplaced = fmt2.Replace(strYear2, replacement2) > 0;
 
                         // use strftime() to format the same date but in supported
                         // year
index cc82237911318dd2e32b4980fb5a8e8ac832e7cd..0a02f17e8f677dd2843a5ab9d672f9b8695ceec7 100644 (file)
@@ -19,6 +19,7 @@
 #if wxUSE_STREAMS
 
 #include "wx/datstrm.h"
+#include "wx/math.h"
 
 // ---------------------------------------------------------------------------
 // wxDataInputStream
@@ -78,16 +79,13 @@ wxUint8 wxDataInputStream::Read8()
   return (wxUint8)buf;
 }
 
-// Must be at global scope for VC++ 5
-extern "C" double ConvertFromIeeeExtended(const unsigned char *bytes);
-
 double wxDataInputStream::ReadDouble()
 {
 #if wxUSE_APPLE_IEEE
   char buf[10];
 
   m_input->Read(buf, 10);
-  return ConvertFromIeeeExtended((unsigned char *)buf);
+  return ConvertFromIeeeExtended((const wxInt8 *)buf);
 #else
   return 0.0;
 #endif
@@ -321,15 +319,12 @@ void wxDataOutputStream::WriteString(const wxString& string)
       m_output->Write(buf, len);
 }
 
-// Must be at global scope for VC++ 5
-extern "C" void ConvertToIeeeExtended(double num, unsigned char *bytes);
-
 void wxDataOutputStream::WriteDouble(double d)
 {
   char buf[10];
 
 #if wxUSE_APPLE_IEEE
-  ConvertToIeeeExtended(d, (unsigned char *)buf);
+  ConvertToIeeeExtended(d, (wxInt8 *)buf);
 #else
 #if !defined(__VMS__) && !defined(__GNUG__)
 # pragma warning "wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!"
index 0717408f4fc52d045a70a1777350039a0fca8c46..2428d18213f8672498918843477c1b7a6c652899 100644 (file)
@@ -106,12 +106,16 @@ TextElement(wxXmlNode *node, const wxChar *name, const wxString& value)
     nodeChild->AddChild(new wxXmlNode(wxXML_TEXT_NODE, wxEmptyString, value));
 }
 
+#if wxUSE_CRASHREPORT && defined(__INTEL__)
+
 static inline void
 HexElement(wxXmlNode *node, const wxChar *name, unsigned long value)
 {
     TextElement(node, name, wxString::Format(_T("%08lx"), value));
 }
 
+#endif // wxUSE_CRASHREPORT
+
 #if wxUSE_STACKWALKER
 
 // ============================================================================
@@ -371,7 +375,7 @@ bool wxDebugReport::DoAddLoadedModules(wxXmlNode *nodeModules)
         size_t len = 0;
         if ( info.GetAddress(&addr, &len) )
         {
-            HexProperty(nodeModule, _T("address"), (unsigned long)addr);
+            HexProperty(nodeModule, _T("address"), wxPtrToUInt(addr));
             HexProperty(nodeModule, _T("size"), len);
         }
 
@@ -397,7 +401,7 @@ bool wxDebugReport::DoAddExceptionInfo(wxXmlNode *nodeContext)
 
     HexProperty(nodeExc, _T("code"), c.code);
     nodeExc->AddProperty(_T("name"), c.GetExceptionString());
-    HexProperty(nodeExc, _T("address"), (unsigned long)c.addr);
+    HexProperty(nodeExc, _T("address"), wxPtrToUInt(c.addr));
 
 #ifdef __INTEL__
     wxXmlNode *nodeRegs = new wxXmlNode(wxXML_ELEMENT_NODE, _T("registers"));
index 92f5237512c67aea9290216470b8923894f64eb0..b098d4854b516b05e6bfb845c24b30021c6669db 100644 (file)
@@ -410,6 +410,12 @@ void name::insert(iterator it, const_iterator first, const_iterator last)   \
         _WX_DEFINE_BASEARRAY_COMMON(T, name)                                \
         _WX_DEFINE_BASEARRAY_NOCOMMON(T, name)
 
+#ifdef __INTELC__
+    #pragma warning(push)
+    #pragma warning(disable: 1684)
+    #pragma warning(disable: 1572)
+#endif
+
 _WX_DEFINE_BASEARRAY(const void *, wxBaseArrayPtrVoid)
 _WX_DEFINE_BASEARRAY(short,        wxBaseArrayShort)
 _WX_DEFINE_BASEARRAY(int,          wxBaseArrayInt)
@@ -417,6 +423,10 @@ _WX_DEFINE_BASEARRAY(long,         wxBaseArrayLong)
 _WX_DEFINE_BASEARRAY(size_t,       wxBaseArraySizeT)
 _WX_DEFINE_BASEARRAY(double,       wxBaseArrayDouble)
 
+#ifdef __INTELC__
+    #pragma warning(pop)
+#endif
+
 #if wxUSE_STL
 #include "wx/arrstr.h"
 
index 9ff1b19f022d27e6c4a8a1da2c618dceddd21a79..b3e2bd8cd690f2c805e97e7031fb5b9a9a73fcf3 100644 (file)
  * and a 64-bit mantissa, with no hidden bit.
  ****************************************************************/
 
-wxFloat64 ConvertFromIeeeExtended(wxInt8* bytes)
+wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes)
 {
     wxFloat64 f;
     wxInt32 expon;
index cc6053482153eb4eeed59e6a23b702f528486d82..3422506621d42ac0cecfb560c854322ab66be317 100644 (file)
@@ -104,7 +104,7 @@ bool wxFFile::ReadAll(wxString *str, wxMBConv& conv)
     wxCHECK_MSG( str, false, wxT("invalid parameter") );
     wxCHECK_MSG( IsOpened(), false, wxT("can't read from closed file") );
     wxCHECK_MSG( Length() >= 0, false, wxT("invalid length") );
-    size_t length = (size_t)Length();
+    size_t length = wx_truncate_cast(size_t, Length());
     wxCHECK_MSG( (wxFileOffset)length == Length(), false, wxT("huge file not supported") );
 
     clearerr(m_fp);
index 5549cd7bb3ef0bfe2b00df82d0a099933d0f653e..6e4f6ddfefa2bcedf5b23e9b4d5ab582a2b5d023 100644 (file)
@@ -450,16 +450,16 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName,
     {
         if ( !m_strLocalFile.empty() && !wxIsAbsolutePath(m_strLocalFile) )
         {
-            wxString strLocal = m_strLocalFile;
+            const wxString strLocalOrig = m_strLocalFile;
             m_strLocalFile = GetLocalDir();
-            m_strLocalFile << strLocal;
+            m_strLocalFile << strLocalOrig;
         }
 
         if ( !m_strGlobalFile.empty() && !wxIsAbsolutePath(m_strGlobalFile) )
         {
-            wxString strGlobal = m_strGlobalFile;
+            const wxString strGlobalOrig = m_strGlobalFile;
             m_strGlobalFile = GetGlobalDir();
-            m_strGlobalFile << strGlobal;
+            m_strGlobalFile << strGlobalOrig;
         }
     }
 
@@ -664,7 +664,7 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal)
       }
     }
     else {                        // a key
-      const wxChar *pEnd = pStart;
+      pEnd = pStart;
       while ( *pEnd && *pEnd != wxT('=') /* && !wxIsspace(*pEnd)*/ ) {
         if ( *pEnd == wxT('\\') ) {
           // next character may be space or not - still take it because it's
index 9b61e662e5d38d2f65e10805a5657de5b9d175d1..d1766a8179453f8f503c5c886f29d6c6a2b12785 100644 (file)
@@ -1890,6 +1890,8 @@ bool wxFileName::SetTimes(const wxDateTime *dtAccess,
         }
     }
 #elif defined(__UNIX_LIKE__) || (defined(__DOS__) && defined(__WATCOMC__))
+    wxUnusedVar(dtCreate);
+
     if ( !dtAccess && !dtMod )
     {
         // can't modify the creation time anyhow, don't try
index d3e2ac282506b160c41789c242b2ab3c806d8794..345d06ec8b6f847dda349ca280aa45d920df59bd 100644 (file)
@@ -573,7 +573,7 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset)
                 if ( *p == wxT('-') )
                     p++;
 
-                int value;
+                unsigned int value;
                 if ( wxSscanf(p, wxT("%u"), &value) == 1 )
                 {
                     if ( value >= 1250 )
index 1a155e493f961e888ee5b812fdb5cafd8241aafe..d7d4c60fdc7d1bc9b9f67d0ae93720369b37fdd6 100644 (file)
@@ -1132,13 +1132,16 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName,
     return false;
 
   // get the file size (assume it is less than 4Gb...)
-  wxFileOffset nSize = fileMsg.Length();
-  if ( nSize == wxInvalidOffset )
+  wxFileOffset lenFile = fileMsg.Length();
+  if ( lenFile == wxInvalidOffset )
     return false;
 
+  size_t nSize = wx_truncate_cast(size_t, lenFile);
+  wxASSERT_MSG( nSize == lenFile, _T("message catalog bigger than 4GB?") );
+
   // read the whole file in memory
   m_pData = new size_t8[nSize];
-  if ( fileMsg.Read(m_pData, (size_t)nSize) != nSize ) {
+  if ( fileMsg.Read(m_pData, nSize) != nSize ) {
     wxDELETEA(m_pData);
     return false;
   }
index 488cb1565aa602104be55a7a014681ea24353817..b61b13d159a9f62398572a7ece70e8a5df3268e7 100644 (file)
@@ -47,14 +47,14 @@ void *wxLongLongNative::asArray() const
 {
     static unsigned char temp[8];
 
-    temp[0] = (unsigned char)((m_ll >> 56) & 0xFF);
-    temp[1] = (unsigned char)((m_ll >> 48) & 0xFF);
-    temp[2] = (unsigned char)((m_ll >> 40) & 0xFF);
-    temp[3] = (unsigned char)((m_ll >> 32) & 0xFF);
-    temp[4] = (unsigned char)((m_ll >> 24) & 0xFF);
-    temp[5] = (unsigned char)((m_ll >> 16) & 0xFF);
-    temp[6] = (unsigned char)((m_ll >> 8)  & 0xFF);
-    temp[7] = (unsigned char)((m_ll >> 0)  & 0xFF);
+    temp[0] = wx_truncate_cast(unsigned char, ((m_ll >> 56) & 0xFF));
+    temp[1] = wx_truncate_cast(unsigned char, ((m_ll >> 48) & 0xFF));
+    temp[2] = wx_truncate_cast(unsigned char, ((m_ll >> 40) & 0xFF));
+    temp[3] = wx_truncate_cast(unsigned char, ((m_ll >> 32) & 0xFF));
+    temp[4] = wx_truncate_cast(unsigned char, ((m_ll >> 24) & 0xFF));
+    temp[5] = wx_truncate_cast(unsigned char, ((m_ll >> 16) & 0xFF));
+    temp[6] = wx_truncate_cast(unsigned char, ((m_ll >> 8)  & 0xFF));
+    temp[7] = wx_truncate_cast(unsigned char, ((m_ll >> 0)  & 0xFF));
 
     return temp;
 }
@@ -63,14 +63,14 @@ void *wxULongLongNative::asArray() const
 {
     static unsigned char temp[8];
 
-    temp[0] = (unsigned char)((m_ll >> 56) & 0xFF);
-    temp[1] = (unsigned char)((m_ll >> 48) & 0xFF);
-    temp[2] = (unsigned char)((m_ll >> 40) & 0xFF);
-    temp[3] = (unsigned char)((m_ll >> 32) & 0xFF);
-    temp[4] = (unsigned char)((m_ll >> 24) & 0xFF);
-    temp[5] = (unsigned char)((m_ll >> 16) & 0xFF);
-    temp[6] = (unsigned char)((m_ll >> 8)  & 0xFF);
-    temp[7] = (unsigned char)((m_ll >> 0)  & 0xFF);
+    temp[0] = wx_truncate_cast(unsigned char, ((m_ll >> 56) & 0xFF));
+    temp[1] = wx_truncate_cast(unsigned char, ((m_ll >> 48) & 0xFF));
+    temp[2] = wx_truncate_cast(unsigned char, ((m_ll >> 40) & 0xFF));
+    temp[3] = wx_truncate_cast(unsigned char, ((m_ll >> 32) & 0xFF));
+    temp[4] = wx_truncate_cast(unsigned char, ((m_ll >> 24) & 0xFF));
+    temp[5] = wx_truncate_cast(unsigned char, ((m_ll >> 16) & 0xFF));
+    temp[6] = wx_truncate_cast(unsigned char, ((m_ll >> 8)  & 0xFF));
+    temp[7] = wx_truncate_cast(unsigned char, ((m_ll >> 0)  & 0xFF));
 
     return temp;
 }
index b81a7f44a0cd030adb1ea6446f6f6035745f1449..4f1886eaeeb82ba1474b0b63d8dcf5976ae0bf33 100644 (file)
@@ -50,12 +50,17 @@ wxMemoryInputStream::wxMemoryInputStream(const void *data, size_t len)
 
 wxMemoryInputStream::wxMemoryInputStream(const wxMemoryOutputStream& stream)
 {
-    ssize_t len = (ssize_t)stream.GetLength();
-    if (len == wxInvalidOffset) {
+    const wxFileOffset lenFile = stream.GetLength();
+    if ( lenFile == wxInvalidOffset )
+    {
         m_i_streambuf = NULL;
         m_lasterror = wxSTREAM_EOF;
         return;
     }
+
+    const size_t len = wx_truncate_cast(size_t, lenFile);
+    wxASSERT_MSG( len == lenFile, _T("huge files not supported") );
+
     m_i_streambuf = new wxStreamBuffer(wxStreamBuffer::read);
     m_i_streambuf->SetBufferIO(len); // create buffer
     stream.CopyTo(m_i_streambuf->GetBufferStart(), len);
index 09ca583c04109e39c3d721b25864ea46b1ffdca2..914fce2d2601fe0f133a986dc880a9135f55624e 100644 (file)
@@ -188,7 +188,7 @@ wxPopupTransientWindow::~wxPopupTransientWindow()
 {
     if (m_handlerPopup && m_handlerPopup->GetNextHandler())
         PopHandlers();
-        
+
     wxASSERT(!m_handlerFocus || !m_handlerFocus->GetNextHandler());
     wxASSERT(!m_handlerPopup || !m_handlerPopup->GetNextHandler());
 
@@ -207,7 +207,7 @@ void wxPopupTransientWindow::PopHandlers()
             m_handlerPopup = NULL;
         }
         if (m_child->HasCapture())
-        {       
+        {
             m_child->ReleaseMouse();
         }
         m_child = NULL;
@@ -290,11 +290,11 @@ bool wxPopupTransientWindow::Show( bool show )
 
 #ifdef __WXMSW__
     if (!show && m_child && m_child->HasCapture())
-    {       
+    {
         m_child->ReleaseMouse();
     }
 #endif
-    
+
     bool ret = wxPopupWindow::Show( show );
 
 #ifdef __WXGTK__
@@ -387,10 +387,10 @@ void wxPopupTransientWindow::OnIdle(wxIdleEvent& event)
             {
                 m_child->CaptureMouse();
             }
-        }                
+        }
     }
 }
-#endif
+#endif // __WXMSW__
 
 
 #if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__)
@@ -483,15 +483,15 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event)
                 // dismissing a tooltip shouldn't waste a click, i.e. you
                 // should be able to dismiss it and press the button with the
                 // same click, so repost this event to the window beneath us
-                wxWindow *win = wxFindWindowAtPoint(event2.GetPosition());
-                if ( win )
+                wxWindow *winUnder = wxFindWindowAtPoint(event2.GetPosition());
+                if ( winUnder )
                 {
                     // translate the event coords to the ones of the window
                     // which is going to get the event
-                    win->ScreenToClient(&event2.m_x, &event2.m_y);
+                    winUnder->ScreenToClient(&event2.m_x, &event2.m_y);
 
-                    event2.SetEventObject(win);
-                    wxPostEvent(win, event2);
+                    event2.SetEventObject(winUnder);
+                    wxPostEvent(winUnder, event2);
                 }
             }
             break;
index d7c77768b74e4cd981a9f8dc73f178224c5a0d80..86a440f0090f2f31f5614dc120363879ec4de02d 100644 (file)
@@ -205,19 +205,18 @@ wxSockAddress *wxIPV4address::Clone() const
 wxString wxIPV4address::IPAddress() const
 {
     unsigned long raw =  GAddress_INET_GetHostAddress(m_address);
-    return wxString::Format(
-        _T("%u.%u.%u.%u"),
-        (unsigned char)((raw>>24) & 0xff),
-        (unsigned char)((raw>>16) & 0xff),
-        (unsigned char)((raw>>8) & 0xff),
-        (unsigned char)(raw & 0xff)
+    return wxString::Format(_T("%lu.%lu.%lu.%lu"),
+                (raw>>24) & 0xff,
+                (raw>>16) & 0xff,
+                (raw>>8) & 0xff,
+                raw & 0xff
         );
 }
 
 bool wxIPV4address::operator==(const wxIPV4address& addr) const
 {
-    if(Hostname().Cmp(addr.Hostname().c_str()) == 0 && Service() == addr.Service()) return true;
-    return false;
+    return Hostname().Cmp(addr.Hostname().c_str()) == 0 &&
+            Service() == addr.Service();
 }
 
 #if wxUSE_IPV6
index 9bf472c51764cba196b2dab29b101d8c86c0a2d4..247be68f8ea28480f73f7cfafeba25bcc97ef2d2 100644 (file)
@@ -95,7 +95,7 @@ public:
 public:
   wxSocketState() : wxObject() {}
 
-    DECLARE_NO_COPY_CLASS(wxSocketState)
+  DECLARE_NO_COPY_CLASS(wxSocketState)
 };
 
 // ==========================================================================
index 986bf4f82d39c514752cfcf2edc9ab7ce30c4687..63de22405cdd3213bf2ba09bba09adbffe278b64 100644 (file)
@@ -686,11 +686,11 @@ size_t wxMBConvUTF8::MB2WC(wchar_t *buf, const char *psz, size_t n) const
                     {
                         if ( buf && len + 3 < n )
                         {
-                            unsigned char n = *opsz;
+                            unsigned char on = *opsz;
                             *buf++ = L'\\';
-                            *buf++ = (wchar_t)( L'0' + n / 0100 );
-                            *buf++ = (wchar_t)( L'0' + (n % 0100) / 010 );
-                            *buf++ = (wchar_t)( L'0' + n % 010 );
+                            *buf++ = (wchar_t)( L'0' + on / 0100 );
+                            *buf++ = (wchar_t)( L'0' + (on % 0100) / 010 );
+                            *buf++ = (wchar_t)( L'0' + on % 010 );
                         }
                         opsz++;
                         len += 4;
@@ -1365,10 +1365,10 @@ wxMBConv_iconv::wxMBConv_iconv(const wxChar *name)
 
         for ( ; *names; ++names )
         {
-            const wxString name(*names);
+            const wxString nameCS(*names);
 
             // first try charset with explicit bytesex info (e.g. "UCS-4LE"):
-            wxString nameXE(name);
+            wxString nameXE(nameCS);
             #ifdef WORDS_BIGENDIAN
                 nameXE += _T("BE");
             #else // little endian
@@ -1379,7 +1379,7 @@ wxMBConv_iconv::wxMBConv_iconv(const wxChar *name)
             if ( m2w == ICONV_T_INVALID )
             {
                 // try charset w/o bytesex info (e.g. "UCS4")
-                m2w = iconv_open(name.ToAscii(), cname);
+                m2w = iconv_open(nameCS.ToAscii(), cname);
 
                 // and check for bytesex ourselves:
                 if ( m2w != ICONV_T_INVALID )
@@ -1404,11 +1404,11 @@ wxMBConv_iconv::wxMBConv_iconv(const wxChar *name)
                     {
                         wxLogLastError(wxT("iconv"));
                         wxLogError(_("Conversion to charset '%s' doesn't work."),
-                                   name.c_str());
+                                   nameCS.c_str());
                     }
                     else // ok, can convert to this encoding, remember it
                     {
-                        ms_wcCharsetName = name
+                        ms_wcCharsetName = nameCS;
                         ms_wcNeedsSwap = wbuf[0] != (wchar_t)buf[0];
                     }
                 }
@@ -1485,8 +1485,8 @@ size_t wxMBConv_iconv::MB2WC(wchar_t *buf, const char *psz, size_t n) const
         if (ms_wcNeedsSwap)
         {
             // convert to native endianness
-            for ( unsigned n = 0; n < res; n++ )
-                buf[n] = WC_BSWAP(buf[n]);
+            for ( unsigned i = 0; i < res; i++ )
+                buf[n] = WC_BSWAP(buf[i]);
         }
 
         // NB: iconv was given only strlen(psz) characters on input, and so
@@ -1543,8 +1543,8 @@ size_t wxMBConv_iconv::WC2MB(char *buf, const wchar_t *psz, size_t n) const
         // (doing WC_BSWAP twice on the original buffer won't help, as it
         //  could be in read-only memory, or be accessed in some other thread)
         tmpbuf = (wchar_t *)malloc(inbuf + SIZEOF_WCHAR_T);
-        for ( size_t n = 0; n < inlen; n++ )
-            tmpbuf[n] = WC_BSWAP(psz[n]);
+        for ( size_t i = 0; i < inlen; i++ )
+            tmpbuf[n] = WC_BSWAP(psz[i]);
         tmpbuf[inlen] = L'\0';
         psz = tmpbuf;
     }
index 8061deeb7bdf0482ca0c40a94cdcbfa3bc714b9e..2f26e6a3303c6022fb4f807d6e53960dea7a70c6 100644 (file)
@@ -576,7 +576,7 @@ wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode)
         }
         if (diff < 0 || diff > last_access)
             return wxInvalidOffset;
-        size_t int_diff = (size_t)diff;
+        size_t int_diff = wx_truncate_cast(size_t, diff);
         wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") );
         SetIntPosition(int_diff);
         return diff;
@@ -603,7 +603,7 @@ wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode)
             }
             else
             {
-                size_t int_diff = (size_t)diff;
+                size_t int_diff = wx_truncate_cast(size_t, diff);
                 wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") );
                 SetIntPosition(int_diff);
                 return pos;
@@ -660,7 +660,13 @@ wxStreamBase::~wxStreamBase()
 size_t wxStreamBase::GetSize() const
 {
     wxFileOffset length = GetLength();
-    return length == wxInvalidOffset ? 0 : (size_t)length;
+    if ( length == wxInvalidOffset )
+        return 0;
+
+    const size_t len = wx_truncate_cast(size_t, length);
+    wxASSERT_MSG( len == length, _T("large files not supported") );
+
+    return len;
 }
 
 wxFileOffset wxStreamBase::OnSysSeek(wxFileOffset WXUNUSED(seek), wxSeekMode WXUNUSED(mode))
@@ -994,7 +1000,7 @@ size_t wxCountingOutputStream::OnSysWrite(const void *WXUNUSED(buffer),
 
 wxFileOffset wxCountingOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
 {
-    ssize_t new_pos = (ssize_t)pos;
+    ssize_t new_pos = wx_truncate_cast(ssize_t, pos);
 
     switch ( mode )
     {
index ffae5b4e127c85156ec36b5b77423ed4a3053fb7..12c4204759d9302c8f1d18e3545589bdf3a0c544 100644 (file)
@@ -365,8 +365,8 @@ bool wxStringBase::Alloc(size_t nLen)
     if ( pData->IsEmpty() ) {
       nLen += EXTRA_ALLOC;
 
-      wxStringData* pData = (wxStringData*)
-          malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar));
+      pData = (wxStringData *)
+                malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar));
 
       if ( pData == NULL ) {
         // allocation failure handled by caller
index c6dd81ff317c65fae1badcbc06e2aeba12187c71..61260824e26937e3aca5ce46cad411d63c430f89 100644 (file)
@@ -348,7 +348,7 @@ void wxTextOutputStream::Write32(wxUint32 i)
 void wxTextOutputStream::Write16(wxUint16 i)
 {
     wxString str;
-    str.Printf(wxT("%u"), i);
+    str.Printf(wxT("%u"), (unsigned)i);
 
     WriteString(str);
 }
@@ -356,7 +356,7 @@ void wxTextOutputStream::Write16(wxUint16 i)
 void wxTextOutputStream::Write8(wxUint8 i)
 {
     wxString str;
-    str.Printf(wxT("%u"), i);
+    str.Printf(wxT("%u"), (unsigned)i);
 
     WriteString(str);
 }
index 30a0004bc12838d153f83bad286c592fa16b22e7..c195d13729c3d93ea5b632d62f76f0b3b56adbf4 100644 (file)
@@ -113,7 +113,7 @@ wxChar wxURI::TranslateEscape(const wxChar* s)
 {
     wxASSERT_MSG( IsHex(s[0]) && IsHex(s[1]), wxT("Invalid escape sequence!"));
 
-    return (wxChar)( CharToHex(s[0]) << 4 ) | CharToHex(s[1]);
+    return wx_truncate_cast(wxChar, (CharToHex(s[0]) << 4 ) | CharToHex(s[1]));
 }
 
 wxString wxURI::Unescape(const wxString& uri)
index 957732311e3a694947f8ea2902658d9f514794f5..b9a49a85e6e18a38a383f50a292d0487531ba04b 100644 (file)
@@ -40,7 +40,7 @@
 
 WX_DECLARE_LIST(wxAcceleratorEntry, wxAccelList);
 #include "wx/listimpl.cpp"
-WX_DEFINE_LIST(wxAccelList);
+WX_DEFINE_LIST(wxAccelList)
 
 // ----------------------------------------------------------------------------
 // wxAccelRefData: the data used by wxAcceleratorTable
index 2c2a33d58aafe0ce796240277a0936b66b8262c8..eda003e5f76c30b71b276f9769bcd838cb8930f5 100644 (file)
@@ -633,14 +633,14 @@ wxDatePickerCtrlGeneric::SetDateRange(const wxDateTime& lowerdate,
 
 bool wxDatePickerCtrlGeneric::SetFormat(const wxChar *fmt)
 {
+    m_format.clear();
+
     wxDateTime dt;
     dt.ParseFormat(wxT("2003-10-13"), wxT("%Y-%m-%d"));
-    wxString str=dt.Format(fmt);
-    wxChar *p=(wxChar*)str.c_str();
-
-    m_format=wxEmptyString;
+    wxString str(dt.Format(fmt));
 
-    while (*p)
+    const wxChar *p = str.c_str();
+    while ( *p )
     {
         int n=wxAtoi(p);
         if (n == dt.GetDay())
@@ -670,19 +670,19 @@ bool wxDatePickerCtrlGeneric::SetFormat(const wxChar *fmt)
             m_format.Append(*p++);
     }
 
-    if (m_txt)
+    if ( m_txt )
     {
         wxArrayString allowedChars;
         for ( wxChar c = _T('0'); c <= _T('9'); c++ )
             allowedChars.Add(wxString(c, 1));
 
-        const wxChar *p = m_format.c_str();
-        while (*p)
+        const wxChar *p2 = m_format.c_str();
+        while ( *p2 )
         {
-            if (*p == '%')
-                p += 2;
+            if ( *p2 == '%')
+                p2 += 2;
             else
-                allowedChars.Add(wxString(*p++, 1));
+                allowedChars.Add(wxString(*p2++, 1));
         }
 
 #if wxUSE_VALIDATORS
index 75585e829c3a95c6507d886d9e6e473427b522e9..cca162da5d3b8768cd9b26d671df114ac76f1318 100644 (file)
@@ -272,7 +272,7 @@ void wxGenericDirDialog::OnTreeSelected( wxTreeEvent &event )
 
     if (data)
        m_input->SetValue( data->m_path );
-};
+}
 
 void wxGenericDirDialog::OnTreeKeyDown( wxTreeEvent &WXUNUSED(event) )
 {
@@ -282,7 +282,7 @@ void wxGenericDirDialog::OnTreeKeyDown( wxTreeEvent &WXUNUSED(event) )
     wxDirItemData *data = (wxDirItemData*)m_dirCtrl->GetTreeCtrl()->GetItemData(m_dirCtrl->GetTreeCtrl()->GetSelection());
     if (data)
         m_input->SetValue( data->m_path );
-};
+}
 
 void wxGenericDirDialog::OnShowHidden( wxCommandEvent& event )
 {
index 3668542fbb595b4c7e5aafd0d01630aa23451881..9096fef28fd85e2c5a307e916c736d0d10834709 100644 (file)
@@ -293,7 +293,7 @@ wxString wxFileData::GetHint() const
     }
 
     return s;
-};
+}
 
 wxString wxFileData::GetEntry( fileListFieldType num ) const
 {
index 3c900fa4de126d14e5da935fc05747494e735d60..2ab4374312f47c528206bc5868b8d2827b083538 100644 (file)
@@ -9742,7 +9742,7 @@ void wxGrid::SetRowMinimalAcceptableHeight( int height )
     if ( height<0 )
         return;
     m_minAcceptableRowHeight = height;
-};
+}
 
 int  wxGrid::GetColMinimalAcceptableWidth() const
 {
index b9571b23be68a78fc6ee44ff1daa0f31b5f6acd3..524f4bf45a4c801a9e437f5fdf56532d71d98db1 100644 (file)
@@ -159,12 +159,12 @@ void wxSashLayoutWindow::OnCalculateLayout(wxCalculateLayoutEvent& event)
     {
         // If not in query mode, resize the window.
         // TODO: add wxRect& form to wxWindow::SetSize
-        wxSize sz = GetSize();
+        wxSize sz2 = GetSize();
         wxPoint pos = GetPosition();
         SetSize(thisRect.x, thisRect.y, thisRect.width, thisRect.height);
 
         // Make sure the sash is erased when the window is resized
-        if ((pos.x != thisRect.x || pos.y != thisRect.y || sz.x != thisRect.width || sz.y != thisRect.height) &&
+        if ((pos.x != thisRect.x || pos.y != thisRect.y || sz2.x != thisRect.width || sz2.y != thisRect.height) &&
             (GetSashVisible(wxSASH_TOP) || GetSashVisible(wxSASH_RIGHT) || GetSashVisible(wxSASH_BOTTOM) || GetSashVisible(wxSASH_LEFT)))
             Refresh(true);
 
index cd1e3dd934acc86e44cde49aa0cc49ed9a538910..dff0f468138bd7edfb333c2399cf25bfb43d1f8e 100644 (file)
@@ -285,7 +285,7 @@ private:
 
 WX_DECLARE_LIST(wxListItemData, wxListItemDataList);
 #include "wx/listimpl.cpp"
-WX_DEFINE_LIST(wxListItemDataList);
+WX_DEFINE_LIST(wxListItemDataList)
 
 class wxListLineData
 {
@@ -413,7 +413,7 @@ private:
 
 WX_DECLARE_EXPORTED_OBJARRAY(wxListLineData, wxListLineDataArray);
 #include "wx/arrimpl.cpp"
-WX_DEFINE_OBJARRAY(wxListLineDataArray);
+WX_DEFINE_OBJARRAY(wxListLineDataArray)
 
 //-----------------------------------------------------------------------------
 //  wxListHeaderWindow (internal)
@@ -519,7 +519,7 @@ private:
 
 WX_DECLARE_LIST(wxListHeaderData, wxListHeaderDataList);
 #include "wx/listimpl.cpp"
-WX_DEFINE_LIST(wxListHeaderDataList);
+WX_DEFINE_LIST(wxListHeaderDataList)
 
 class wxListMainWindow : public wxScrolledWindow
 {
index 6c575277ae7e42c9d1b97daf5330da6ade9ea33a..0a3d46633704160dd6418279a909eb21621fe5a5 100644 (file)
@@ -678,8 +678,7 @@ wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog()
 void wxGenericPrintSetupDialog::OnPrinter(wxListEvent& event)
 {
     // Delete check mark
-    long item;
-    for (item = 0; item < m_printerListCtrl->GetItemCount(); item++)
+    for (long item = 0; item < m_printerListCtrl->GetItemCount(); item++)
         m_printerListCtrl->SetItemImage( item, -1 );
 
     m_printerListCtrl->SetItemImage( event.GetIndex(), 0 );
@@ -690,14 +689,12 @@ void wxGenericPrintSetupDialog::OnPrinter(wxListEvent& event)
     }
     else
     {
-        wxString tmp = wxT("lpr -P");
-        wxListItem item;
-        item.SetColumn( 1 );
-        item.SetMask( wxLIST_MASK_TEXT );
-        item.SetId( event.GetIndex() );
-        m_printerListCtrl->GetItem( item );
-        tmp += item.GetText();
-        m_printerCommandText->SetValue( tmp );
+        wxListItem li;
+        li.SetColumn( 1 );
+        li.SetMask( wxLIST_MASK_TEXT );
+        li.SetId( event.GetIndex() );
+        m_printerListCtrl->GetItem( li );
+        m_printerCommandText->SetValue( _T("lpr -P") + li.GetText() );
     }
 }
 
index 75c2601ef1971885a2283885664923afee3e3685..e17b168167e0d6dfde786bfed121e1bc80c611cc 100644 (file)
@@ -36,7 +36,7 @@
 
 #define wxSPLASH_TIMER_ID 9999
 
-IMPLEMENT_DYNAMIC_CLASS(wxSplashScreen, wxFrame);
+IMPLEMENT_DYNAMIC_CLASS(wxSplashScreen, wxFrame)
 
 BEGIN_EVENT_TABLE(wxSplashScreen, wxFrame)
     EVT_TIMER(wxSPLASH_TIMER_ID, wxSplashScreen::OnNotify)
index 4f86423e29fdeec350eabfc2ad129f7c60c1cb04..aaf7989b30b50199a5cd207952e93bcd60155278 100644 (file)
@@ -72,6 +72,7 @@
     #include <unistd.h>
 #endif // HAVE_POLL/!HAVE_POLL
 
+#include "wx/unix/private.h"
 #include "wx/gtk/win_gtk.h"
 
 #include <gtk/gtk.h>
@@ -306,23 +307,23 @@ int wxPoll(wxPollFd *ufds, unsigned int nfds, int timeout)
     fd_set readfds;
     fd_set writefds;
     fd_set exceptfds;
-    FD_ZERO(&readfds);
-    FD_ZERO(&writefds);
-    FD_ZERO(&exceptfds);
+    wxFD_ZERO(&readfds);
+    wxFD_ZERO(&writefds);
+    wxFD_ZERO(&exceptfds);
 
     unsigned int i;
     for ( i = 0; i < nfds; i++ )
     {
-        wxASSERT_MSG( ufds[i].fd < FD_SETSIZE, _T("fd out of range") );
+        wxASSERT_MSG( ufds[i].fd < wxFD_SETSIZE, _T("fd out of range") );
 
         if ( ufds[i].events & G_IO_IN )
-            FD_SET(ufds[i].fd, &readfds);
+            wxFD_SET(ufds[i].fd, &readfds);
 
         if ( ufds[i].events & G_IO_PRI )
-            FD_SET(ufds[i].fd, &exceptfds);
+            wxFD_SET(ufds[i].fd, &exceptfds);
 
         if ( ufds[i].events & G_IO_OUT )
-            FD_SET(ufds[i].fd, &writefds);
+            wxFD_SET(ufds[i].fd, &writefds);
 
         if ( ufds[i].fd > fdMax )
             fdMax = ufds[i].fd;
@@ -336,13 +337,13 @@ int wxPoll(wxPollFd *ufds, unsigned int nfds, int timeout)
     {
         ufds[i].revents = 0;
 
-        if ( FD_ISSET(ufds[i].fd, &readfds ) )
+        if ( wxFD_ISSET(ufds[i].fd, &readfds ) )
             ufds[i].revents |= G_IO_IN;
 
-        if ( FD_ISSET(ufds[i].fd, &exceptfds ) )
+        if ( wxFD_ISSET(ufds[i].fd, &exceptfds ) )
             ufds[i].revents |= G_IO_PRI;
 
-        if ( FD_ISSET(ufds[i].fd, &writefds ) )
+        if ( wxFD_ISSET(ufds[i].fd, &writefds ) )
             ufds[i].revents |= G_IO_OUT;
     }
 
index b72abe13b583251468babc02ed9932fb52b5354c..1ea0526a59267c6762d59ecc962f83d8b697d038 100644 (file)
@@ -1590,7 +1590,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
 #endif
 }
 
-void wxBitmap::UngetRawData(wxPixelDataBase& data)
+void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data))
 {
 }
 
@@ -1621,19 +1621,36 @@ wxBitmapHandler::~wxBitmapHandler()
 {
 }
 
-bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
+bool wxBitmapHandler::Create(wxBitmap * WXUNUSED(bitmap),
+                             void * WXUNUSED(data),
+                             long WXUNUSED(type),
+                             int WXUNUSED(width),
+                             int WXUNUSED(height),
+                             int WXUNUSED(depth))
 {
+    wxFAIL_MSG( _T("not implemented") );
+
     return false;
 }
 
-bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
-        int desiredWidth, int desiredHeight)
+bool wxBitmapHandler::LoadFile(wxBitmap * WXUNUSED(bitmap),
+                               const wxString& WXUNUSED(name),
+                               long WXUNUSED(flags),
+                               int WXUNUSED(desiredWidth),
+                               int WXUNUSED(desiredHeight))
 {
+    wxFAIL_MSG( _T("not implemented") );
+
     return false;
 }
 
-bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
+bool wxBitmapHandler::SaveFile(const wxBitmap * WXUNUSED(bitmap),
+                               const wxString& WXUNUSED(name),
+                               int WXUNUSED(type),
+                               const wxPalette * WXUNUSED(palette))
 {
+    wxFAIL_MSG( _T("not implemented") );
+
     return false;
 }
 
index 4b8aaa9de8807d82d1eec00e3ca2646f505ee897..ee5fdba2a54b49886b5e7adc754bd3b7d4ff7081 100644 (file)
@@ -844,12 +844,12 @@ void wxComboBox::OnChar( wxKeyEvent &event )
     if ( event.GetKeyCode() == WXK_RETURN )
     {
         // GTK automatically selects an item if its in the list
-        wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, GetId());
-        event.SetString( GetValue() );
-        event.SetInt( GetSelection() );
-        event.SetEventObject( this );
+        wxCommandEvent eventEnter(wxEVT_COMMAND_TEXT_ENTER, GetId());
+        eventEnter.SetString( GetValue() );
+        eventEnter.SetInt( GetSelection() );
+        eventEnter.SetEventObject( this );
 
-        if (!GetEventHandler()->ProcessEvent( event ))
+        if (!GetEventHandler()->ProcessEvent( eventEnter ))
         {
             // This will invoke the dialog default action, such
             // as the clicking the default button.
index 87bbe49cab9192b65e31c18df72b104458efe2ab..353ecd4501165dccf1ba71baac65ca25b5257c07 100644 (file)
@@ -88,9 +88,9 @@ void gdk_wx_draw_bitmap(GdkDrawable  *drawable,
                         gint         width,
                         gint         height)
 {
-    g_return_if_fail (drawable != NULL);
-    g_return_if_fail (src != NULL);
-    g_return_if_fail (gc != NULL);
+    wxCHECK_RET( drawable, _T("NULL drawable in gdk_wx_draw_bitmap") );
+    wxCHECK_RET( src, _T("NULL src in gdk_wx_draw_bitmap") );
+    wxCHECK_RET( gc, _T("NULL gc in gdk_wx_draw_bitmap") );
 
 #ifdef __WXGTK20__
     gint src_width, src_height;
index 10aed866ae9a10939b2b27cb3cbff82c321e3a72..fb6a78067ca56f9c3d11d180335c7b49ced7e0bf 100644 (file)
@@ -148,7 +148,8 @@ egg_tray_icon_get_type (void)
        (GInstanceInitFunc) egg_tray_icon_init
       };
 
-      our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
+      our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon",
+                                          &our_info, (GTypeFlags)0);
     }
 
   return our_type;
index 52e4bf8ff17cc18e474baa12aaf9e66db0fd2fdc..e5b773de6998925ea61a76e3f28579ce50147234 100644 (file)
@@ -106,7 +106,7 @@ static gint gtk_listitem_focus_in_callback( GtkWidget *widget,
     {
         // not yet, notify it
         win->m_hasFocus = TRUE;
-        
+
         wxChildFocusEvent eventChildFocus(win);
         (void)win->GetEventHandler()->ProcessEvent(eventChildFocus);
 
@@ -247,9 +247,9 @@ gtk_listbox_button_press_callback( GtkWidget *widget,
             for (i = 0; i < (int)listbox->GetCount(); i++)
                 if (i != sel)
                     gtk_list_unselect_item( GTK_LIST(listbox->m_list), i );
-                
+
             listbox->m_blockEvent = FALSE;
-            
+
             return false;
     }
 
@@ -310,21 +310,21 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
 #endif // wxUSE_CHECKLISTBOX
 
     // Check or uncheck item with SPACE
-    if ((gdk_event->keyval == ' ') && (!ret) && 
+    if ((gdk_event->keyval == ' ') && (!ret) &&
          (((listbox->GetWindowStyleFlag() & wxLB_MULTIPLE) != 0) ||
           ((listbox->GetWindowStyleFlag() & wxLB_EXTENDED) != 0)) )
     {
         int sel = listbox->GtkGetIndex( widget );
-        
+
         if (sel != -1)
         {
             ret = TRUE;
-            
+
             if (listbox->IsSelected( sel ))
                 gtk_list_unselect_item( listbox->m_list, sel );
             else
                 gtk_list_select_item( listbox->m_list, sel );
-            
+
             wxCommandEvent new_event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
             new_event.SetEventObject( listbox );
             wxArrayInt aSelections;
@@ -346,7 +346,7 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
             listbox->GetEventHandler()->ProcessEvent( new_event );
         }
     }
-    
+
     if (ret)
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
@@ -435,11 +435,11 @@ gtk_listbox_realized_callback( GtkWidget *m_widget, wxListBox *win )
 {
     if (g_isIdle)
         wxapp_install_idle_handler();
-        
+
     GList *child = win->m_list->children;
     for (child = win->m_list->children; child != NULL; child = child->next)
         gtk_widget_show( GTK_WIDGET(child->data) );
-    
+
     return false;
 }
 }
@@ -536,7 +536,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
     gtk_signal_connect( GTK_OBJECT(m_list), "realize",
                         GTK_SIGNAL_FUNC(gtk_listbox_realized_callback), (gpointer) this );
-                            
+
     if ( style & wxLB_SORT )
     {
         // this will change DoAppend() behaviour
@@ -730,7 +730,7 @@ void wxListBox::GtkAddItem( const wxString &item, int pos )
     if (GTK_WIDGET_REALIZED(m_widget))
     {
         gtk_widget_show( list_item );
-        
+
         gtk_widget_realize( list_item );
         gtk_widget_realize( GTK_BIN(list_item)->child );
 
@@ -745,8 +745,7 @@ void wxListBox::GtkAddItem( const wxString &item, int pos )
     {
         gtk_widget_modify_style( GTK_WIDGET( list_item ), style );
         GtkBin *bin = GTK_BIN( list_item );
-        GtkWidget *label = GTK_WIDGET( bin->child );
-        gtk_widget_modify_style( label, style );
+        gtk_widget_modify_style( GTK_WIDGET( bin->child ), style );
         gtk_rc_style_unref( style );
     }
 }
@@ -1131,7 +1130,7 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
 {
     return TRUE;
 
-#if 0    
+#if 0
     if (m_widget->window == window) return TRUE;
 
     if (GTK_WIDGET(m_list)->window == window) return TRUE;
@@ -1242,7 +1241,7 @@ wxSize wxListBox::DoGetBestSize() const
     lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
 
     wxSize best(lbWidth, lbHeight);
-    CacheBestSize(best);        
+    CacheBestSize(best);
     return best;
 }
 
index 0ebddfe17e1b42c8bdba10c2bdacb2060ab4abe7..26b690e4fd9fae541a7952b8e1642dfb5237492a 100644 (file)
@@ -1021,19 +1021,19 @@ void wxScrolledWindow::OnChar(wxKeyEvent& event)
     int xScroll = GetScrollPos(wxHORIZONTAL);
     if ( xScroll != xScrollOld )
     {
-        wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, xScroll,
-                               wxHORIZONTAL);
-        event.SetEventObject(this);
-        GetEventHandler()->ProcessEvent(event);
+        wxScrollWinEvent eventS(wxEVT_SCROLLWIN_THUMBTRACK, xScroll,
+                                wxHORIZONTAL);
+        eventS.SetEventObject(this);
+        GetEventHandler()->ProcessEvent(eventS);
     }
 
     int yScroll = GetScrollPos(wxVERTICAL);
     if ( yScroll != yScrollOld )
     {
-        wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, yScroll,
-                               wxVERTICAL);
-        event.SetEventObject(this);
-        GetEventHandler()->ProcessEvent(event);
+        wxScrollWinEvent eventS(wxEVT_SCROLLWIN_THUMBTRACK, yScroll,
+                                wxVERTICAL);
+        eventS.SetEventObject(this);
+        GetEventHandler()->ProcessEvent(eventS);
     }
 }
 
index c7e586c7992329ae2034ef84bcdedb893159bdd7..ad07a8affbb8249b21b71cccd13c333201758b25 100644 (file)
@@ -348,20 +348,20 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
                 GtkWidget *widget = gtk_button_new();
                 GtkStyle *def = gtk_rc_get_style( widget );
                 if ( !def || !def->font_desc )
-                    def = gtk_widget_get_default_style();  
+                    def = gtk_widget_get_default_style();
                 if ( def && def->font_desc )
-                {  
-                    wxNativeFontInfo info;  
-                    info.description = 
+                {
+                    wxNativeFontInfo info;
+                    info.description =
                         pango_font_description_copy(def->font_desc);
-                    gs_objects.m_fontSystem = wxFont(info);  
-                }  
-                else  
-                {  
+                    gs_objects.m_fontSystem = wxFont(info);
+                }
+                else
+                {
                     GtkSettings *settings = gtk_settings_get_default();
                     gchar *font_name = NULL;
                     g_object_get ( settings,
-                                   "gtk-font-name", 
+                                   "gtk-font-name",
                                    &font_name,
                                    NULL);
                     if (!font_name)
@@ -369,7 +369,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
                     else
                         gs_objects.m_fontSystem = wxFont(wxString::FromAscii(font_name));
                     g_free (font_name);
-                }  
+                }
                 gtk_widget_destroy( widget );
 #else
                 gs_objects.m_fontSystem = wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
@@ -387,7 +387,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
 {
 #ifdef __WXGTK20__
     bool success = false;
-            
+
     guchar *data = NULL;
     GdkWindow *window = NULL;
     if(win && GTK_WIDGET_REALIZED(win->GetHandle()))
@@ -428,15 +428,15 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
                         if (!gdk_net_wm_supports(gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
                             return -1;
                     }
-    
+
                     // Get the frame extents from the windowmanager.
                     // In most cases the top extent is the titlebar, so we use the bottom extent
                     // for the heights.
-    
+
                     Atom type;
                     gint format;
                     gulong nitems;
-                    
+
 #if GTK_CHECK_VERSION(2,2,0)
                     if (!gtk_check_version(2,2,0))
                     {
@@ -650,12 +650,12 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
 {
     switch (index)
     {
-        case wxSYS_CAN_ICONIZE_FRAME: 
-            return FALSE; 
-            break;
+        case wxSYS_CAN_ICONIZE_FRAME:
+            return FALSE;
+
         case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
-            return TRUE; 
-            break;
+            return TRUE;
+
         default:
             return FALSE;
     }
index a6920de7f98f4de5424c8a8eac037eb9bf4691a9..555803cd80603293e03826a3383c62960e5f057a 100644 (file)
@@ -428,15 +428,16 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
                 {
                     wxToolBarToolsList::compatibility_iterator node
                         = wxToolBarToolsList::compatibility_iterator();
-                    if ( pos ) node = m_tools.Item(pos - 1);
+                    if ( pos )
+                        node = m_tools.Item(pos - 1);
 
                     while ( node )
                     {
-                        wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
-                        if ( !tool->IsRadio() )
+                        wxToolBarTool *toolNext = (wxToolBarTool *)node->GetData();
+                        if ( !toolNext->IsRadio() )
                             break;
 
-                        widget = tool->m_item;
+                        widget = toolNext->m_item;
 
                         node = node->GetPrevious();
                     }
index 280f57a98b4b1331115edce7bb88c6a704b3a4b7..44222ba55c5b2c39ded0ce126bd129c4a456cfd5 100644 (file)
@@ -70,7 +70,7 @@ static void gtk_pizza_forall        (GtkContainer     *container,
                                      gboolean          include_internals,
                                      GtkCallback       callback,
                                      gpointer          callback_data);
-                                     
+
 static void     gtk_pizza_allocate_child     (GtkPizza      *pizza,
                                               GtkPizzaChild *child);
 static void     gtk_pizza_adjust_allocations_recurse (GtkWidget *widget,
@@ -102,7 +102,9 @@ static void  gtk_pizza_scroll_set_adjustments (GtkPizza      *pizza,
 static GtkContainerClass *pizza_parent_class = NULL;
 #endif
 
+#ifndef __WXGTK20__
 static gboolean gravity_works;
+#endif
 
 GtkType
 gtk_pizza_get_type ()
@@ -111,7 +113,7 @@ gtk_pizza_get_type ()
 
     if (!pizza_type)
     {
-    
+
 #ifdef __WXGTK20__
         static const GTypeInfo pizza_info =
         {
@@ -125,7 +127,7 @@ gtk_pizza_get_type ()
             16,             /* n_preallocs */
             (GInstanceInitFunc) gtk_pizza_init,
         };
-        pizza_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkPizza", &pizza_info, 0);
+        pizza_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkPizza", &pizza_info, (GTypeFlags)0);
 #else
         GtkTypeInfo pizza_info =
         {
@@ -404,7 +406,7 @@ gtk_pizza_move (GtkPizza     *pizza,
 
             child->x = x;
             child->y = y;
-            
+
             if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (pizza))
                 gtk_widget_queue_resize (widget);
             break;
@@ -642,7 +644,7 @@ gtk_pizza_realize (GtkWidget *widget)
     widget->style = gtk_style_attach (widget->style, widget->window);
     gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
     gtk_style_set_background (widget->style, pizza->bin_window, GTK_STATE_NORMAL );
+
 /*
     gdk_window_set_back_pixmap( widget->window, NULL, FALSE );
     gdk_window_set_back_pixmap( pizza->bin_window, NULL, FALSE );
@@ -652,10 +654,10 @@ gtk_pizza_realize (GtkWidget *widget)
     /* add filters for intercepting visibility and expose events */
     gdk_window_add_filter (widget->window, gtk_pizza_main_filter, pizza);
     gdk_window_add_filter (pizza->bin_window, gtk_pizza_filter, pizza);
-#endif
 
     /* we NEED gravity or we'll give up */
     gravity_works = gdk_window_set_static_gravities (pizza->bin_window, TRUE);
+#endif // !__WXGTK20__
 
     /* cannot be done before realisation */
     children = pizza->children;
@@ -836,9 +838,9 @@ gtk_pizza_expose (GtkWidget      *widget,
 #ifdef __WXGTK20__
 
     (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, event);
-    
+
     return FALSE;
-    
+
 #else
 
     children = pizza->children;
@@ -856,9 +858,9 @@ gtk_pizza_expose (GtkWidget      *widget,
             gtk_widget_event (child->widget, (GdkEvent*) &child_event);
         }
     }
-    
+
     return TRUE;
-    
+
 #endif
 }
 
@@ -1104,7 +1106,7 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
 
     if (pizza->bin_window)
         gdk_window_scroll( pizza->bin_window, -dx, -dy );
-#else
+#else // !__WXGTK20__
     GtkWidget *widget;
     XEvent xevent;
     XID win;
@@ -1236,7 +1238,7 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
             }
         }
     }
-#endif /* __WXGTK20__ */
+#endif /* __WXGTK20__/!__WXGTK20__ */
 }
 
 
index 03c6f88e39f27021e4c775a414dcdc9d3f26c5fb..7bd13fae8e06856ead82b0b9bf709f22f1c7361f 100644 (file)
@@ -239,7 +239,9 @@ wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL;
 
 // hack: we need something to pass to gtk_menu_popup, so we store the time of
 // the last click here
+#ifndef __WXGTK20__
 static guint32 gs_timeLastClick = 0;
+#endif
 
 extern bool g_mainThreadLocked;
 
@@ -1388,9 +1390,9 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
 
         if ( btnCancel )
         {
-            wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
-            event.SetEventObject(btnCancel);
-            ret = btnCancel->GetEventHandler()->ProcessEvent(event);
+            wxCommandEvent eventClick(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
+            eventClick.SetEventObject(btnCancel);
+            ret = btnCancel->GetEventHandler()->ProcessEvent(eventClick);
         }
     }
 
@@ -1799,9 +1801,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
     if ( !g_captureWindow )
         win = FindWindowForMouseEvent(win, event.m_x, event.m_y);
 
+#ifndef __WXGTK20__
     gs_timeLastClick = gdk_event->time;
 
-#ifndef __WXGTK20__
     if (event_type == wxEVT_LEFT_DCLICK)
     {
         // GTK 1.2 crashes when intercepting double
@@ -1813,7 +1815,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
             return FALSE;
         }
     }
-#endif
+#endif // !__WXGTK20__
 
     if (win->GetEventHandler()->ProcessEvent( event ))
     {
@@ -1958,11 +1960,11 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget,
             // the mouse changed window
             g_captureWindowHasMouse = hasMouse;
 
-            wxMouseEvent event(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW
-                                                       : wxEVT_LEAVE_WINDOW);
-            InitMouseEvent(win, event, gdk_event);
-            event.SetEventObject(win);
-            win->GetEventHandler()->ProcessEvent(event);
+            wxMouseEvent eventM(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW
+                                                        : wxEVT_LEAVE_WINDOW);
+            InitMouseEvent(win, eventM, gdk_event);
+            eventM.SetEventObject(win);
+            win->GetEventHandler()->ProcessEvent(eventM);
         }
     }
     else // no capture
index 4f86423e29fdeec350eabfc2ad129f7c60c1cb04..aaf7989b30b50199a5cd207952e93bcd60155278 100644 (file)
@@ -72,6 +72,7 @@
     #include <unistd.h>
 #endif // HAVE_POLL/!HAVE_POLL
 
+#include "wx/unix/private.h"
 #include "wx/gtk/win_gtk.h"
 
 #include <gtk/gtk.h>
@@ -306,23 +307,23 @@ int wxPoll(wxPollFd *ufds, unsigned int nfds, int timeout)
     fd_set readfds;
     fd_set writefds;
     fd_set exceptfds;
-    FD_ZERO(&readfds);
-    FD_ZERO(&writefds);
-    FD_ZERO(&exceptfds);
+    wxFD_ZERO(&readfds);
+    wxFD_ZERO(&writefds);
+    wxFD_ZERO(&exceptfds);
 
     unsigned int i;
     for ( i = 0; i < nfds; i++ )
     {
-        wxASSERT_MSG( ufds[i].fd < FD_SETSIZE, _T("fd out of range") );
+        wxASSERT_MSG( ufds[i].fd < wxFD_SETSIZE, _T("fd out of range") );
 
         if ( ufds[i].events & G_IO_IN )
-            FD_SET(ufds[i].fd, &readfds);
+            wxFD_SET(ufds[i].fd, &readfds);
 
         if ( ufds[i].events & G_IO_PRI )
-            FD_SET(ufds[i].fd, &exceptfds);
+            wxFD_SET(ufds[i].fd, &exceptfds);
 
         if ( ufds[i].events & G_IO_OUT )
-            FD_SET(ufds[i].fd, &writefds);
+            wxFD_SET(ufds[i].fd, &writefds);
 
         if ( ufds[i].fd > fdMax )
             fdMax = ufds[i].fd;
@@ -336,13 +337,13 @@ int wxPoll(wxPollFd *ufds, unsigned int nfds, int timeout)
     {
         ufds[i].revents = 0;
 
-        if ( FD_ISSET(ufds[i].fd, &readfds ) )
+        if ( wxFD_ISSET(ufds[i].fd, &readfds ) )
             ufds[i].revents |= G_IO_IN;
 
-        if ( FD_ISSET(ufds[i].fd, &exceptfds ) )
+        if ( wxFD_ISSET(ufds[i].fd, &exceptfds ) )
             ufds[i].revents |= G_IO_PRI;
 
-        if ( FD_ISSET(ufds[i].fd, &writefds ) )
+        if ( wxFD_ISSET(ufds[i].fd, &writefds ) )
             ufds[i].revents |= G_IO_OUT;
     }
 
index b72abe13b583251468babc02ed9932fb52b5354c..1ea0526a59267c6762d59ecc962f83d8b697d038 100644 (file)
@@ -1590,7 +1590,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
 #endif
 }
 
-void wxBitmap::UngetRawData(wxPixelDataBase& data)
+void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data))
 {
 }
 
@@ -1621,19 +1621,36 @@ wxBitmapHandler::~wxBitmapHandler()
 {
 }
 
-bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
+bool wxBitmapHandler::Create(wxBitmap * WXUNUSED(bitmap),
+                             void * WXUNUSED(data),
+                             long WXUNUSED(type),
+                             int WXUNUSED(width),
+                             int WXUNUSED(height),
+                             int WXUNUSED(depth))
 {
+    wxFAIL_MSG( _T("not implemented") );
+
     return false;
 }
 
-bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
-        int desiredWidth, int desiredHeight)
+bool wxBitmapHandler::LoadFile(wxBitmap * WXUNUSED(bitmap),
+                               const wxString& WXUNUSED(name),
+                               long WXUNUSED(flags),
+                               int WXUNUSED(desiredWidth),
+                               int WXUNUSED(desiredHeight))
 {
+    wxFAIL_MSG( _T("not implemented") );
+
     return false;
 }
 
-bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
+bool wxBitmapHandler::SaveFile(const wxBitmap * WXUNUSED(bitmap),
+                               const wxString& WXUNUSED(name),
+                               int WXUNUSED(type),
+                               const wxPalette * WXUNUSED(palette))
 {
+    wxFAIL_MSG( _T("not implemented") );
+
     return false;
 }
 
index 4b8aaa9de8807d82d1eec00e3ca2646f505ee897..ee5fdba2a54b49886b5e7adc754bd3b7d4ff7081 100644 (file)
@@ -844,12 +844,12 @@ void wxComboBox::OnChar( wxKeyEvent &event )
     if ( event.GetKeyCode() == WXK_RETURN )
     {
         // GTK automatically selects an item if its in the list
-        wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, GetId());
-        event.SetString( GetValue() );
-        event.SetInt( GetSelection() );
-        event.SetEventObject( this );
+        wxCommandEvent eventEnter(wxEVT_COMMAND_TEXT_ENTER, GetId());
+        eventEnter.SetString( GetValue() );
+        eventEnter.SetInt( GetSelection() );
+        eventEnter.SetEventObject( this );
 
-        if (!GetEventHandler()->ProcessEvent( event ))
+        if (!GetEventHandler()->ProcessEvent( eventEnter ))
         {
             // This will invoke the dialog default action, such
             // as the clicking the default button.
index 87bbe49cab9192b65e31c18df72b104458efe2ab..353ecd4501165dccf1ba71baac65ca25b5257c07 100644 (file)
@@ -88,9 +88,9 @@ void gdk_wx_draw_bitmap(GdkDrawable  *drawable,
                         gint         width,
                         gint         height)
 {
-    g_return_if_fail (drawable != NULL);
-    g_return_if_fail (src != NULL);
-    g_return_if_fail (gc != NULL);
+    wxCHECK_RET( drawable, _T("NULL drawable in gdk_wx_draw_bitmap") );
+    wxCHECK_RET( src, _T("NULL src in gdk_wx_draw_bitmap") );
+    wxCHECK_RET( gc, _T("NULL gc in gdk_wx_draw_bitmap") );
 
 #ifdef __WXGTK20__
     gint src_width, src_height;
index 10aed866ae9a10939b2b27cb3cbff82c321e3a72..fb6a78067ca56f9c3d11d180335c7b49ced7e0bf 100644 (file)
@@ -148,7 +148,8 @@ egg_tray_icon_get_type (void)
        (GInstanceInitFunc) egg_tray_icon_init
       };
 
-      our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
+      our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon",
+                                          &our_info, (GTypeFlags)0);
     }
 
   return our_type;
index 52e4bf8ff17cc18e474baa12aaf9e66db0fd2fdc..e5b773de6998925ea61a76e3f28579ce50147234 100644 (file)
@@ -106,7 +106,7 @@ static gint gtk_listitem_focus_in_callback( GtkWidget *widget,
     {
         // not yet, notify it
         win->m_hasFocus = TRUE;
-        
+
         wxChildFocusEvent eventChildFocus(win);
         (void)win->GetEventHandler()->ProcessEvent(eventChildFocus);
 
@@ -247,9 +247,9 @@ gtk_listbox_button_press_callback( GtkWidget *widget,
             for (i = 0; i < (int)listbox->GetCount(); i++)
                 if (i != sel)
                     gtk_list_unselect_item( GTK_LIST(listbox->m_list), i );
-                
+
             listbox->m_blockEvent = FALSE;
-            
+
             return false;
     }
 
@@ -310,21 +310,21 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
 #endif // wxUSE_CHECKLISTBOX
 
     // Check or uncheck item with SPACE
-    if ((gdk_event->keyval == ' ') && (!ret) && 
+    if ((gdk_event->keyval == ' ') && (!ret) &&
          (((listbox->GetWindowStyleFlag() & wxLB_MULTIPLE) != 0) ||
           ((listbox->GetWindowStyleFlag() & wxLB_EXTENDED) != 0)) )
     {
         int sel = listbox->GtkGetIndex( widget );
-        
+
         if (sel != -1)
         {
             ret = TRUE;
-            
+
             if (listbox->IsSelected( sel ))
                 gtk_list_unselect_item( listbox->m_list, sel );
             else
                 gtk_list_select_item( listbox->m_list, sel );
-            
+
             wxCommandEvent new_event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
             new_event.SetEventObject( listbox );
             wxArrayInt aSelections;
@@ -346,7 +346,7 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
             listbox->GetEventHandler()->ProcessEvent( new_event );
         }
     }
-    
+
     if (ret)
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
@@ -435,11 +435,11 @@ gtk_listbox_realized_callback( GtkWidget *m_widget, wxListBox *win )
 {
     if (g_isIdle)
         wxapp_install_idle_handler();
-        
+
     GList *child = win->m_list->children;
     for (child = win->m_list->children; child != NULL; child = child->next)
         gtk_widget_show( GTK_WIDGET(child->data) );
-    
+
     return false;
 }
 }
@@ -536,7 +536,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
     gtk_signal_connect( GTK_OBJECT(m_list), "realize",
                         GTK_SIGNAL_FUNC(gtk_listbox_realized_callback), (gpointer) this );
-                            
+
     if ( style & wxLB_SORT )
     {
         // this will change DoAppend() behaviour
@@ -730,7 +730,7 @@ void wxListBox::GtkAddItem( const wxString &item, int pos )
     if (GTK_WIDGET_REALIZED(m_widget))
     {
         gtk_widget_show( list_item );
-        
+
         gtk_widget_realize( list_item );
         gtk_widget_realize( GTK_BIN(list_item)->child );
 
@@ -745,8 +745,7 @@ void wxListBox::GtkAddItem( const wxString &item, int pos )
     {
         gtk_widget_modify_style( GTK_WIDGET( list_item ), style );
         GtkBin *bin = GTK_BIN( list_item );
-        GtkWidget *label = GTK_WIDGET( bin->child );
-        gtk_widget_modify_style( label, style );
+        gtk_widget_modify_style( GTK_WIDGET( bin->child ), style );
         gtk_rc_style_unref( style );
     }
 }
@@ -1131,7 +1130,7 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
 {
     return TRUE;
 
-#if 0    
+#if 0
     if (m_widget->window == window) return TRUE;
 
     if (GTK_WIDGET(m_list)->window == window) return TRUE;
@@ -1242,7 +1241,7 @@ wxSize wxListBox::DoGetBestSize() const
     lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
 
     wxSize best(lbWidth, lbHeight);
-    CacheBestSize(best);        
+    CacheBestSize(best);
     return best;
 }
 
index 0ebddfe17e1b42c8bdba10c2bdacb2060ab4abe7..26b690e4fd9fae541a7952b8e1642dfb5237492a 100644 (file)
@@ -1021,19 +1021,19 @@ void wxScrolledWindow::OnChar(wxKeyEvent& event)
     int xScroll = GetScrollPos(wxHORIZONTAL);
     if ( xScroll != xScrollOld )
     {
-        wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, xScroll,
-                               wxHORIZONTAL);
-        event.SetEventObject(this);
-        GetEventHandler()->ProcessEvent(event);
+        wxScrollWinEvent eventS(wxEVT_SCROLLWIN_THUMBTRACK, xScroll,
+                                wxHORIZONTAL);
+        eventS.SetEventObject(this);
+        GetEventHandler()->ProcessEvent(eventS);
     }
 
     int yScroll = GetScrollPos(wxVERTICAL);
     if ( yScroll != yScrollOld )
     {
-        wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, yScroll,
-                               wxVERTICAL);
-        event.SetEventObject(this);
-        GetEventHandler()->ProcessEvent(event);
+        wxScrollWinEvent eventS(wxEVT_SCROLLWIN_THUMBTRACK, yScroll,
+                                wxVERTICAL);
+        eventS.SetEventObject(this);
+        GetEventHandler()->ProcessEvent(eventS);
     }
 }
 
index c7e586c7992329ae2034ef84bcdedb893159bdd7..ad07a8affbb8249b21b71cccd13c333201758b25 100644 (file)
@@ -348,20 +348,20 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
                 GtkWidget *widget = gtk_button_new();
                 GtkStyle *def = gtk_rc_get_style( widget );
                 if ( !def || !def->font_desc )
-                    def = gtk_widget_get_default_style();  
+                    def = gtk_widget_get_default_style();
                 if ( def && def->font_desc )
-                {  
-                    wxNativeFontInfo info;  
-                    info.description = 
+                {
+                    wxNativeFontInfo info;
+                    info.description =
                         pango_font_description_copy(def->font_desc);
-                    gs_objects.m_fontSystem = wxFont(info);  
-                }  
-                else  
-                {  
+                    gs_objects.m_fontSystem = wxFont(info);
+                }
+                else
+                {
                     GtkSettings *settings = gtk_settings_get_default();
                     gchar *font_name = NULL;
                     g_object_get ( settings,
-                                   "gtk-font-name", 
+                                   "gtk-font-name",
                                    &font_name,
                                    NULL);
                     if (!font_name)
@@ -369,7 +369,7 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index )
                     else
                         gs_objects.m_fontSystem = wxFont(wxString::FromAscii(font_name));
                     g_free (font_name);
-                }  
+                }
                 gtk_widget_destroy( widget );
 #else
                 gs_objects.m_fontSystem = wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL );
@@ -387,7 +387,7 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
 {
 #ifdef __WXGTK20__
     bool success = false;
-            
+
     guchar *data = NULL;
     GdkWindow *window = NULL;
     if(win && GTK_WIDGET_REALIZED(win->GetHandle()))
@@ -428,15 +428,15 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
                         if (!gdk_net_wm_supports(gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
                             return -1;
                     }
-    
+
                     // Get the frame extents from the windowmanager.
                     // In most cases the top extent is the titlebar, so we use the bottom extent
                     // for the heights.
-    
+
                     Atom type;
                     gint format;
                     gulong nitems;
-                    
+
 #if GTK_CHECK_VERSION(2,2,0)
                     if (!gtk_check_version(2,2,0))
                     {
@@ -650,12 +650,12 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
 {
     switch (index)
     {
-        case wxSYS_CAN_ICONIZE_FRAME: 
-            return FALSE; 
-            break;
+        case wxSYS_CAN_ICONIZE_FRAME:
+            return FALSE;
+
         case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
-            return TRUE; 
-            break;
+            return TRUE;
+
         default:
             return FALSE;
     }
index a6920de7f98f4de5424c8a8eac037eb9bf4691a9..555803cd80603293e03826a3383c62960e5f057a 100644 (file)
@@ -428,15 +428,16 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
                 {
                     wxToolBarToolsList::compatibility_iterator node
                         = wxToolBarToolsList::compatibility_iterator();
-                    if ( pos ) node = m_tools.Item(pos - 1);
+                    if ( pos )
+                        node = m_tools.Item(pos - 1);
 
                     while ( node )
                     {
-                        wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
-                        if ( !tool->IsRadio() )
+                        wxToolBarTool *toolNext = (wxToolBarTool *)node->GetData();
+                        if ( !toolNext->IsRadio() )
                             break;
 
-                        widget = tool->m_item;
+                        widget = toolNext->m_item;
 
                         node = node->GetPrevious();
                     }
index 280f57a98b4b1331115edce7bb88c6a704b3a4b7..44222ba55c5b2c39ded0ce126bd129c4a456cfd5 100644 (file)
@@ -70,7 +70,7 @@ static void gtk_pizza_forall        (GtkContainer     *container,
                                      gboolean          include_internals,
                                      GtkCallback       callback,
                                      gpointer          callback_data);
-                                     
+
 static void     gtk_pizza_allocate_child     (GtkPizza      *pizza,
                                               GtkPizzaChild *child);
 static void     gtk_pizza_adjust_allocations_recurse (GtkWidget *widget,
@@ -102,7 +102,9 @@ static void  gtk_pizza_scroll_set_adjustments (GtkPizza      *pizza,
 static GtkContainerClass *pizza_parent_class = NULL;
 #endif
 
+#ifndef __WXGTK20__
 static gboolean gravity_works;
+#endif
 
 GtkType
 gtk_pizza_get_type ()
@@ -111,7 +113,7 @@ gtk_pizza_get_type ()
 
     if (!pizza_type)
     {
-    
+
 #ifdef __WXGTK20__
         static const GTypeInfo pizza_info =
         {
@@ -125,7 +127,7 @@ gtk_pizza_get_type ()
             16,             /* n_preallocs */
             (GInstanceInitFunc) gtk_pizza_init,
         };
-        pizza_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkPizza", &pizza_info, 0);
+        pizza_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkPizza", &pizza_info, (GTypeFlags)0);
 #else
         GtkTypeInfo pizza_info =
         {
@@ -404,7 +406,7 @@ gtk_pizza_move (GtkPizza     *pizza,
 
             child->x = x;
             child->y = y;
-            
+
             if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (pizza))
                 gtk_widget_queue_resize (widget);
             break;
@@ -642,7 +644,7 @@ gtk_pizza_realize (GtkWidget *widget)
     widget->style = gtk_style_attach (widget->style, widget->window);
     gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
     gtk_style_set_background (widget->style, pizza->bin_window, GTK_STATE_NORMAL );
+
 /*
     gdk_window_set_back_pixmap( widget->window, NULL, FALSE );
     gdk_window_set_back_pixmap( pizza->bin_window, NULL, FALSE );
@@ -652,10 +654,10 @@ gtk_pizza_realize (GtkWidget *widget)
     /* add filters for intercepting visibility and expose events */
     gdk_window_add_filter (widget->window, gtk_pizza_main_filter, pizza);
     gdk_window_add_filter (pizza->bin_window, gtk_pizza_filter, pizza);
-#endif
 
     /* we NEED gravity or we'll give up */
     gravity_works = gdk_window_set_static_gravities (pizza->bin_window, TRUE);
+#endif // !__WXGTK20__
 
     /* cannot be done before realisation */
     children = pizza->children;
@@ -836,9 +838,9 @@ gtk_pizza_expose (GtkWidget      *widget,
 #ifdef __WXGTK20__
 
     (* GTK_WIDGET_CLASS (pizza_parent_class)->expose_event) (widget, event);
-    
+
     return FALSE;
-    
+
 #else
 
     children = pizza->children;
@@ -856,9 +858,9 @@ gtk_pizza_expose (GtkWidget      *widget,
             gtk_widget_event (child->widget, (GdkEvent*) &child_event);
         }
     }
-    
+
     return TRUE;
-    
+
 #endif
 }
 
@@ -1104,7 +1106,7 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
 
     if (pizza->bin_window)
         gdk_window_scroll( pizza->bin_window, -dx, -dy );
-#else
+#else // !__WXGTK20__
     GtkWidget *widget;
     XEvent xevent;
     XID win;
@@ -1236,7 +1238,7 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
             }
         }
     }
-#endif /* __WXGTK20__ */
+#endif /* __WXGTK20__/!__WXGTK20__ */
 }
 
 
index 03c6f88e39f27021e4c775a414dcdc9d3f26c5fb..7bd13fae8e06856ead82b0b9bf709f22f1c7361f 100644 (file)
@@ -239,7 +239,9 @@ wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL;
 
 // hack: we need something to pass to gtk_menu_popup, so we store the time of
 // the last click here
+#ifndef __WXGTK20__
 static guint32 gs_timeLastClick = 0;
+#endif
 
 extern bool g_mainThreadLocked;
 
@@ -1388,9 +1390,9 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
 
         if ( btnCancel )
         {
-            wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
-            event.SetEventObject(btnCancel);
-            ret = btnCancel->GetEventHandler()->ProcessEvent(event);
+            wxCommandEvent eventClick(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
+            eventClick.SetEventObject(btnCancel);
+            ret = btnCancel->GetEventHandler()->ProcessEvent(eventClick);
         }
     }
 
@@ -1799,9 +1801,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
     if ( !g_captureWindow )
         win = FindWindowForMouseEvent(win, event.m_x, event.m_y);
 
+#ifndef __WXGTK20__
     gs_timeLastClick = gdk_event->time;
 
-#ifndef __WXGTK20__
     if (event_type == wxEVT_LEFT_DCLICK)
     {
         // GTK 1.2 crashes when intercepting double
@@ -1813,7 +1815,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
             return FALSE;
         }
     }
-#endif
+#endif // !__WXGTK20__
 
     if (win->GetEventHandler()->ProcessEvent( event ))
     {
@@ -1958,11 +1960,11 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget,
             // the mouse changed window
             g_captureWindowHasMouse = hasMouse;
 
-            wxMouseEvent event(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW
-                                                       : wxEVT_LEAVE_WINDOW);
-            InitMouseEvent(win, event, gdk_event);
-            event.SetEventObject(win);
-            win->GetEventHandler()->ProcessEvent(event);
+            wxMouseEvent eventM(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW
+                                                        : wxEVT_LEAVE_WINDOW);
+            InitMouseEvent(win, eventM, gdk_event);
+            eventM.SetEventObject(win);
+            win->GetEventHandler()->ProcessEvent(eventM);
         }
     }
     else // no capture
index de2498063f54a3b2859f4cc2f6a2e735108ad875..9aa5f8d1b9c37986da25969afde2da223a6adf92 100644 (file)
@@ -462,17 +462,17 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f)
         }
         else
         {
-            int cnt = 0;
+            int cnt2 = 0;
             wxHtmlHelpDataItem *parent = m_index[i].parent;
             for (int j = i-1; j >= 0; j--)
             {
                 if (m_index[j].book == book && m_index[j].level > 0)
-                    cnt++;
+                    cnt2++;
                 if (&m_index[j] == parent)
                     break;
             }
-            wxASSERT(cnt > 0);
-            CacheWriteInt32(f, cnt);
+            wxASSERT(cnt2 > 0);
+            CacheWriteInt32(f, cnt2);
         }
     }
     return true;
index b2db6ded5417907f78408fd291a208da62909254..b4538e4fa07032768ed14a35b3f3deb4b3f69b65 100644 (file)
@@ -646,8 +646,6 @@ void wxHtmlContainerCell::Layout(int w)
        return;
     }
 
-    wxHtmlCell *cell = m_Cells,
-               *line = m_Cells;
     wxHtmlCell *nextCell;
     long xpos = 0, ypos = m_IndentTop;
     int xdelta = 0, ybasicpos = 0, ydiff;
@@ -694,6 +692,8 @@ void wxHtmlContainerCell::Layout(int w)
     s_width = m_Width - s_indent - ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
 
     // my own layouting:
+    wxHtmlCell *cell = m_Cells,
+               *line = m_Cells;
     while (cell != NULL)
     {
         switch (m_AlignVer)
index f11ebb2af639545c73ba04200630125e5e37fba4..d6b6ab4c3230b96678f2e3c588c9405e6bc5c450 100644 (file)
@@ -52,7 +52,7 @@ public:
 };
 
 WX_DECLARE_OBJARRAY(wxHtmlTextPiece, wxHtmlTextPieces);
-WX_DEFINE_OBJARRAY(wxHtmlTextPieces);
+WX_DEFINE_OBJARRAY(wxHtmlTextPieces)
 
 class wxHtmlParserState
 {
index a1f8c33629daf9988083309acd2d0c81af8759e1..353f589c3aa1573b424e6821be66aec9cdd42e18 100644 (file)
@@ -135,10 +135,10 @@ private:
 //-----------------------------------------------------------------------------
 
 WX_DECLARE_OBJARRAY(wxHtmlHistoryItem, wxHtmlHistoryArray);
-WX_DEFINE_OBJARRAY(wxHtmlHistoryArray);
+WX_DEFINE_OBJARRAY(wxHtmlHistoryArray)
 
 WX_DECLARE_LIST(wxHtmlProcessor, wxHtmlProcessorList);
-WX_DEFINE_LIST(wxHtmlProcessorList);
+WX_DEFINE_LIST(wxHtmlProcessorList)
 
 //-----------------------------------------------------------------------------
 // wxHtmlWindow
index 75fe3adbd5b554ef76e244fc258c1ba045ca786d..c4e902cb96d54a0a5f62c47b3872f79d409de88a 100644 (file)
@@ -43,7 +43,7 @@ FORCE_LINK_ME(m_image)
 
 WX_DECLARE_OBJARRAY(int, CoordArray);
 #include "wx/arrimpl.cpp" // this is a magic incantation which must be done!
-WX_DEFINE_OBJARRAY(CoordArray);
+WX_DEFINE_OBJARRAY(CoordArray)
 
 
 // ---------------------------------------------------------------------------
@@ -692,12 +692,13 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
                 }
                 if (cel != NULL && tag.HasParam(wxT("HREF")))
                 {
-                    wxString tmp = tag.GetParam(wxT("HREF"));
-                    wxString target = wxEmptyString;
-                    if (tag.HasParam(wxT("TARGET"))) target = tag.GetParam(wxT("TARGET"));
-                    cel->SetLink( wxHtmlLinkInfo(tmp, target));
+                    wxString target;
+                    if (tag.HasParam(wxT("TARGET")))
+                        target = tag.GetParam(wxT("TARGET"));
+                    cel->SetLink(wxHtmlLinkInfo(tag.GetParam(wxT("HREF")), target));
                 }
-                if (cel != NULL) m_WParser->GetContainer()->InsertCell( cel );
+                if (cel != NULL)
+                    m_WParser->GetContainer()->InsertCell( cel );
             }
         }
 
index 9172b29717c13abe65868bac17991a370467ddeb..c2f7d4ac31d3b036a9ec5c3b427f4915c937896e 100644 (file)
@@ -42,6 +42,7 @@
 #pragma message enable nosimpint
 #endif
 
+#include "wx/unix/private.h"
 #include "wx/motif/private.h"
 
 static bool CheckForKeyUp(XEvent* event);
@@ -424,8 +425,8 @@ static void wxInputCallback( XtPointer, int* fd, XtInputId* )
         timeout.tv_sec = 0;
         timeout.tv_usec = 0;
 
-        FD_ZERO( &in );
-        FD_SET( *fd, &in );
+        wxFD_ZERO( &in );
+        wxFD_SET( *fd, &in );
 
         if( select( *fd + 1, &in, NULL, NULL, &timeout ) <= 0 )
             break;
@@ -445,8 +446,8 @@ static void wxBreakDispatch()
     timeout.tv_sec = 0;
     timeout.tv_usec = 0;
 
-    FD_ZERO( &in );
-    FD_SET( idleFds[0], &in );
+    wxFD_ZERO( &in );
+    wxFD_SET( idleFds[0], &in );
 
     if( select( idleFds[0] + 1, &in, NULL, NULL, &timeout ) > 0 )
         return;
index 08e2f9b0b81aa1332ea41ffc2bd114b17d8701e9..5dc05dd27967f62a6030c3a8887728bbc724434e 100644 (file)
@@ -293,7 +293,7 @@ public:
         wxDynamicLibraryDetails *details = new wxDynamicLibraryDetails;
         details->m_path = path;
         details->m_name = path.AfterLast(_T('/'));
-        details->m_address = wx_reinterpret_cast(void *, start);
+        details->m_address = wxUIntToPtr(start);
         details->m_length = end - start;
 
         // try to extract the library version from its name
index d01014ad640647b7ee6c3bbe1f47b67e99a23dc6..cf11e65ba8eea7076cc86dec31e355daf748d1d3 100644 (file)
@@ -43,8 +43,8 @@
 extern GtkWidget *wxGetRootWindow();
 #endif
 
-static int
-cmp_families (const void *a, const void *b)
+extern "C" int wxCMPFUNC_CONV
+wxCompareFamilies (const void *a, const void *b)
 {
   const char *a_name = pango_font_family_get_name (*(PangoFontFamily **)a);
   const char *b_name = pango_font_family_get_name (*(PangoFontFamily **)b);
@@ -77,7 +77,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
             wxTheApp->GetPangoContext(),
 #endif
             &families, &n_families );
-        qsort (families, n_families, sizeof (PangoFontFamily *), cmp_families);
+        qsort (families, n_families, sizeof (PangoFontFamily *), wxCompareFamilies);
 
         for (int i=0; i<n_families; i++)
         {
index d9a83d361e551fc25f17691b03dcfe661216942b..550b3d51b3496ca62ffe05f5c5482425c0b4e89d 100644 (file)
  * -------------------------------------------------------------------------
  */
 
-/*
- * PLEASE don't put C++ comments here - this is a C source file.
- */
-
 #if defined(__WATCOMC__)
 #include "wx/wxprec.h"
 #include <errno.h>
@@ -183,6 +179,7 @@ int _System soclose(int);
 
 #ifndef __GSOCKET_STANDALONE__
 #  include "wx/unix/gsockunx.h"
+#  include "wx/unix/private.h"
 #  include "wx/gsocket.h"
 #else
 #  include "gsockunx.h"
@@ -721,9 +718,9 @@ GSocketError GSocket::Connect(GSocketStream stream)
    * non-blocking, it just shouldn't be called prior to knowing there is a
    * connection _if_ blocking sockets are being used.
    * If connect above returns 0, we are already connected and need to make the
-   * call to Enable_Events now.  
+   * call to Enable_Events now.
    */
-  
+
   if (m_non_blocking || ret == 0)
   {
     gs_gui_functions->Enable_Events(this);
@@ -975,18 +972,18 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
 
     if (m_fd == -1)
         return (GSOCK_LOST_FLAG & flags);
-    
+
     /* Do not use a static struct, Linux can garble it */
     tv.tv_sec = m_timeout / 1000;
     tv.tv_usec = (m_timeout % 1000) * 1000;
 
-    FD_ZERO(&readfds);
-    FD_ZERO(&writefds);
-    FD_ZERO(&exceptfds);
-    FD_SET(m_fd, &readfds);
+    wxFD_ZERO(&readfds);
+    wxFD_ZERO(&writefds);
+    wxFD_ZERO(&exceptfds);
+    wxFD_SET(m_fd, &readfds);
     if (flags & GSOCK_OUTPUT_FLAG || flags & GSOCK_CONNECTION_FLAG)
-      FD_SET(m_fd, &writefds);
-    FD_SET(m_fd, &exceptfds);
+      wxFD_SET(m_fd, &writefds);
+    wxFD_SET(m_fd, &exceptfds);
 
     /* Check 'sticky' CONNECTION flag first */
     result |= (GSOCK_CONNECTION_FLAG & m_detected);
@@ -1009,7 +1006,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
     }
 
     /* Check for readability */
-    if (FD_ISSET(m_fd, &readfds))
+    if (wxFD_ISSET(m_fd, &readfds))
     {
       char c;
 
@@ -1038,7 +1035,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
     }
 
     /* Check for writability */
-    if (FD_ISSET(m_fd, &writefds))
+    if (wxFD_ISSET(m_fd, &writefds))
     {
       if (m_establishing && !m_server)
       {
@@ -1069,7 +1066,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
     }
 
     /* Check for exceptions and errors (is this useful in Unices?) */
-    if (FD_ISSET(m_fd, &exceptfds))
+    if (wxFD_ISSET(m_fd, &exceptfds))
     {
       m_establishing = false;
       m_detected = GSOCK_LOST_FLAG;
@@ -1250,8 +1247,8 @@ GSocketError GSocket::Input_Timeout()
 
   if (!m_non_blocking)
   {
-    FD_ZERO(&readfds);
-    FD_SET(m_fd, &readfds);
+    wxFD_ZERO(&readfds);
+    wxFD_SET(m_fd, &readfds);
     ret = select(m_fd + 1, &readfds, NULL, NULL, &tv);
     if (ret == 0)
     {
@@ -1291,8 +1288,8 @@ GSocketError GSocket::Output_Timeout()
 
   if (!m_non_blocking)
   {
-    FD_ZERO(&writefds);
-    FD_SET(m_fd, &writefds);
+    wxFD_ZERO(&writefds);
+    wxFD_SET(m_fd, &writefds);
     ret = select(m_fd + 1, NULL, &writefds, NULL, &tv);
     if (ret == 0)
     {
@@ -1310,7 +1307,7 @@ GSocketError GSocket::Output_Timeout()
       m_error = GSOCK_TIMEDOUT;
       return GSOCK_TIMEDOUT;
     }
-    if ( ! FD_ISSET(m_fd, &writefds) ) {
+    if ( ! wxFD_ISSET(m_fd, &writefds) ) {
         GSocket_Debug(( "GSocket_Output_Timeout is buggy!\n" ));
     }
     else {
index 27720ea24eca64b4dd7d377efcbf10c7fb21626e..fcb266cc1d9cb9a82fff3aaa3f9c61a9cc2795ca 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "wx/event.h"
 #include "wx/window.h"
+#include "wx/unix/private.h"
 
 enum {
     wxJS_AXIS_X = 0,
@@ -87,7 +88,7 @@ void* wxJoystickThread::Entry()
     fd_set read_fds;
     struct timeval time_out = {0, 0};
 
-    FD_ZERO(&read_fds);
+    wxFD_ZERO(&read_fds);
     while (true)
     {
         if (TestDestroy())
@@ -100,9 +101,9 @@ void* wxJoystickThread::Entry()
         else
             time_out.tv_usec = 10 * 1000; // check at least every 10 msec in blocking case
 
-        FD_SET(m_device, &read_fds);
+        wxFD_SET(m_device, &read_fds);
         select(m_device+1, &read_fds, NULL, NULL, &time_out);
-        if (FD_ISSET(m_device, &read_fds))
+        if (wxFD_ISSET(m_device, &read_fds))
         {
             memset(&j_evt, 0, sizeof(j_evt));
             read(m_device, &j_evt, sizeof(j_evt));
index d8f03b387601958927ebb91a523b315511e64a1b..e0bce49d8d4c0d12a8782bd71a9a28620294beb6 100644 (file)
@@ -1417,7 +1417,10 @@ bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
 // could adjust the code to ask confirmation if it already exists and
 // overwriteprompt is true, but this is currently ignored as *Associate* has
 // no overwrite prompt
-bool wxFileTypeImpl::SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt /*= true*/)
+bool
+wxFileTypeImpl::SetCommand(const wxString& cmd,
+                           const wxString& verb,
+                           bool WXUNUSED(overwriteprompt))
 {
     wxArrayString strExtensions;
     wxString strDesc, strIcon;
@@ -1441,7 +1444,7 @@ bool wxFileTypeImpl::SetCommand(const wxString& cmd, const wxString& verb, bool
 }
 
 // ignore index on the grouds that we only have one icon in a Unix file
-bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon /*= wxEmptyString*/, int /*index = 0*/)
+bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon, int WXUNUSED(index))
 {
     if (strIcon.empty()) return false;
     wxArrayString strExtensions;
index 14e588268ab0aec5930565eb9cf6698642395e35..94c3b21af2ab8e510897aabd45eeb3c044f541b4 100644 (file)
@@ -760,7 +760,7 @@ void *wxThreadInternal::PthreadStart(wxThread *thread)
 
         wxLogTrace(TRACE_THREADS,
                    _T("Thread %ld Entry() returned %lu."),
-                   THR_ID(pthread), (unsigned long)pthread->m_exitcode);
+                   THR_ID(pthread), wxPtrToUInt(pthread->m_exitcode));
 
         {
             wxCriticalSectionLocker lock(thread->m_critsect);
@@ -1215,42 +1215,21 @@ void wxThread::SetPriority(unsigned int prio)
         case STATE_PAUSED:
 #ifdef HAVE_THREAD_PRIORITY_FUNCTIONS
 #if defined(__LINUX__)
-// On Linux, pthread_setschedparam with SCHED_OTHER does not allow
-// a priority other than 0.  Instead, we use the BSD setpriority
-// which alllows us to set a 'nice' value between 20 to -20.  Only
-// super user can set a value less than zero (more negative yields
-// higher priority).  setpriority set the static priority of a process,
-// but this is OK since Linux is configured as a thread per process.
-            {
-                float   fPrio;
-                float  pSpan;
-                int            iPrio;
-
-                // Map Wx priorites (WXTHREAD_MIN_PRIORITY -
-                // WXTHREAD_MAX_PRIORITY) into BSD priorities (20 - -20).
-                // Do calculation of values instead of hard coding them
-                // to make maintenance easier.
-
-                pSpan = ((float)(WXTHREAD_MAX_PRIORITY - WXTHREAD_MIN_PRIORITY)) / 2.0;
-
-                // prio starts as ...................  // value =>  (0) >=  p  <=  (n)
-
-                fPrio = ((float)prio) -  pSpan;        // value =>  (-n) >=  p  <=  (+n)
-
-                fPrio = 0.0 - fPrio;                   // value =>  (+n) <=  p  >=  (-n)
-
-                fPrio = fPrio * (20. / pSpan) + .5;    // value =>  (20) <=  p  >=  (-20)
-
-                iPrio = (int)fPrio;
-
-                // Clamp prio from 20 - -20;
-                iPrio = (iPrio > 20)  ?  20 : iPrio;
-                iPrio = (iPrio < -20) ? -20 : iPrio;
+            // On Linux, pthread_setschedparam with SCHED_OTHER does not allow
+            // a priority other than 0.  Instead, we use the BSD setpriority
+            // which alllows us to set a 'nice' value between 20 to -20.  Only
+            // super user can set a value less than zero (more negative yields
+            // higher priority).  setpriority set the static priority of a
+            // process, but this is OK since Linux is configured as a thread
+            // per process.
+            //
+            // FIXME this is not true for 2.6!!
 
-                if (setpriority(PRIO_PROCESS, 0, iPrio) == -1)
-                {
-                    wxLogError(_("Failed to set thread priority %d."), prio);
-                }
+            // map wx priorites WXTHREAD_MIN_PRIORITY..WXTHREAD_MAX_PRIORITY
+            // to Unix priorities 20..-20
+            if ( setpriority(PRIO_PROCESS, 0, -(2*prio)/5 + 20) == -1 )
+            {
+                wxLogError(_("Failed to set thread priority %d."), prio);
             }
 #else // __LINUX__
             {
@@ -1541,7 +1520,8 @@ wxThread::~wxThread()
     if ( m_internal->GetState() != STATE_EXITED &&
          m_internal->GetState() != STATE_NEW )
     {
-        wxLogDebug(_T("The thread %ld is being destroyed although it is still running! The application may crash."), GetId());
+        wxLogDebug(_T("The thread %ld is being destroyed although it is still running! The application may crash."),
+                   (long)GetId());
     }
 
     m_critsect.Leave();
index b9e17c0c145fdbb4d4ebc4c51123678085f1fae2..62be2565e87cee71380ab24f22c5380056c31245 100644 (file)
@@ -15,8 +15,6 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#include <pwd.h>
-
 // for compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -35,6 +33,9 @@
 #include "wx/wfstream.h"
 
 #include "wx/unix/execute.h"
+#include "wx/unix/private.h"
+
+#include <pwd.h>
 
 #if wxUSE_STREAMS
 
@@ -425,8 +426,10 @@ bool wxPipeInputStream::CanRead() const
     const int fd = m_file->fd();
 
     fd_set readfds;
-    FD_ZERO(&readfds);
-    FD_SET(fd, &readfds);
+
+    wxFD_ZERO(&readfds);
+    wxFD_SET(fd, &readfds);
+
     switch ( select(fd + 1, &readfds, NULL, NULL, &tv) )
     {
         case -1:
@@ -454,13 +457,7 @@ bool wxPipeInputStream::CanRead() const
 // wxExecute: the real worker function
 // ----------------------------------------------------------------------------
 
-#ifdef __VMS
-    #pragma message disable codeunreachable
-#endif
-               
-long wxExecute(wxChar **argv,
-               int flags,
-               wxProcess *process)
+long wxExecute(wxChar **argv, int flags, wxProcess *process)
 {
     // for the sync execution, we return -1 to indicate failure, but for async
     // case we return 0 which is never a valid PID
@@ -609,7 +606,7 @@ long wxExecute(wxChar **argv,
         }
 
         execvp (*mb_argv, mb_argv);
-       
+
         fprintf(stderr, "execvp(");
         // CS changed ppc to ppc_ as ppc is not available under mac os CW Mach-O
         for ( char **ppc_ = mb_argv; *ppc_; ppc_++ )
@@ -677,12 +674,10 @@ long wxExecute(wxChar **argv,
         return traits->WaitForChild(execData);
     }
 
+#if !defined(__VMS) && !defined(__INTEL_COMPILER)
     return ERROR_RETURN_CODE;
-}
-
-#ifdef __VMS
-    #pragma message enable codeunreachable
 #endif
+}
 
 #undef ERROR_RETURN_CODE
 #undef ARGS_CLEANUP
index 6510b0d3dba9ac182475a21b5b8ccd222c5b97ce..c31f11ee97d4b372133c637790d00197ca271236 100644 (file)
@@ -53,6 +53,10 @@ static Atom _NET_SUPPORTED = 0;
     if (name == 0) name = XInternAtom((display), #name, False)
 
 
+// X11 Window is an int type, so use the macro to suppress warnings when
+// converting to it
+#define WindowCast(w) (Window)(wxPtrToUInt(w))
+
 // Is the window mapped?
 static bool IsMapped(Display *display, Window window)
 {
@@ -159,7 +163,7 @@ void wxSetIconsX11( WXDisplay* display, WXWindow window,
         }
 
         XChangeProperty( (Display*)display,
-                         (Window)window,
+                         WindowCast(window),
                          _NET_WM_ICON,
                          XA_CARDINAL, 32,
                          PropModeReplace,
@@ -169,10 +173,10 @@ void wxSetIconsX11( WXDisplay* display, WXWindow window,
     else
     {
         XDeleteProperty( (Display*)display,
-                         (Window)window,
+                         WindowCast(window),
                          _NET_WM_ICON );
     }
-#endif
+#endif // !wxUSE_NANOX
 }
 
 
@@ -186,7 +190,7 @@ void wxSetIconsX11( WXDisplay* display, WXWindow window,
 //     fullscreen is to remove decorations, resize it to cover entire screen
 //     and set WIN_LAYER_ABOVE_DOCK.
 //
-//     This doesn't always work, though. Specifically, at least kwin from 
+//     This doesn't always work, though. Specifically, at least kwin from
 //     KDE 3 ignores the hint. The only way to make kwin accept our request
 //     is to emulate the way Qt does it. That is, unmap the window, set
 //     _NET_WM_WINDOW_TYPE to _KDE_NET_WM_WINDOW_TYPE_OVERRIDE (KDE extension),
@@ -198,13 +202,13 @@ void wxSetIconsX11( WXDisplay* display, WXWindow window,
 //     window state which provides cleanest and simplest possible way of
 //     making a window fullscreen. WM-spec is a de-facto standard adopted
 //     by GNOME and KDE folks, but _NET_WM_STATE_FULLSCREEN isn't yet widely
-//     supported. As of January 2003, only GNOME 2's default WM Metacity 
+//     supported. As of January 2003, only GNOME 2's default WM Metacity
 //     implements, KDE will support it from version 3.2. At toolkits level,
 //     GTK+ >= 2.1.2 uses it as the only method of making windows fullscreen
 //     (that's why wxGTK will *not* switch to using gtk_window_fullscreen
 //     unless it has better compatibility with older WMs).
 //
-//     
+//
 //     This is what wxWidgets does in wxSetFullScreenStateX11:
 //       1) if _NET_WM_STATE_FULLSCREEN is supported, use it
 //       2) otherwise try WM-specific hacks (KDE, IceWM)
@@ -220,7 +224,7 @@ static void wxWinHintsSetLayer(Display *display, Window rootWnd,
                                Window window, int layer)
 {
     wxX11ErrorsSuspender noerrors(display);
-    
+
     XEvent xev;
 
     wxMAKE_ATOM( _WIN_LAYER, display );
@@ -264,7 +268,7 @@ static bool wxQueryWMspecSupport(Display *display, Window rootWnd, Atom feature)
 {
     wxMAKE_ATOM(_NET_SUPPORTING_WM_CHECK, display);
     wxMAKE_ATOM(_NET_SUPPORTED, display);
-      
+
     // FIXME: We may want to cache these checks. Note that we can't simply
     //        remember the results in global variable because the WM may go
     //        away and be replaced by another one! One possible approach
@@ -279,14 +283,14 @@ static bool wxQueryWMspecSupport(Display *display, Window rootWnd, Atom feature)
     //        is replaced by another one). This is what GTK+ 2 does.
     //        Let's do it only if it is needed, it requires changes to
     //        the event loop.
-  
+
     Atom type;
     Window *wins;
     Atom *atoms;
     int format;
     unsigned long after;
     unsigned long nwins, natoms;
-    
+
     // Is the WM ICCCM supporting?
     XGetWindowProperty(display, rootWnd,
                        _NET_SUPPORTING_WM_CHECK, 0, LONG_MAX,
@@ -326,7 +330,7 @@ static void wxWMspecSetState(Display *display, Window rootWnd,
                              Window window, int operation, Atom state)
 {
     wxMAKE_ATOM(_NET_WM_STATE, display);
-  
+
     if ( IsMapped(display, window) )
     {
         XEvent xev;
@@ -341,7 +345,7 @@ static void wxWMspecSetState(Display *display, Window rootWnd,
         xev.xclient.data.l[0] = operation;
         xev.xclient.data.l[1] = state;
         xev.xclient.data.l[2] = None;
-  
+
         XSendEvent(display, rootWnd,
                    False,
                    SubstructureRedirectMask | SubstructureNotifyMask,
@@ -367,7 +371,7 @@ static void wxWMspecSetFullscreen(Display *display, Window rootWnd,
 static bool wxKwinRunning(Display *display, Window rootWnd)
 {
     wxMAKE_ATOM(KWIN_RUNNING, display);
-    
+
     long *data;
     Atom type;
     int format;
@@ -386,7 +390,7 @@ static bool wxKwinRunning(Display *display, Window rootWnd)
     return retval;
 }
 
-// KDE's kwin is Qt-centric so much than no normal method of fullscreen 
+// KDE's kwin is Qt-centric so much than no normal method of fullscreen
 // mode will work with it. We have to carefully emulate the Qt way.
 static void wxSetKDEFullscreen(Display *display, Window rootWnd,
                                Window w, bool fullscreen, wxRect *origRect)
@@ -414,7 +418,7 @@ static void wxSetKDEFullscreen(Display *display, Window rootWnd,
 
     // it is necessary to unmap the window, otherwise kwin will ignore us:
     XSync(display, False);
-    
+
     bool wasMapped = IsMapped(display, w);
     if (wasMapped)
     {
@@ -423,7 +427,7 @@ static void wxSetKDEFullscreen(Display *display, Window rootWnd,
     }
 
     XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32,
-                       PropModeReplace, (unsigned char *) &data, lng);
+                    PropModeReplace, (unsigned char *) &data, lng);
     XSync(display, False);
 
     if (wasMapped)
@@ -431,8 +435,8 @@ static void wxSetKDEFullscreen(Display *display, Window rootWnd,
         XMapRaised(display, w);
         XSync(display, False);
     }
-    
-    wxWMspecSetState(display, rootWnd, w, 
+
+    wxWMspecSetState(display, rootWnd, w,
                      fullscreen ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE,
                      _NET_WM_STATE_STAYS_ON_TOP);
     XSync(display, False);
@@ -442,8 +446,8 @@ static void wxSetKDEFullscreen(Display *display, Window rootWnd,
         // NB: like many other WMs, kwin ignores the first request for a window
         //     position change after the window was mapped. This additional
         //     move+resize event will ensure that the window is restored in
-       //     exactly the same position as before it was made fullscreen
-       //     (because wxTopLevelWindow::ShowFullScreen will call SetSize, thus
+        //     exactly the same position as before it was made fullscreen
+        //     (because wxTopLevelWindow::ShowFullScreen will call SetSize, thus
         //     setting the position for the second time).
         XMoveResizeWindow(display, w,
                           origRect->x, origRect->y,
@@ -456,7 +460,7 @@ static void wxSetKDEFullscreen(Display *display, Window rootWnd,
 wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display,
                                                WXWindow rootWindow)
 {
-    Window root = (Window)rootWindow;
+    Window root = WindowCast(rootWindow);
     Display *disp = (Display*)display;
 
     // if WM supports _NET_WM_STATE_FULLSCREEN from wm-spec 1.2, use it:
@@ -467,7 +471,7 @@ wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display,
                    _T("detected _NET_WM_STATE_FULLSCREEN support"));
         return wxX11_FS_WMSPEC;
     }
-    
+
     // if the user is running KDE's kwin WM, use a legacy hack because
     // kwin doesn't understand any other method:
     if (wxKwinRunning(disp, root))
@@ -475,7 +479,7 @@ wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display,
         wxLogTrace(_T("fullscreen"), _T("detected kwin"));
         return wxX11_FS_KDE;
     }
-    
+
     // finally, fall back to ICCCM heuristic method:
     wxLogTrace(_T("fullscreen"), _T("unknown WM, using _WIN_LAYER"));
     return wxX11_FS_GENERIC;
@@ -490,8 +494,8 @@ void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow,
     // NB: please see the comment under "Fullscreen mode:" title above
     //     for implications of changing this code.
 
-    Window wnd = (Window)window;
-    Window root = (Window)rootWindow;
+    Window wnd = WindowCast(window);
+    Window root = WindowCast(rootWindow);
     Display *disp = (Display*)display;
 
     if (method == wxX11_FS_AUTODETECT)
@@ -533,7 +537,7 @@ int wxCharCodeXToWX(KeySym keySym)
         case XK_Control_L:
         case XK_Control_R:
             id = WXK_CONTROL; break;
-        case XK_Meta_L:  
+        case XK_Meta_L:
         case XK_Meta_R:
             id = WXK_ALT; break;
         case XK_BackSpace:
@@ -695,7 +699,7 @@ KeySym wxCharCodeWXToX(int id)
         case WXK_RETURN:        keySym = XK_Return; break;
         case WXK_SHIFT:         keySym = XK_Shift_L; break;
         case WXK_CONTROL:       keySym = XK_Control_L; break;
-        case WXK_ALT:           keySym = XK_Meta_L; break;            
+        case WXK_ALT:           keySym = XK_Meta_L; break;
         case WXK_MENU :         keySym = XK_Menu; break;
         case WXK_PAUSE:         keySym = XK_Pause; break;
         case WXK_ESCAPE:        keySym = XK_Escape; break;
@@ -782,7 +786,7 @@ bool wxGetKeyState(wxKeyCode key)
 #else
 #error  Add code to get the DISPLAY for this platform
 #endif
-    
+
     int iKey = wxCharCodeWXToX(key);
     int          iKeyMask = 0;
     Window       wDummy1, wDummy2;
@@ -792,7 +796,7 @@ bool wxGetKeyState(wxKeyCode key)
     KeyCode keyCode = XKeysymToKeycode(pDisplay,iKey);
     if (keyCode == NoSymbol)
         return false;
-    
+
     for (int i = 0; i < 8; ++i)
     {
         if ( map->modifiermap[map->max_keypermod * i] == keyCode)
@@ -800,14 +804,14 @@ bool wxGetKeyState(wxKeyCode key)
             iKeyMask = 1 << i;
         }
     }
-    
+
     XQueryPointer(pDisplay, DefaultRootWindow(pDisplay), &wDummy1, &wDummy2,
                   &iDummy3, &iDummy4, &iDummy5, &iDummy6, &iMask );
     XFreeModifiermap(map);
     return (iMask & iKeyMask) != 0;
 }
 
-#endif
+#endif // __WXX11__ || __WXGTK__ || __WXMOTIF__
 
 
 
index 4be027f7aa28e14479521886d1ead275a2249576..5167c4b918dae11223c47885898bfd2a8d62769e 100644 (file)
@@ -27,6 +27,7 @@
 #include "wx/timer.h"
 #include "wx/hash.h"
 #include "wx/module.h"
+#include "wx/unix/private.h"
 #include "wx/x11/private.h"
 #include "X11/Xlib.h"
 
@@ -174,14 +175,14 @@ void wxSocketTable::FillSets(fd_set* readset, fd_set* writeset, int* highest)
 
         if (entry->m_fdInput != -1)
         {
-            FD_SET(entry->m_fdInput, readset);
+            wxFD_SET(entry->m_fdInput, readset);
             if (entry->m_fdInput > *highest)
                 * highest = entry->m_fdInput;
         }
 
         if (entry->m_fdOutput != -1)
         {
-            FD_SET(entry->m_fdOutput, writeset);
+            wxFD_SET(entry->m_fdOutput, writeset);
             if (entry->m_fdOutput > *highest)
                 * highest = entry->m_fdOutput;
         }
@@ -198,12 +199,12 @@ void wxSocketTable::ProcessEvents(fd_set* readset, fd_set* writeset)
     {
         wxSocketTableEntry* entry = (wxSocketTableEntry*) node->GetData();
 
-        if (entry->m_fdInput != -1 && FD_ISSET(entry->m_fdInput, readset))
+        if (entry->m_fdInput != -1 && wxFD_ISSET(entry->m_fdInput, readset))
         {
             (entry->m_callbackInput) (entry->m_fdInput, entry->m_dataInput);
         }
 
-        if (entry->m_fdOutput != -1 && FD_ISSET(entry->m_fdOutput, writeset))
+        if (entry->m_fdOutput != -1 && wxFD_ISSET(entry->m_fdOutput, writeset))
         {
             (entry->m_callbackOutput) (entry->m_fdOutput, entry->m_dataOutput);
         }
@@ -455,10 +456,10 @@ bool wxEventLoop::Dispatch()
         fd_set readset;
         fd_set writeset;
         int highest = fd;
-        FD_ZERO(&readset);
-        FD_ZERO(&writeset);
+        wxFD_ZERO(&readset);
+        wxFD_ZERO(&writeset);
 
-        FD_SET(fd, &readset);
+        wxFD_SET(fd, &readset);
 
 #if wxUSE_SOCKETS
         if (wxTheSocketTable)
@@ -473,7 +474,7 @@ bool wxEventLoop::Dispatch()
         else
         {
             // An X11 event was pending, so get it
-            if (FD_ISSET( fd, &readset ))
+            if (wxFD_ISSET( fd, &readset ))
                 XNextEvent( wxGlobalDisplay(), &event );
 
 #if wxUSE_SOCKETS
index 37855b675c15ee6843218701bb1f2fbc75b11613..ba4e8648705a26cb6e345481447b37eac1c8226e 100644 (file)
@@ -42,7 +42,7 @@
 #include "wx/xrc/xmlres.h"
 
 #include "wx/arrimpl.cpp"
-WX_DEFINE_OBJARRAY(wxXmlResourceDataRecords);
+WX_DEFINE_OBJARRAY(wxXmlResourceDataRecords)
 
 
 wxXmlResource *wxXmlResource::ms_instance = NULL;
@@ -679,7 +679,7 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent,
 
 #include "wx/listimpl.cpp"
 WX_DECLARE_LIST(wxXmlSubclassFactory, wxXmlSubclassFactoriesList);
-WX_DEFINE_LIST(wxXmlSubclassFactoriesList);
+WX_DEFINE_LIST(wxXmlSubclassFactoriesList)
 
 wxXmlSubclassFactoriesList *wxXmlResource::ms_subclassFactories = NULL;
 
@@ -936,7 +936,7 @@ float wxXmlResourceHandler::GetFloat(const wxString& param, float defaultv)
     setlocale(LC_NUMERIC, prevlocale);
 #endif
 
-    return value;
+    return wx_truncate_cast(float, value);
 }
 
 
index 5414a3f4c21eeecdd148ab93d2a2c14335568f26..9d90ec07eb7997b9b4a0f18d8bb02c436073ba89 100644 (file)
@@ -43,7 +43,7 @@ private:
 
 #include "wx/arrimpl.cpp"
 WX_DECLARE_OBJARRAY(XRCWidgetData,ArrayOfXRCWidgetData);
-WX_DEFINE_OBJARRAY(ArrayOfXRCWidgetData);
+WX_DEFINE_OBJARRAY(ArrayOfXRCWidgetData)
 
 class XRCWndClassData
 {
@@ -148,7 +148,7 @@ public:
     };
 };
 WX_DECLARE_OBJARRAY(XRCWndClassData,ArrayOfXRCWndClassData);
-WX_DEFINE_OBJARRAY(ArrayOfXRCWndClassData);
+WX_DEFINE_OBJARRAY(ArrayOfXRCWndClassData)
 
 
 class XmlResApp : public wxAppConsole
@@ -502,8 +502,9 @@ static wxString FileToCppArray(wxString filename, int num)
     wxFFile file(filename, wxT("rb"));
     wxFileOffset offset = file.Length();
     wxASSERT_MSG( offset >= 0 , wxT("Invalid file length") );
-    wxASSERT_MSG( offset == wxFileOffset(size_t(offset)) , wxT("Huge file not supported") );
-    size_t lng = (size_t)offset;
+
+    const size_t lng = wx_truncate_cast(size_t, offset);
+    wxASSERT_MSG( lng == offset, wxT("Huge file not supported") );
 
     snum.Printf(_T("%i"), num);
     output.Printf(_T("static size_t xml_res_size_") + snum + _T(" = %i;\n"), lng);
@@ -628,8 +629,9 @@ static wxString FileToPythonArray(wxString filename, int num)
     wxFFile file(filename, wxT("rb"));
     wxFileOffset offset = file.Length();
     wxASSERT_MSG( offset >= 0 , wxT("Invalid file length") );
-    wxASSERT_MSG( offset == wxFileOffset(size_t(offset)) , wxT("Huge file not supported") );
-    size_t lng = (size_t)offset;
+
+    const size_t lng = wx_truncate_cast(size_t, offset);
+    wxASSERT_MSG( offset == lng, wxT("Huge file not supported") );
 
     snum.Printf(_T("%i"), num);
     output = _T("    xml_res_file_") + snum + _T(" = '''\\\n");