first round of Intel compiler warning fixes: down from a few thousands just to slightly more than 100

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-09-25 19:59:19 +00:00
parent bd090f77ee
commit 17a1ebd101
86 changed files with 713 additions and 519 deletions

View File

@@ -72,6 +72,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/unix/execute.h wx/unix/execute.h
wx/unix/mimetype.h wx/unix/mimetype.h
wx/unix/pipe.h wx/unix/pipe.h
wx/unix/private.h
wx/unix/stackwalk.h wx/unix/stackwalk.h
wx/unix/stdpaths.h wx/unix/stdpaths.h
</set> </set>

12
configure vendored
View File

@@ -14043,7 +14043,6 @@ if test "x$XLCXX" = "xyes" -a "x$USE_AIX" = "x1"; then
CXXFLAGS="$CXXFLAGS -qunique" CXXFLAGS="$CXXFLAGS -qunique"
fi fi
case "${host}" in case "${host}" in
powerpc-*-darwin* ) powerpc-*-darwin* )
echo "$as_me:$LINENO: checking if __POWERPC__ is already defined" >&5 echo "$as_me:$LINENO: checking if __POWERPC__ is already defined" >&5
@@ -42627,9 +42626,16 @@ fi
INCLUDES="-I\${top_builddir}lib/wx/include/${TOOLCHAIN_FULLNAME} \ INCLUDES="-I\${top_builddir}lib/wx/include/${TOOLCHAIN_FULLNAME} \
-I\${top_srcdir}/include $TOOLKIT_INCLUDE" -I\${top_srcdir}/include $TOOLKIT_INCLUDE"
if test "$GXX" = yes ; then if test "$GCC" = yes ; then
CWARNINGS="-Wall -wd810,869,981,1418,1572,1684"
elif test "$GCC" = yes ; then
CWARNINGS="-Wall -Wundef" CWARNINGS="-Wall -Wundef"
CXXWARNINGS="$CWARNINGS -Wno-ctor-dtor-privacy" 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 fi
EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE" EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE"

View File

@@ -1517,7 +1517,6 @@ if test "x$XLCXX" = "xyes" -a "x$USE_AIX" = "x1"; then
CXXFLAGS="$CXXFLAGS -qunique" CXXFLAGS="$CXXFLAGS -qunique"
fi fi
dnl This case is for PowerPC OS X vs. everything else dnl This case is for PowerPC OS X vs. everything else
case "${host}" in case "${host}" in
powerpc-*-darwin* ) powerpc-*-darwin* )
@@ -6850,10 +6849,42 @@ INCLUDES="-I\${top_builddir}lib/wx/include/${TOOLCHAIN_FULLNAME} \
-I\${top_srcdir}/include $TOOLKIT_INCLUDE" -I\${top_srcdir}/include $TOOLKIT_INCLUDE"
dnl C/C++ compiler options used to compile wxWidgets dnl C/C++ compiler options used to compile wxWidgets
if test "$GXX" = yes ; then dnl
dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror" 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" 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 fi
EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE" EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE"

View File

@@ -661,6 +661,7 @@ public:
} \ } \
wxAppInitializer \ wxAppInitializer \
wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \ wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
DECLARE_APP(appname) \
appname& wxGetApp() { return *(appname *)wxTheApp; } appname& wxGetApp() { return *(appname *)wxTheApp; }
// Same as IMPLEMENT_APP() normally but doesn't include themes support in // Same as IMPLEMENT_APP() normally but doesn't include themes support in
@@ -684,5 +685,13 @@ public:
// function // function
#define DECLARE_APP(appname) extern appname& wxGetApp(); #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_ #endif // _WX_APP_H_BASE_

View File

@@ -112,13 +112,14 @@
// Use this macro to check build options. Adding it to a file in DLL will // 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. // ensure that the DLL checks build options in same way IMPLEMENT_APP() does.
#define WX_CHECK_BUILD_OPTIONS(libName) \ #define WX_CHECK_BUILD_OPTIONS(libName) \
static bool wxCheckBuildOptions() \ static struct wxBuildOptionsChecker \
{ \
wxBuildOptionsChecker() \
{ \ { \
wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \ wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
libName); \ libName); \
return true; \
} \ } \
static bool gs_buildOptionsCheck = wxCheckBuildOptions(); } gs_buildOptionsCheck;
#if WXWIN_COMPATIBILITY_2_4 #if WXWIN_COMPATIBILITY_2_4

View File

@@ -318,7 +318,13 @@ public:
// ctor: you can specify the text here or in SetText(), or override // ctor: you can specify the text here or in SetText(), or override
// GetText() // GetText()
wxTextDataObject(const wxString& text = wxEmptyString) 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) m_text(text)
{ {
} }
@@ -332,19 +338,8 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
// ---------------------------------- // ----------------------------------
#if wxUSE_UNICODE && defined(__WXGTK20__) // some platforms have 2 and not 1 format for text data
virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; } #if wxUSE_UNICODE && (defined(__WXGTK20__) || defined(__WXMAC__))
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__)
virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; } virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; }
virtual void GetAllFormats(wxDataFormat *formats, virtual void GetAllFormats(wxDataFormat *formats,
wxDataObjectBase::Direction WXUNUSED(dir) = Get) const; wxDataObjectBase::Direction WXUNUSED(dir) = Get) const;

View File

@@ -297,7 +297,23 @@ typedef int wxWindowID;
truncate from a larger to smaller type, static_cast<> can't be used for it 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) 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 */ /* for consistency with wxStatic/DynamicCast defined in wx/object.h */
#define wxConstCast(obj, className) wx_const_cast(className *, obj) #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 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 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__ #if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(disable: 4311) /* pointer truncation from '' to '' */ #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 #endif
return wx_reinterpret_cast(wxUIntPtr, p); return wx_reinterpret_cast(wxUIntPtr, p);
#ifdef __VISUALC__ #if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(default: 4311) #pragma warning(pop)
#endif #endif
} }
inline void *wxUIntToPtr(wxUIntPtr p) inline void *wxUIntToPtr(wxUIntPtr p)
{ {
#ifdef __VISUALC__ #if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(disable: 4312) /* conversion to type of greater size */ #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 #endif
return wx_reinterpret_cast(void *, p); return wx_reinterpret_cast(void *, p);
#ifdef __VISUALC__ #if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(default: 4312) #pragma warning(pop)
#endif #endif
} }
#endif /*__cplusplus*/ #endif /*__cplusplus*/

View 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 // append all element of one array to another one
#define WX_APPEND_ARRAY(array, other) \ #define WX_APPEND_ARRAY(array, other) \
{ \ { \
size_t count = (other).size(); \ size_t wxAAcnt = (other).size(); \
for ( size_t n = 0; n < count; n++ ) \ 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)! // count on it)!
#define WX_CLEAR_ARRAY(array) \ #define WX_CLEAR_ARRAY(array) \
{ \ { \
size_t count = (array).size(); \ size_t wxAAcnt = (array).size(); \
for ( size_t n = 0; n < count; n++ ) \ for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \
{ \ { \
delete (array)[n]; \ delete (array)[wxAAn]; \
} \ } \
\ \
(array).clear(); \ (array).clear(); \

View File

@@ -63,7 +63,8 @@ public:
bool GetValue() const; bool GetValue() const;
// Set the label // 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); bool Enable(bool enable = TRUE);
static wxVisualAttributes static wxVisualAttributes

View File

@@ -63,7 +63,8 @@ public:
bool GetValue() const; bool GetValue() const;
// Set the label // 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); bool Enable(bool enable = TRUE);
static wxVisualAttributes static wxVisualAttributes

View File

@@ -139,10 +139,10 @@ public:
// accessors // accessors
// get high part // get high part
long GetHi() const long GetHi() const
{ return (long)(m_ll >> 32); } { return wx_truncate_cast(long, m_ll >> 32); }
// get low part // get low part
unsigned long GetLo() const unsigned long GetLo() const
{ return (unsigned long)m_ll; } { return wx_truncate_cast(unsigned long, m_ll); }
// get absolute value // get absolute value
wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); } wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); }
@@ -157,12 +157,12 @@ public:
wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX), wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX),
_T("wxLongLong to long conversion loss of precision") ); _T("wxLongLong to long conversion loss of precision") );
return (long)m_ll; return wx_truncate_cast(long, m_ll);
} }
#if wxABI_VERSION >= 20602 #if wxABI_VERSION >= 20602
// convert to double // convert to double
double ToDouble() const { return m_ll; } double ToDouble() const { return wx_truncate_cast(double, m_ll); }
#endif // ABI >= 2.6.2 #endif // ABI >= 2.6.2
// don't provide implicit conversion to wxLongLong_t or we will have an // don't provide implicit conversion to wxLongLong_t or we will have an
@@ -344,10 +344,10 @@ public:
// accessors // accessors
// get high part // get high part
unsigned long GetHi() const unsigned long GetHi() const
{ return (unsigned long)(m_ll >> 32); } { return wx_truncate_cast(unsigned long, m_ll >> 32); }
// get low part // get low part
unsigned long GetLo() const unsigned long GetLo() const
{ return (unsigned long)m_ll; } { return wx_truncate_cast(unsigned long, m_ll); }
// convert to native ulong long // convert to native ulong long
wxULongLong_t GetValue() const { return m_ll; } wxULongLong_t GetValue() const { return m_ll; }
@@ -358,7 +358,7 @@ public:
wxASSERT_MSG( m_ll <= LONG_MAX, wxASSERT_MSG( m_ll <= LONG_MAX,
_T("wxULongLong to long conversion loss of precision") ); _T("wxULongLong to long conversion loss of precision") );
return (unsigned long)m_ll; return wx_truncate_cast(unsigned long, m_ll);
} }
// operations // operations

View File

@@ -98,4 +98,17 @@ inline bool wxIsSameDouble(double x, double y) { return x == y; }
#endif /* __cplusplus */ #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_ */ #endif /* _WX_MATH_H_ */

View File

@@ -13,7 +13,7 @@
#define _WX_FONT_H_ #define _WX_FONT_H_
#if __WXMOTIF20__ && !__WXLESSTIF__ #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 #else
#define wxMOTIF_NEW_FONT_HANDLING 0 #define wxMOTIF_NEW_FONT_HANDLING 0
#endif #endif

View File

@@ -476,6 +476,10 @@
# endif # endif
#endif #endif
#ifdef __INTEL_COMPILER
# define __INTELC__
#endif
/* /*
We get "Large Files (ILP32) not supported in strict ANSI mode." #error We get "Large Files (ILP32) not supported in strict ANSI mode." #error
from HP-UX standard headers when compiling with g++ without this: from HP-UX standard headers when compiling with g++ without this:

View File

@@ -45,7 +45,7 @@
#define wxPOST_NO_WARNING_SCOPE(name) #define wxPOST_NO_WARNING_SCOPE(name)
#else #else
#define wxPRE_NO_WARNING_SCOPE(name) do #define wxPRE_NO_WARNING_SCOPE(name) do
#define wxPOST_NO_WARNING_SCOPE(name) while ( 0 ) #define wxPOST_NO_WARNING_SCOPE(name) while ( wxFalse )
#endif #endif
#define wxCHECKED_DELETE(ptr) \ #define wxCHECKED_DELETE(ptr) \

47
include/wx/unix/private.h Normal file
View File

@@ -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_

View File

@@ -721,7 +721,11 @@ static wxString GetAssertStackTrace()
protected: protected:
virtual void OnStackFrame(const wxStackFrame& frame) 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(); wxString name = frame.GetName();
if ( !name.empty() ) if ( !name.empty() )
@@ -730,11 +734,8 @@ static wxString GetAssertStackTrace()
} }
else else
{ {
m_stackTrace << wxString::Format m_stackTrace << wxString::Format(_T("0x%08p"),
( frame.GetAddress());
_T("0x%08lx"),
(unsigned long)frame.GetAddress()
);
} }
if ( frame.HasSourceLocation() ) if ( frame.HasSourceLocation() )

View File

@@ -330,9 +330,11 @@ wxHelpProvider::~wxHelpProvider()
// wxSimpleHelpProvider // wxSimpleHelpProvider
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#define WINHASH_KEY(w) wxPtrToUInt(w)
wxString wxSimpleHelpProvider::GetHelp(const wxWindowBase *window) 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() ) if ( it == m_hashWindows.end() )
{ {
@@ -346,8 +348,8 @@ wxString wxSimpleHelpProvider::GetHelp(const wxWindowBase *window)
void wxSimpleHelpProvider::AddHelp(wxWindowBase *window, const wxString& text) void wxSimpleHelpProvider::AddHelp(wxWindowBase *window, const wxString& text)
{ {
m_hashWindows.erase((long)window); m_hashWindows.erase(WINHASH_KEY(window));
m_hashWindows[(long)window] = text; m_hashWindows[WINHASH_KEY(window)] = text;
} }
void wxSimpleHelpProvider::AddHelp(wxWindowID id, const wxString& text) void wxSimpleHelpProvider::AddHelp(wxWindowID id, const wxString& text)
@@ -360,7 +362,7 @@ void wxSimpleHelpProvider::AddHelp(wxWindowID id, const wxString& text)
// removes the association // removes the association
void wxSimpleHelpProvider::RemoveHelp(wxWindowBase* window) void wxSimpleHelpProvider::RemoveHelp(wxWindowBase* window)
{ {
m_hashWindows.erase((long)window); m_hashWindows.erase(WINHASH_KEY(window));
} }
bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window) bool wxSimpleHelpProvider::ShowHelp(wxWindowBase *window)

View 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 // find two strings not occurring in format (this is surely
// not the optimal way of doing it... improvements welcome!) // not the optimal way of doing it... improvements welcome!)
wxString fmt = format; wxString fmt2 = format;
wxString replacement = (wxChar)-1; wxString replacement = (wxChar)-1;
while ( fmt.Find(replacement) != wxNOT_FOUND ) while ( fmt2.Find(replacement) != wxNOT_FOUND )
{ {
replacement << (wxChar)-1; replacement << (wxChar)-1;
} }
wxString replacement2 = (wxChar)-2; wxString replacement2 = (wxChar)-2;
while ( fmt.Find(replacement) != wxNOT_FOUND ) while ( fmt2.Find(replacement) != wxNOT_FOUND )
{ {
replacement << (wxChar)-2; replacement << (wxChar)-2;
} }
// replace all occurrences of year with it // replace all occurrences of year with it
bool wasReplaced = fmt.Replace(strYear, replacement) > 0; bool wasReplaced = fmt2.Replace(strYear, replacement) > 0;
if ( !wasReplaced ) if ( !wasReplaced )
wasReplaced = fmt.Replace(strYear2, replacement2) > 0; wasReplaced = fmt2.Replace(strYear2, replacement2) > 0;
// use strftime() to format the same date but in supported // use strftime() to format the same date but in supported
// year // year

View File

@@ -19,6 +19,7 @@
#if wxUSE_STREAMS #if wxUSE_STREAMS
#include "wx/datstrm.h" #include "wx/datstrm.h"
#include "wx/math.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// wxDataInputStream // wxDataInputStream
@@ -78,16 +79,13 @@ wxUint8 wxDataInputStream::Read8()
return (wxUint8)buf; return (wxUint8)buf;
} }
// Must be at global scope for VC++ 5
extern "C" double ConvertFromIeeeExtended(const unsigned char *bytes);
double wxDataInputStream::ReadDouble() double wxDataInputStream::ReadDouble()
{ {
#if wxUSE_APPLE_IEEE #if wxUSE_APPLE_IEEE
char buf[10]; char buf[10];
m_input->Read(buf, 10); m_input->Read(buf, 10);
return ConvertFromIeeeExtended((unsigned char *)buf); return ConvertFromIeeeExtended((const wxInt8 *)buf);
#else #else
return 0.0; return 0.0;
#endif #endif
@@ -321,15 +319,12 @@ void wxDataOutputStream::WriteString(const wxString& string)
m_output->Write(buf, len); 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) void wxDataOutputStream::WriteDouble(double d)
{ {
char buf[10]; char buf[10];
#if wxUSE_APPLE_IEEE #if wxUSE_APPLE_IEEE
ConvertToIeeeExtended(d, (unsigned char *)buf); ConvertToIeeeExtended(d, (wxInt8 *)buf);
#else #else
#if !defined(__VMS__) && !defined(__GNUG__) #if !defined(__VMS__) && !defined(__GNUG__)
# pragma warning "wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!" # pragma warning "wxDataOutputStream::WriteDouble() not using IeeeExtended - will not work!"

View File

@@ -106,12 +106,16 @@ TextElement(wxXmlNode *node, const wxChar *name, const wxString& value)
nodeChild->AddChild(new wxXmlNode(wxXML_TEXT_NODE, wxEmptyString, value)); nodeChild->AddChild(new wxXmlNode(wxXML_TEXT_NODE, wxEmptyString, value));
} }
#if wxUSE_CRASHREPORT && defined(__INTEL__)
static inline void static inline void
HexElement(wxXmlNode *node, const wxChar *name, unsigned long value) HexElement(wxXmlNode *node, const wxChar *name, unsigned long value)
{ {
TextElement(node, name, wxString::Format(_T("%08lx"), value)); TextElement(node, name, wxString::Format(_T("%08lx"), value));
} }
#endif // wxUSE_CRASHREPORT
#if wxUSE_STACKWALKER #if wxUSE_STACKWALKER
// ============================================================================ // ============================================================================
@@ -371,7 +375,7 @@ bool wxDebugReport::DoAddLoadedModules(wxXmlNode *nodeModules)
size_t len = 0; size_t len = 0;
if ( info.GetAddress(&addr, &len) ) if ( info.GetAddress(&addr, &len) )
{ {
HexProperty(nodeModule, _T("address"), (unsigned long)addr); HexProperty(nodeModule, _T("address"), wxPtrToUInt(addr));
HexProperty(nodeModule, _T("size"), len); HexProperty(nodeModule, _T("size"), len);
} }
@@ -397,7 +401,7 @@ bool wxDebugReport::DoAddExceptionInfo(wxXmlNode *nodeContext)
HexProperty(nodeExc, _T("code"), c.code); HexProperty(nodeExc, _T("code"), c.code);
nodeExc->AddProperty(_T("name"), c.GetExceptionString()); nodeExc->AddProperty(_T("name"), c.GetExceptionString());
HexProperty(nodeExc, _T("address"), (unsigned long)c.addr); HexProperty(nodeExc, _T("address"), wxPtrToUInt(c.addr));
#ifdef __INTEL__ #ifdef __INTEL__
wxXmlNode *nodeRegs = new wxXmlNode(wxXML_ELEMENT_NODE, _T("registers")); wxXmlNode *nodeRegs = new wxXmlNode(wxXML_ELEMENT_NODE, _T("registers"));

View 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_COMMON(T, name) \
_WX_DEFINE_BASEARRAY_NOCOMMON(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(const void *, wxBaseArrayPtrVoid)
_WX_DEFINE_BASEARRAY(short, wxBaseArrayShort) _WX_DEFINE_BASEARRAY(short, wxBaseArrayShort)
_WX_DEFINE_BASEARRAY(int, wxBaseArrayInt) _WX_DEFINE_BASEARRAY(int, wxBaseArrayInt)
@@ -417,6 +423,10 @@ _WX_DEFINE_BASEARRAY(long, wxBaseArrayLong)
_WX_DEFINE_BASEARRAY(size_t, wxBaseArraySizeT) _WX_DEFINE_BASEARRAY(size_t, wxBaseArraySizeT)
_WX_DEFINE_BASEARRAY(double, wxBaseArrayDouble) _WX_DEFINE_BASEARRAY(double, wxBaseArrayDouble)
#ifdef __INTELC__
#pragma warning(pop)
#endif
#if wxUSE_STL #if wxUSE_STL
#include "wx/arrstr.h" #include "wx/arrstr.h"

View File

@@ -105,7 +105,7 @@
* and a 64-bit mantissa, with no hidden bit. * and a 64-bit mantissa, with no hidden bit.
****************************************************************/ ****************************************************************/
wxFloat64 ConvertFromIeeeExtended(wxInt8* bytes) wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes)
{ {
wxFloat64 f; wxFloat64 f;
wxInt32 expon; wxInt32 expon;

View File

@@ -104,7 +104,7 @@ bool wxFFile::ReadAll(wxString *str, wxMBConv& conv)
wxCHECK_MSG( str, false, wxT("invalid parameter") ); wxCHECK_MSG( str, false, wxT("invalid parameter") );
wxCHECK_MSG( IsOpened(), false, wxT("can't read from closed file") ); wxCHECK_MSG( IsOpened(), false, wxT("can't read from closed file") );
wxCHECK_MSG( Length() >= 0, false, wxT("invalid length") ); 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") ); wxCHECK_MSG( (wxFileOffset)length == Length(), false, wxT("huge file not supported") );
clearerr(m_fp); clearerr(m_fp);

View File

@@ -450,16 +450,16 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName,
{ {
if ( !m_strLocalFile.empty() && !wxIsAbsolutePath(m_strLocalFile) ) if ( !m_strLocalFile.empty() && !wxIsAbsolutePath(m_strLocalFile) )
{ {
wxString strLocal = m_strLocalFile; const wxString strLocalOrig = m_strLocalFile;
m_strLocalFile = GetLocalDir(); m_strLocalFile = GetLocalDir();
m_strLocalFile << strLocal; m_strLocalFile << strLocalOrig;
} }
if ( !m_strGlobalFile.empty() && !wxIsAbsolutePath(m_strGlobalFile) ) if ( !m_strGlobalFile.empty() && !wxIsAbsolutePath(m_strGlobalFile) )
{ {
wxString strGlobal = m_strGlobalFile; const wxString strGlobalOrig = m_strGlobalFile;
m_strGlobalFile = GetGlobalDir(); m_strGlobalFile = GetGlobalDir();
m_strGlobalFile << strGlobal; m_strGlobalFile << strGlobalOrig;
} }
} }
@@ -664,7 +664,7 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal)
} }
} }
else { // a key else { // a key
const wxChar *pEnd = pStart; pEnd = pStart;
while ( *pEnd && *pEnd != wxT('=') /* && !wxIsspace(*pEnd)*/ ) { while ( *pEnd && *pEnd != wxT('=') /* && !wxIsspace(*pEnd)*/ ) {
if ( *pEnd == wxT('\\') ) { if ( *pEnd == wxT('\\') ) {
// next character may be space or not - still take it because it's // next character may be space or not - still take it because it's

View File

@@ -1890,6 +1890,8 @@ bool wxFileName::SetTimes(const wxDateTime *dtAccess,
} }
} }
#elif defined(__UNIX_LIKE__) || (defined(__DOS__) && defined(__WATCOMC__)) #elif defined(__UNIX_LIKE__) || (defined(__DOS__) && defined(__WATCOMC__))
wxUnusedVar(dtCreate);
if ( !dtAccess && !dtMod ) if ( !dtAccess && !dtMod )
{ {
// can't modify the creation time anyhow, don't try // can't modify the creation time anyhow, don't try

View File

@@ -573,7 +573,7 @@ wxFontMapperBase::NonInteractiveCharsetToEncoding(const wxString& charset)
if ( *p == wxT('-') ) if ( *p == wxT('-') )
p++; p++;
int value; unsigned int value;
if ( wxSscanf(p, wxT("%u"), &value) == 1 ) if ( wxSscanf(p, wxT("%u"), &value) == 1 )
{ {
if ( value >= 1250 ) if ( value >= 1250 )

View File

@@ -1132,13 +1132,16 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName,
return false; return false;
// get the file size (assume it is less than 4Gb...) // get the file size (assume it is less than 4Gb...)
wxFileOffset nSize = fileMsg.Length(); wxFileOffset lenFile = fileMsg.Length();
if ( nSize == wxInvalidOffset ) if ( lenFile == wxInvalidOffset )
return false; 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 // read the whole file in memory
m_pData = new size_t8[nSize]; 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); wxDELETEA(m_pData);
return false; return false;
} }

View File

@@ -47,14 +47,14 @@ void *wxLongLongNative::asArray() const
{ {
static unsigned char temp[8]; static unsigned char temp[8];
temp[0] = (unsigned char)((m_ll >> 56) & 0xFF); temp[0] = wx_truncate_cast(unsigned char, ((m_ll >> 56) & 0xFF));
temp[1] = (unsigned char)((m_ll >> 48) & 0xFF); temp[1] = wx_truncate_cast(unsigned char, ((m_ll >> 48) & 0xFF));
temp[2] = (unsigned char)((m_ll >> 40) & 0xFF); temp[2] = wx_truncate_cast(unsigned char, ((m_ll >> 40) & 0xFF));
temp[3] = (unsigned char)((m_ll >> 32) & 0xFF); temp[3] = wx_truncate_cast(unsigned char, ((m_ll >> 32) & 0xFF));
temp[4] = (unsigned char)((m_ll >> 24) & 0xFF); temp[4] = wx_truncate_cast(unsigned char, ((m_ll >> 24) & 0xFF));
temp[5] = (unsigned char)((m_ll >> 16) & 0xFF); temp[5] = wx_truncate_cast(unsigned char, ((m_ll >> 16) & 0xFF));
temp[6] = (unsigned char)((m_ll >> 8) & 0xFF); temp[6] = wx_truncate_cast(unsigned char, ((m_ll >> 8) & 0xFF));
temp[7] = (unsigned char)((m_ll >> 0) & 0xFF); temp[7] = wx_truncate_cast(unsigned char, ((m_ll >> 0) & 0xFF));
return temp; return temp;
} }
@@ -63,14 +63,14 @@ void *wxULongLongNative::asArray() const
{ {
static unsigned char temp[8]; static unsigned char temp[8];
temp[0] = (unsigned char)((m_ll >> 56) & 0xFF); temp[0] = wx_truncate_cast(unsigned char, ((m_ll >> 56) & 0xFF));
temp[1] = (unsigned char)((m_ll >> 48) & 0xFF); temp[1] = wx_truncate_cast(unsigned char, ((m_ll >> 48) & 0xFF));
temp[2] = (unsigned char)((m_ll >> 40) & 0xFF); temp[2] = wx_truncate_cast(unsigned char, ((m_ll >> 40) & 0xFF));
temp[3] = (unsigned char)((m_ll >> 32) & 0xFF); temp[3] = wx_truncate_cast(unsigned char, ((m_ll >> 32) & 0xFF));
temp[4] = (unsigned char)((m_ll >> 24) & 0xFF); temp[4] = wx_truncate_cast(unsigned char, ((m_ll >> 24) & 0xFF));
temp[5] = (unsigned char)((m_ll >> 16) & 0xFF); temp[5] = wx_truncate_cast(unsigned char, ((m_ll >> 16) & 0xFF));
temp[6] = (unsigned char)((m_ll >> 8) & 0xFF); temp[6] = wx_truncate_cast(unsigned char, ((m_ll >> 8) & 0xFF));
temp[7] = (unsigned char)((m_ll >> 0) & 0xFF); temp[7] = wx_truncate_cast(unsigned char, ((m_ll >> 0) & 0xFF));
return temp; return temp;
} }

View File

@@ -50,12 +50,17 @@ wxMemoryInputStream::wxMemoryInputStream(const void *data, size_t len)
wxMemoryInputStream::wxMemoryInputStream(const wxMemoryOutputStream& stream) wxMemoryInputStream::wxMemoryInputStream(const wxMemoryOutputStream& stream)
{ {
ssize_t len = (ssize_t)stream.GetLength(); const wxFileOffset lenFile = stream.GetLength();
if (len == wxInvalidOffset) { if ( lenFile == wxInvalidOffset )
{
m_i_streambuf = NULL; m_i_streambuf = NULL;
m_lasterror = wxSTREAM_EOF; m_lasterror = wxSTREAM_EOF;
return; 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 = new wxStreamBuffer(wxStreamBuffer::read);
m_i_streambuf->SetBufferIO(len); // create buffer m_i_streambuf->SetBufferIO(len); // create buffer
stream.CopyTo(m_i_streambuf->GetBufferStart(), len); stream.CopyTo(m_i_streambuf->GetBufferStart(), len);

View File

@@ -390,7 +390,7 @@ void wxPopupTransientWindow::OnIdle(wxIdleEvent& event)
} }
} }
} }
#endif #endif // __WXMSW__
#if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__) #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 // dismissing a tooltip shouldn't waste a click, i.e. you
// should be able to dismiss it and press the button with the // should be able to dismiss it and press the button with the
// same click, so repost this event to the window beneath us // same click, so repost this event to the window beneath us
wxWindow *win = wxFindWindowAtPoint(event2.GetPosition()); wxWindow *winUnder = wxFindWindowAtPoint(event2.GetPosition());
if ( win ) if ( winUnder )
{ {
// translate the event coords to the ones of the window // translate the event coords to the ones of the window
// which is going to get the event // 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); event2.SetEventObject(winUnder);
wxPostEvent(win, event2); wxPostEvent(winUnder, event2);
} }
} }
break; break;

View File

@@ -205,19 +205,18 @@ wxSockAddress *wxIPV4address::Clone() const
wxString wxIPV4address::IPAddress() const wxString wxIPV4address::IPAddress() const
{ {
unsigned long raw = GAddress_INET_GetHostAddress(m_address); unsigned long raw = GAddress_INET_GetHostAddress(m_address);
return wxString::Format( return wxString::Format(_T("%lu.%lu.%lu.%lu"),
_T("%u.%u.%u.%u"), (raw>>24) & 0xff,
(unsigned char)((raw>>24) & 0xff), (raw>>16) & 0xff,
(unsigned char)((raw>>16) & 0xff), (raw>>8) & 0xff,
(unsigned char)((raw>>8) & 0xff), raw & 0xff
(unsigned char)(raw & 0xff)
); );
} }
bool wxIPV4address::operator==(const wxIPV4address& addr) const bool wxIPV4address::operator==(const wxIPV4address& addr) const
{ {
if(Hostname().Cmp(addr.Hostname().c_str()) == 0 && Service() == addr.Service()) return true; return Hostname().Cmp(addr.Hostname().c_str()) == 0 &&
return false; Service() == addr.Service();
} }
#if wxUSE_IPV6 #if wxUSE_IPV6

View File

@@ -686,11 +686,11 @@ size_t wxMBConvUTF8::MB2WC(wchar_t *buf, const char *psz, size_t n) const
{ {
if ( buf && len + 3 < n ) if ( buf && len + 3 < n )
{ {
unsigned char n = *opsz; unsigned char on = *opsz;
*buf++ = L'\\'; *buf++ = L'\\';
*buf++ = (wchar_t)( L'0' + n / 0100 ); *buf++ = (wchar_t)( L'0' + on / 0100 );
*buf++ = (wchar_t)( L'0' + (n % 0100) / 010 ); *buf++ = (wchar_t)( L'0' + (on % 0100) / 010 );
*buf++ = (wchar_t)( L'0' + n % 010 ); *buf++ = (wchar_t)( L'0' + on % 010 );
} }
opsz++; opsz++;
len += 4; len += 4;
@@ -1365,10 +1365,10 @@ wxMBConv_iconv::wxMBConv_iconv(const wxChar *name)
for ( ; *names; ++names ) for ( ; *names; ++names )
{ {
const wxString name(*names); const wxString nameCS(*names);
// first try charset with explicit bytesex info (e.g. "UCS-4LE"): // first try charset with explicit bytesex info (e.g. "UCS-4LE"):
wxString nameXE(name); wxString nameXE(nameCS);
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
nameXE += _T("BE"); nameXE += _T("BE");
#else // little endian #else // little endian
@@ -1379,7 +1379,7 @@ wxMBConv_iconv::wxMBConv_iconv(const wxChar *name)
if ( m2w == ICONV_T_INVALID ) if ( m2w == ICONV_T_INVALID )
{ {
// try charset w/o bytesex info (e.g. "UCS4") // 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: // and check for bytesex ourselves:
if ( m2w != ICONV_T_INVALID ) if ( m2w != ICONV_T_INVALID )
@@ -1404,11 +1404,11 @@ wxMBConv_iconv::wxMBConv_iconv(const wxChar *name)
{ {
wxLogLastError(wxT("iconv")); wxLogLastError(wxT("iconv"));
wxLogError(_("Conversion to charset '%s' doesn't work."), wxLogError(_("Conversion to charset '%s' doesn't work."),
name.c_str()); nameCS.c_str());
} }
else // ok, can convert to this encoding, remember it else // ok, can convert to this encoding, remember it
{ {
ms_wcCharsetName = name; ms_wcCharsetName = nameCS;
ms_wcNeedsSwap = wbuf[0] != (wchar_t)buf[0]; 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) if (ms_wcNeedsSwap)
{ {
// convert to native endianness // convert to native endianness
for ( unsigned n = 0; n < res; n++ ) for ( unsigned i = 0; i < res; i++ )
buf[n] = WC_BSWAP(buf[n]); buf[n] = WC_BSWAP(buf[i]);
} }
// NB: iconv was given only strlen(psz) characters on input, and so // 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 // (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) // could be in read-only memory, or be accessed in some other thread)
tmpbuf = (wchar_t *)malloc(inbuf + SIZEOF_WCHAR_T); tmpbuf = (wchar_t *)malloc(inbuf + SIZEOF_WCHAR_T);
for ( size_t n = 0; n < inlen; n++ ) for ( size_t i = 0; i < inlen; i++ )
tmpbuf[n] = WC_BSWAP(psz[n]); tmpbuf[n] = WC_BSWAP(psz[i]);
tmpbuf[inlen] = L'\0'; tmpbuf[inlen] = L'\0';
psz = tmpbuf; psz = tmpbuf;
} }

View File

@@ -576,7 +576,7 @@ wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode)
} }
if (diff < 0 || diff > last_access) if (diff < 0 || diff > last_access)
return wxInvalidOffset; 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") ); wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") );
SetIntPosition(int_diff); SetIntPosition(int_diff);
return diff; return diff;
@@ -603,7 +603,7 @@ wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode)
} }
else 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") ); wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") );
SetIntPosition(int_diff); SetIntPosition(int_diff);
return pos; return pos;
@@ -660,7 +660,13 @@ wxStreamBase::~wxStreamBase()
size_t wxStreamBase::GetSize() const size_t wxStreamBase::GetSize() const
{ {
wxFileOffset length = GetLength(); 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)) 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) 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 ) switch ( mode )
{ {

View File

@@ -365,7 +365,7 @@ bool wxStringBase::Alloc(size_t nLen)
if ( pData->IsEmpty() ) { if ( pData->IsEmpty() ) {
nLen += EXTRA_ALLOC; nLen += EXTRA_ALLOC;
wxStringData* pData = (wxStringData*) pData = (wxStringData *)
malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar)); malloc(sizeof(wxStringData) + (nLen + 1)*sizeof(wxChar));
if ( pData == NULL ) { if ( pData == NULL ) {

View File

@@ -348,7 +348,7 @@ void wxTextOutputStream::Write32(wxUint32 i)
void wxTextOutputStream::Write16(wxUint16 i) void wxTextOutputStream::Write16(wxUint16 i)
{ {
wxString str; wxString str;
str.Printf(wxT("%u"), i); str.Printf(wxT("%u"), (unsigned)i);
WriteString(str); WriteString(str);
} }
@@ -356,7 +356,7 @@ void wxTextOutputStream::Write16(wxUint16 i)
void wxTextOutputStream::Write8(wxUint8 i) void wxTextOutputStream::Write8(wxUint8 i)
{ {
wxString str; wxString str;
str.Printf(wxT("%u"), i); str.Printf(wxT("%u"), (unsigned)i);
WriteString(str); WriteString(str);
} }

View File

@@ -113,7 +113,7 @@ wxChar wxURI::TranslateEscape(const wxChar* s)
{ {
wxASSERT_MSG( IsHex(s[0]) && IsHex(s[1]), wxT("Invalid escape sequence!")); 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) wxString wxURI::Unescape(const wxString& uri)

View File

@@ -40,7 +40,7 @@
WX_DECLARE_LIST(wxAcceleratorEntry, wxAccelList); WX_DECLARE_LIST(wxAcceleratorEntry, wxAccelList);
#include "wx/listimpl.cpp" #include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxAccelList); WX_DEFINE_LIST(wxAccelList)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxAccelRefData: the data used by wxAcceleratorTable // wxAccelRefData: the data used by wxAcceleratorTable

View File

@@ -633,14 +633,14 @@ wxDatePickerCtrlGeneric::SetDateRange(const wxDateTime& lowerdate,
bool wxDatePickerCtrlGeneric::SetFormat(const wxChar *fmt) bool wxDatePickerCtrlGeneric::SetFormat(const wxChar *fmt)
{ {
m_format.clear();
wxDateTime dt; wxDateTime dt;
dt.ParseFormat(wxT("2003-10-13"), wxT("%Y-%m-%d")); dt.ParseFormat(wxT("2003-10-13"), wxT("%Y-%m-%d"));
wxString str=dt.Format(fmt); wxString str(dt.Format(fmt));
wxChar *p=(wxChar*)str.c_str();
m_format=wxEmptyString; const wxChar *p = str.c_str();
while ( *p )
while (*p)
{ {
int n=wxAtoi(p); int n=wxAtoi(p);
if (n == dt.GetDay()) if (n == dt.GetDay())
@@ -670,19 +670,19 @@ bool wxDatePickerCtrlGeneric::SetFormat(const wxChar *fmt)
m_format.Append(*p++); m_format.Append(*p++);
} }
if (m_txt) if ( m_txt )
{ {
wxArrayString allowedChars; wxArrayString allowedChars;
for ( wxChar c = _T('0'); c <= _T('9'); c++ ) for ( wxChar c = _T('0'); c <= _T('9'); c++ )
allowedChars.Add(wxString(c, 1)); allowedChars.Add(wxString(c, 1));
const wxChar *p = m_format.c_str(); const wxChar *p2 = m_format.c_str();
while (*p) while ( *p2 )
{ {
if (*p == '%') if ( *p2 == '%')
p += 2; p2 += 2;
else else
allowedChars.Add(wxString(*p++, 1)); allowedChars.Add(wxString(*p2++, 1));
} }
#if wxUSE_VALIDATORS #if wxUSE_VALIDATORS

View File

@@ -272,7 +272,7 @@ void wxGenericDirDialog::OnTreeSelected( wxTreeEvent &event )
if (data) if (data)
m_input->SetValue( data->m_path ); m_input->SetValue( data->m_path );
}; }
void wxGenericDirDialog::OnTreeKeyDown( wxTreeEvent &WXUNUSED(event) ) 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()); wxDirItemData *data = (wxDirItemData*)m_dirCtrl->GetTreeCtrl()->GetItemData(m_dirCtrl->GetTreeCtrl()->GetSelection());
if (data) if (data)
m_input->SetValue( data->m_path ); m_input->SetValue( data->m_path );
}; }
void wxGenericDirDialog::OnShowHidden( wxCommandEvent& event ) void wxGenericDirDialog::OnShowHidden( wxCommandEvent& event )
{ {

View File

@@ -293,7 +293,7 @@ wxString wxFileData::GetHint() const
} }
return s; return s;
}; }
wxString wxFileData::GetEntry( fileListFieldType num ) const wxString wxFileData::GetEntry( fileListFieldType num ) const
{ {

View File

@@ -9742,7 +9742,7 @@ void wxGrid::SetRowMinimalAcceptableHeight( int height )
if ( height<0 ) if ( height<0 )
return; return;
m_minAcceptableRowHeight = height; m_minAcceptableRowHeight = height;
}; }
int wxGrid::GetColMinimalAcceptableWidth() const int wxGrid::GetColMinimalAcceptableWidth() const
{ {

View File

@@ -159,12 +159,12 @@ void wxSashLayoutWindow::OnCalculateLayout(wxCalculateLayoutEvent& event)
{ {
// If not in query mode, resize the window. // If not in query mode, resize the window.
// TODO: add wxRect& form to wxWindow::SetSize // TODO: add wxRect& form to wxWindow::SetSize
wxSize sz = GetSize(); wxSize sz2 = GetSize();
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
SetSize(thisRect.x, thisRect.y, thisRect.width, thisRect.height); SetSize(thisRect.x, thisRect.y, thisRect.width, thisRect.height);
// Make sure the sash is erased when the window is resized // 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))) (GetSashVisible(wxSASH_TOP) || GetSashVisible(wxSASH_RIGHT) || GetSashVisible(wxSASH_BOTTOM) || GetSashVisible(wxSASH_LEFT)))
Refresh(true); Refresh(true);

View File

@@ -285,7 +285,7 @@ private:
WX_DECLARE_LIST(wxListItemData, wxListItemDataList); WX_DECLARE_LIST(wxListItemData, wxListItemDataList);
#include "wx/listimpl.cpp" #include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxListItemDataList); WX_DEFINE_LIST(wxListItemDataList)
class wxListLineData class wxListLineData
{ {
@@ -413,7 +413,7 @@ private:
WX_DECLARE_EXPORTED_OBJARRAY(wxListLineData, wxListLineDataArray); WX_DECLARE_EXPORTED_OBJARRAY(wxListLineData, wxListLineDataArray);
#include "wx/arrimpl.cpp" #include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(wxListLineDataArray); WX_DEFINE_OBJARRAY(wxListLineDataArray)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxListHeaderWindow (internal) // wxListHeaderWindow (internal)
@@ -519,7 +519,7 @@ private:
WX_DECLARE_LIST(wxListHeaderData, wxListHeaderDataList); WX_DECLARE_LIST(wxListHeaderData, wxListHeaderDataList);
#include "wx/listimpl.cpp" #include "wx/listimpl.cpp"
WX_DEFINE_LIST(wxListHeaderDataList); WX_DEFINE_LIST(wxListHeaderDataList)
class wxListMainWindow : public wxScrolledWindow class wxListMainWindow : public wxScrolledWindow
{ {

View File

@@ -678,8 +678,7 @@ wxGenericPrintSetupDialog::~wxGenericPrintSetupDialog()
void wxGenericPrintSetupDialog::OnPrinter(wxListEvent& event) void wxGenericPrintSetupDialog::OnPrinter(wxListEvent& event)
{ {
// Delete check mark // Delete check mark
long item; for (long item = 0; item < m_printerListCtrl->GetItemCount(); item++)
for (item = 0; item < m_printerListCtrl->GetItemCount(); item++)
m_printerListCtrl->SetItemImage( item, -1 ); m_printerListCtrl->SetItemImage( item, -1 );
m_printerListCtrl->SetItemImage( event.GetIndex(), 0 ); m_printerListCtrl->SetItemImage( event.GetIndex(), 0 );
@@ -690,14 +689,12 @@ void wxGenericPrintSetupDialog::OnPrinter(wxListEvent& event)
} }
else else
{ {
wxString tmp = wxT("lpr -P"); wxListItem li;
wxListItem item; li.SetColumn( 1 );
item.SetColumn( 1 ); li.SetMask( wxLIST_MASK_TEXT );
item.SetMask( wxLIST_MASK_TEXT ); li.SetId( event.GetIndex() );
item.SetId( event.GetIndex() ); m_printerListCtrl->GetItem( li );
m_printerListCtrl->GetItem( item ); m_printerCommandText->SetValue( _T("lpr -P") + li.GetText() );
tmp += item.GetText();
m_printerCommandText->SetValue( tmp );
} }
} }

View File

@@ -36,7 +36,7 @@
#define wxSPLASH_TIMER_ID 9999 #define wxSPLASH_TIMER_ID 9999
IMPLEMENT_DYNAMIC_CLASS(wxSplashScreen, wxFrame); IMPLEMENT_DYNAMIC_CLASS(wxSplashScreen, wxFrame)
BEGIN_EVENT_TABLE(wxSplashScreen, wxFrame) BEGIN_EVENT_TABLE(wxSplashScreen, wxFrame)
EVT_TIMER(wxSPLASH_TIMER_ID, wxSplashScreen::OnNotify) EVT_TIMER(wxSPLASH_TIMER_ID, wxSplashScreen::OnNotify)

View File

@@ -72,6 +72,7 @@
#include <unistd.h> #include <unistd.h>
#endif // HAVE_POLL/!HAVE_POLL #endif // HAVE_POLL/!HAVE_POLL
#include "wx/unix/private.h"
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
@@ -306,23 +307,23 @@ int wxPoll(wxPollFd *ufds, unsigned int nfds, int timeout)
fd_set readfds; fd_set readfds;
fd_set writefds; fd_set writefds;
fd_set exceptfds; fd_set exceptfds;
FD_ZERO(&readfds); wxFD_ZERO(&readfds);
FD_ZERO(&writefds); wxFD_ZERO(&writefds);
FD_ZERO(&exceptfds); wxFD_ZERO(&exceptfds);
unsigned int i; unsigned int i;
for ( i = 0; i < nfds; 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 ) 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 ) 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 ) if ( ufds[i].events & G_IO_OUT )
FD_SET(ufds[i].fd, &writefds); wxFD_SET(ufds[i].fd, &writefds);
if ( ufds[i].fd > fdMax ) if ( ufds[i].fd > fdMax )
fdMax = ufds[i].fd; fdMax = ufds[i].fd;
@@ -336,13 +337,13 @@ int wxPoll(wxPollFd *ufds, unsigned int nfds, int timeout)
{ {
ufds[i].revents = 0; ufds[i].revents = 0;
if ( FD_ISSET(ufds[i].fd, &readfds ) ) if ( wxFD_ISSET(ufds[i].fd, &readfds ) )
ufds[i].revents |= G_IO_IN; 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; 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; ufds[i].revents |= G_IO_OUT;
} }

View File

@@ -1590,7 +1590,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
#endif #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; return false;
} }
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, bool wxBitmapHandler::LoadFile(wxBitmap * WXUNUSED(bitmap),
int desiredWidth, int desiredHeight) const wxString& WXUNUSED(name),
long WXUNUSED(flags),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{ {
wxFAIL_MSG( _T("not implemented") );
return false; 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; return false;
} }

View File

@@ -844,12 +844,12 @@ void wxComboBox::OnChar( wxKeyEvent &event )
if ( event.GetKeyCode() == WXK_RETURN ) if ( event.GetKeyCode() == WXK_RETURN )
{ {
// GTK automatically selects an item if its in the list // GTK automatically selects an item if its in the list
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, GetId()); wxCommandEvent eventEnter(wxEVT_COMMAND_TEXT_ENTER, GetId());
event.SetString( GetValue() ); eventEnter.SetString( GetValue() );
event.SetInt( GetSelection() ); eventEnter.SetInt( GetSelection() );
event.SetEventObject( this ); eventEnter.SetEventObject( this );
if (!GetEventHandler()->ProcessEvent( event )) if (!GetEventHandler()->ProcessEvent( eventEnter ))
{ {
// This will invoke the dialog default action, such // This will invoke the dialog default action, such
// as the clicking the default button. // as the clicking the default button.

View File

@@ -88,9 +88,9 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable,
gint width, gint width,
gint height) gint height)
{ {
g_return_if_fail (drawable != NULL); wxCHECK_RET( drawable, _T("NULL drawable in gdk_wx_draw_bitmap") );
g_return_if_fail (src != NULL); wxCHECK_RET( src, _T("NULL src in gdk_wx_draw_bitmap") );
g_return_if_fail (gc != NULL); wxCHECK_RET( gc, _T("NULL gc in gdk_wx_draw_bitmap") );
#ifdef __WXGTK20__ #ifdef __WXGTK20__
gint src_width, src_height; gint src_width, src_height;

View File

@@ -148,7 +148,8 @@ egg_tray_icon_get_type (void)
(GInstanceInitFunc) egg_tray_icon_init (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; return our_type;

View File

@@ -745,8 +745,7 @@ void wxListBox::GtkAddItem( const wxString &item, int pos )
{ {
gtk_widget_modify_style( GTK_WIDGET( list_item ), style ); gtk_widget_modify_style( GTK_WIDGET( list_item ), style );
GtkBin *bin = GTK_BIN( list_item ); GtkBin *bin = GTK_BIN( list_item );
GtkWidget *label = GTK_WIDGET( bin->child ); gtk_widget_modify_style( GTK_WIDGET( bin->child ), style );
gtk_widget_modify_style( label, style );
gtk_rc_style_unref( style ); gtk_rc_style_unref( style );
} }
} }

View File

@@ -1021,19 +1021,19 @@ void wxScrolledWindow::OnChar(wxKeyEvent& event)
int xScroll = GetScrollPos(wxHORIZONTAL); int xScroll = GetScrollPos(wxHORIZONTAL);
if ( xScroll != xScrollOld ) if ( xScroll != xScrollOld )
{ {
wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, xScroll, wxScrollWinEvent eventS(wxEVT_SCROLLWIN_THUMBTRACK, xScroll,
wxHORIZONTAL); wxHORIZONTAL);
event.SetEventObject(this); eventS.SetEventObject(this);
GetEventHandler()->ProcessEvent(event); GetEventHandler()->ProcessEvent(eventS);
} }
int yScroll = GetScrollPos(wxVERTICAL); int yScroll = GetScrollPos(wxVERTICAL);
if ( yScroll != yScrollOld ) if ( yScroll != yScrollOld )
{ {
wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, yScroll, wxScrollWinEvent eventS(wxEVT_SCROLLWIN_THUMBTRACK, yScroll,
wxVERTICAL); wxVERTICAL);
event.SetEventObject(this); eventS.SetEventObject(this);
GetEventHandler()->ProcessEvent(event); GetEventHandler()->ProcessEvent(eventS);
} }
} }

View File

@@ -652,10 +652,10 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
{ {
case wxSYS_CAN_ICONIZE_FRAME: case wxSYS_CAN_ICONIZE_FRAME:
return FALSE; return FALSE;
break;
case wxSYS_CAN_DRAW_FRAME_DECORATIONS: case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
return TRUE; return TRUE;
break;
default: default:
return FALSE; return FALSE;
} }

View File

@@ -428,15 +428,16 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
{ {
wxToolBarToolsList::compatibility_iterator node wxToolBarToolsList::compatibility_iterator node
= wxToolBarToolsList::compatibility_iterator(); = wxToolBarToolsList::compatibility_iterator();
if ( pos ) node = m_tools.Item(pos - 1); if ( pos )
node = m_tools.Item(pos - 1);
while ( node ) while ( node )
{ {
wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); wxToolBarTool *toolNext = (wxToolBarTool *)node->GetData();
if ( !tool->IsRadio() ) if ( !toolNext->IsRadio() )
break; break;
widget = tool->m_item; widget = toolNext->m_item;
node = node->GetPrevious(); node = node->GetPrevious();
} }

View File

@@ -102,7 +102,9 @@ static void gtk_pizza_scroll_set_adjustments (GtkPizza *pizza,
static GtkContainerClass *pizza_parent_class = NULL; static GtkContainerClass *pizza_parent_class = NULL;
#endif #endif
#ifndef __WXGTK20__
static gboolean gravity_works; static gboolean gravity_works;
#endif
GtkType GtkType
gtk_pizza_get_type () gtk_pizza_get_type ()
@@ -125,7 +127,7 @@ gtk_pizza_get_type ()
16, /* n_preallocs */ 16, /* n_preallocs */
(GInstanceInitFunc) gtk_pizza_init, (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 #else
GtkTypeInfo pizza_info = GtkTypeInfo pizza_info =
{ {
@@ -652,10 +654,10 @@ gtk_pizza_realize (GtkWidget *widget)
/* add filters for intercepting visibility and expose events */ /* add filters for intercepting visibility and expose events */
gdk_window_add_filter (widget->window, gtk_pizza_main_filter, pizza); gdk_window_add_filter (widget->window, gtk_pizza_main_filter, pizza);
gdk_window_add_filter (pizza->bin_window, gtk_pizza_filter, pizza); gdk_window_add_filter (pizza->bin_window, gtk_pizza_filter, pizza);
#endif
/* we NEED gravity or we'll give up */ /* we NEED gravity or we'll give up */
gravity_works = gdk_window_set_static_gravities (pizza->bin_window, TRUE); gravity_works = gdk_window_set_static_gravities (pizza->bin_window, TRUE);
#endif // !__WXGTK20__
/* cannot be done before realisation */ /* cannot be done before realisation */
children = pizza->children; children = pizza->children;
@@ -1104,7 +1106,7 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
if (pizza->bin_window) if (pizza->bin_window)
gdk_window_scroll( pizza->bin_window, -dx, -dy ); gdk_window_scroll( pizza->bin_window, -dx, -dy );
#else #else // !__WXGTK20__
GtkWidget *widget; GtkWidget *widget;
XEvent xevent; XEvent xevent;
XID win; XID win;
@@ -1236,7 +1238,7 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
} }
} }
} }
#endif /* __WXGTK20__ */ #endif /* __WXGTK20__/!__WXGTK20__ */
} }

View 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 // hack: we need something to pass to gtk_menu_popup, so we store the time of
// the last click here // the last click here
#ifndef __WXGTK20__
static guint32 gs_timeLastClick = 0; static guint32 gs_timeLastClick = 0;
#endif
extern bool g_mainThreadLocked; extern bool g_mainThreadLocked;
@@ -1388,9 +1390,9 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
if ( btnCancel ) if ( btnCancel )
{ {
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); wxCommandEvent eventClick(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
event.SetEventObject(btnCancel); eventClick.SetEventObject(btnCancel);
ret = btnCancel->GetEventHandler()->ProcessEvent(event); ret = btnCancel->GetEventHandler()->ProcessEvent(eventClick);
} }
} }
@@ -1799,9 +1801,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
if ( !g_captureWindow ) if ( !g_captureWindow )
win = FindWindowForMouseEvent(win, event.m_x, event.m_y); win = FindWindowForMouseEvent(win, event.m_x, event.m_y);
#ifndef __WXGTK20__
gs_timeLastClick = gdk_event->time; gs_timeLastClick = gdk_event->time;
#ifndef __WXGTK20__
if (event_type == wxEVT_LEFT_DCLICK) if (event_type == wxEVT_LEFT_DCLICK)
{ {
// GTK 1.2 crashes when intercepting double // GTK 1.2 crashes when intercepting double
@@ -1813,7 +1815,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
return FALSE; return FALSE;
} }
} }
#endif #endif // !__WXGTK20__
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{ {
@@ -1958,11 +1960,11 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget,
// the mouse changed window // the mouse changed window
g_captureWindowHasMouse = hasMouse; g_captureWindowHasMouse = hasMouse;
wxMouseEvent event(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW wxMouseEvent eventM(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW
: wxEVT_LEAVE_WINDOW); : wxEVT_LEAVE_WINDOW);
InitMouseEvent(win, event, gdk_event); InitMouseEvent(win, eventM, gdk_event);
event.SetEventObject(win); eventM.SetEventObject(win);
win->GetEventHandler()->ProcessEvent(event); win->GetEventHandler()->ProcessEvent(eventM);
} }
} }
else // no capture else // no capture

View File

@@ -72,6 +72,7 @@
#include <unistd.h> #include <unistd.h>
#endif // HAVE_POLL/!HAVE_POLL #endif // HAVE_POLL/!HAVE_POLL
#include "wx/unix/private.h"
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
@@ -306,23 +307,23 @@ int wxPoll(wxPollFd *ufds, unsigned int nfds, int timeout)
fd_set readfds; fd_set readfds;
fd_set writefds; fd_set writefds;
fd_set exceptfds; fd_set exceptfds;
FD_ZERO(&readfds); wxFD_ZERO(&readfds);
FD_ZERO(&writefds); wxFD_ZERO(&writefds);
FD_ZERO(&exceptfds); wxFD_ZERO(&exceptfds);
unsigned int i; unsigned int i;
for ( i = 0; i < nfds; 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 ) 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 ) 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 ) if ( ufds[i].events & G_IO_OUT )
FD_SET(ufds[i].fd, &writefds); wxFD_SET(ufds[i].fd, &writefds);
if ( ufds[i].fd > fdMax ) if ( ufds[i].fd > fdMax )
fdMax = ufds[i].fd; fdMax = ufds[i].fd;
@@ -336,13 +337,13 @@ int wxPoll(wxPollFd *ufds, unsigned int nfds, int timeout)
{ {
ufds[i].revents = 0; ufds[i].revents = 0;
if ( FD_ISSET(ufds[i].fd, &readfds ) ) if ( wxFD_ISSET(ufds[i].fd, &readfds ) )
ufds[i].revents |= G_IO_IN; 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; 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; ufds[i].revents |= G_IO_OUT;
} }

View File

@@ -1590,7 +1590,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
#endif #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; return false;
} }
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, bool wxBitmapHandler::LoadFile(wxBitmap * WXUNUSED(bitmap),
int desiredWidth, int desiredHeight) const wxString& WXUNUSED(name),
long WXUNUSED(flags),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{ {
wxFAIL_MSG( _T("not implemented") );
return false; 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; return false;
} }

View File

@@ -844,12 +844,12 @@ void wxComboBox::OnChar( wxKeyEvent &event )
if ( event.GetKeyCode() == WXK_RETURN ) if ( event.GetKeyCode() == WXK_RETURN )
{ {
// GTK automatically selects an item if its in the list // GTK automatically selects an item if its in the list
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, GetId()); wxCommandEvent eventEnter(wxEVT_COMMAND_TEXT_ENTER, GetId());
event.SetString( GetValue() ); eventEnter.SetString( GetValue() );
event.SetInt( GetSelection() ); eventEnter.SetInt( GetSelection() );
event.SetEventObject( this ); eventEnter.SetEventObject( this );
if (!GetEventHandler()->ProcessEvent( event )) if (!GetEventHandler()->ProcessEvent( eventEnter ))
{ {
// This will invoke the dialog default action, such // This will invoke the dialog default action, such
// as the clicking the default button. // as the clicking the default button.

View File

@@ -88,9 +88,9 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable,
gint width, gint width,
gint height) gint height)
{ {
g_return_if_fail (drawable != NULL); wxCHECK_RET( drawable, _T("NULL drawable in gdk_wx_draw_bitmap") );
g_return_if_fail (src != NULL); wxCHECK_RET( src, _T("NULL src in gdk_wx_draw_bitmap") );
g_return_if_fail (gc != NULL); wxCHECK_RET( gc, _T("NULL gc in gdk_wx_draw_bitmap") );
#ifdef __WXGTK20__ #ifdef __WXGTK20__
gint src_width, src_height; gint src_width, src_height;

View File

@@ -148,7 +148,8 @@ egg_tray_icon_get_type (void)
(GInstanceInitFunc) egg_tray_icon_init (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; return our_type;

View File

@@ -745,8 +745,7 @@ void wxListBox::GtkAddItem( const wxString &item, int pos )
{ {
gtk_widget_modify_style( GTK_WIDGET( list_item ), style ); gtk_widget_modify_style( GTK_WIDGET( list_item ), style );
GtkBin *bin = GTK_BIN( list_item ); GtkBin *bin = GTK_BIN( list_item );
GtkWidget *label = GTK_WIDGET( bin->child ); gtk_widget_modify_style( GTK_WIDGET( bin->child ), style );
gtk_widget_modify_style( label, style );
gtk_rc_style_unref( style ); gtk_rc_style_unref( style );
} }
} }

View File

@@ -1021,19 +1021,19 @@ void wxScrolledWindow::OnChar(wxKeyEvent& event)
int xScroll = GetScrollPos(wxHORIZONTAL); int xScroll = GetScrollPos(wxHORIZONTAL);
if ( xScroll != xScrollOld ) if ( xScroll != xScrollOld )
{ {
wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, xScroll, wxScrollWinEvent eventS(wxEVT_SCROLLWIN_THUMBTRACK, xScroll,
wxHORIZONTAL); wxHORIZONTAL);
event.SetEventObject(this); eventS.SetEventObject(this);
GetEventHandler()->ProcessEvent(event); GetEventHandler()->ProcessEvent(eventS);
} }
int yScroll = GetScrollPos(wxVERTICAL); int yScroll = GetScrollPos(wxVERTICAL);
if ( yScroll != yScrollOld ) if ( yScroll != yScrollOld )
{ {
wxScrollWinEvent event(wxEVT_SCROLLWIN_THUMBTRACK, yScroll, wxScrollWinEvent eventS(wxEVT_SCROLLWIN_THUMBTRACK, yScroll,
wxVERTICAL); wxVERTICAL);
event.SetEventObject(this); eventS.SetEventObject(this);
GetEventHandler()->ProcessEvent(event); GetEventHandler()->ProcessEvent(eventS);
} }
} }

View File

@@ -652,10 +652,10 @@ bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
{ {
case wxSYS_CAN_ICONIZE_FRAME: case wxSYS_CAN_ICONIZE_FRAME:
return FALSE; return FALSE;
break;
case wxSYS_CAN_DRAW_FRAME_DECORATIONS: case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
return TRUE; return TRUE;
break;
default: default:
return FALSE; return FALSE;
} }

View File

@@ -428,15 +428,16 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
{ {
wxToolBarToolsList::compatibility_iterator node wxToolBarToolsList::compatibility_iterator node
= wxToolBarToolsList::compatibility_iterator(); = wxToolBarToolsList::compatibility_iterator();
if ( pos ) node = m_tools.Item(pos - 1); if ( pos )
node = m_tools.Item(pos - 1);
while ( node ) while ( node )
{ {
wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); wxToolBarTool *toolNext = (wxToolBarTool *)node->GetData();
if ( !tool->IsRadio() ) if ( !toolNext->IsRadio() )
break; break;
widget = tool->m_item; widget = toolNext->m_item;
node = node->GetPrevious(); node = node->GetPrevious();
} }

View File

@@ -102,7 +102,9 @@ static void gtk_pizza_scroll_set_adjustments (GtkPizza *pizza,
static GtkContainerClass *pizza_parent_class = NULL; static GtkContainerClass *pizza_parent_class = NULL;
#endif #endif
#ifndef __WXGTK20__
static gboolean gravity_works; static gboolean gravity_works;
#endif
GtkType GtkType
gtk_pizza_get_type () gtk_pizza_get_type ()
@@ -125,7 +127,7 @@ gtk_pizza_get_type ()
16, /* n_preallocs */ 16, /* n_preallocs */
(GInstanceInitFunc) gtk_pizza_init, (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 #else
GtkTypeInfo pizza_info = GtkTypeInfo pizza_info =
{ {
@@ -652,10 +654,10 @@ gtk_pizza_realize (GtkWidget *widget)
/* add filters for intercepting visibility and expose events */ /* add filters for intercepting visibility and expose events */
gdk_window_add_filter (widget->window, gtk_pizza_main_filter, pizza); gdk_window_add_filter (widget->window, gtk_pizza_main_filter, pizza);
gdk_window_add_filter (pizza->bin_window, gtk_pizza_filter, pizza); gdk_window_add_filter (pizza->bin_window, gtk_pizza_filter, pizza);
#endif
/* we NEED gravity or we'll give up */ /* we NEED gravity or we'll give up */
gravity_works = gdk_window_set_static_gravities (pizza->bin_window, TRUE); gravity_works = gdk_window_set_static_gravities (pizza->bin_window, TRUE);
#endif // !__WXGTK20__
/* cannot be done before realisation */ /* cannot be done before realisation */
children = pizza->children; children = pizza->children;
@@ -1104,7 +1106,7 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
if (pizza->bin_window) if (pizza->bin_window)
gdk_window_scroll( pizza->bin_window, -dx, -dy ); gdk_window_scroll( pizza->bin_window, -dx, -dy );
#else #else // !__WXGTK20__
GtkWidget *widget; GtkWidget *widget;
XEvent xevent; XEvent xevent;
XID win; XID win;
@@ -1236,7 +1238,7 @@ gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)
} }
} }
} }
#endif /* __WXGTK20__ */ #endif /* __WXGTK20__/!__WXGTK20__ */
} }

View 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 // hack: we need something to pass to gtk_menu_popup, so we store the time of
// the last click here // the last click here
#ifndef __WXGTK20__
static guint32 gs_timeLastClick = 0; static guint32 gs_timeLastClick = 0;
#endif
extern bool g_mainThreadLocked; extern bool g_mainThreadLocked;
@@ -1388,9 +1390,9 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
if ( btnCancel ) if ( btnCancel )
{ {
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL); wxCommandEvent eventClick(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
event.SetEventObject(btnCancel); eventClick.SetEventObject(btnCancel);
ret = btnCancel->GetEventHandler()->ProcessEvent(event); ret = btnCancel->GetEventHandler()->ProcessEvent(eventClick);
} }
} }
@@ -1799,9 +1801,9 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
if ( !g_captureWindow ) if ( !g_captureWindow )
win = FindWindowForMouseEvent(win, event.m_x, event.m_y); win = FindWindowForMouseEvent(win, event.m_x, event.m_y);
#ifndef __WXGTK20__
gs_timeLastClick = gdk_event->time; gs_timeLastClick = gdk_event->time;
#ifndef __WXGTK20__
if (event_type == wxEVT_LEFT_DCLICK) if (event_type == wxEVT_LEFT_DCLICK)
{ {
// GTK 1.2 crashes when intercepting double // GTK 1.2 crashes when intercepting double
@@ -1813,7 +1815,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
return FALSE; return FALSE;
} }
} }
#endif #endif // !__WXGTK20__
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{ {
@@ -1958,11 +1960,11 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget,
// the mouse changed window // the mouse changed window
g_captureWindowHasMouse = hasMouse; g_captureWindowHasMouse = hasMouse;
wxMouseEvent event(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW wxMouseEvent eventM(g_captureWindowHasMouse ? wxEVT_ENTER_WINDOW
: wxEVT_LEAVE_WINDOW); : wxEVT_LEAVE_WINDOW);
InitMouseEvent(win, event, gdk_event); InitMouseEvent(win, eventM, gdk_event);
event.SetEventObject(win); eventM.SetEventObject(win);
win->GetEventHandler()->ProcessEvent(event); win->GetEventHandler()->ProcessEvent(eventM);
} }
} }
else // no capture else // no capture

View File

@@ -462,17 +462,17 @@ bool wxHtmlHelpData::SaveCachedBook(wxHtmlBookRecord *book, wxOutputStream *f)
} }
else else
{ {
int cnt = 0; int cnt2 = 0;
wxHtmlHelpDataItem *parent = m_index[i].parent; wxHtmlHelpDataItem *parent = m_index[i].parent;
for (int j = i-1; j >= 0; j--) for (int j = i-1; j >= 0; j--)
{ {
if (m_index[j].book == book && m_index[j].level > 0) if (m_index[j].book == book && m_index[j].level > 0)
cnt++; cnt2++;
if (&m_index[j] == parent) if (&m_index[j] == parent)
break; break;
} }
wxASSERT(cnt > 0); wxASSERT(cnt2 > 0);
CacheWriteInt32(f, cnt); CacheWriteInt32(f, cnt2);
} }
} }
return true; return true;

View File

@@ -646,8 +646,6 @@ void wxHtmlContainerCell::Layout(int w)
return; return;
} }
wxHtmlCell *cell = m_Cells,
*line = m_Cells;
wxHtmlCell *nextCell; wxHtmlCell *nextCell;
long xpos = 0, ypos = m_IndentTop; long xpos = 0, ypos = m_IndentTop;
int xdelta = 0, ybasicpos = 0, ydiff; 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); s_width = m_Width - s_indent - ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
// my own layouting: // my own layouting:
wxHtmlCell *cell = m_Cells,
*line = m_Cells;
while (cell != NULL) while (cell != NULL)
{ {
switch (m_AlignVer) switch (m_AlignVer)

View File

@@ -52,7 +52,7 @@ public:
}; };
WX_DECLARE_OBJARRAY(wxHtmlTextPiece, wxHtmlTextPieces); WX_DECLARE_OBJARRAY(wxHtmlTextPiece, wxHtmlTextPieces);
WX_DEFINE_OBJARRAY(wxHtmlTextPieces); WX_DEFINE_OBJARRAY(wxHtmlTextPieces)
class wxHtmlParserState class wxHtmlParserState
{ {

View File

@@ -135,10 +135,10 @@ private:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
WX_DECLARE_OBJARRAY(wxHtmlHistoryItem, wxHtmlHistoryArray); WX_DECLARE_OBJARRAY(wxHtmlHistoryItem, wxHtmlHistoryArray);
WX_DEFINE_OBJARRAY(wxHtmlHistoryArray); WX_DEFINE_OBJARRAY(wxHtmlHistoryArray)
WX_DECLARE_LIST(wxHtmlProcessor, wxHtmlProcessorList); WX_DECLARE_LIST(wxHtmlProcessor, wxHtmlProcessorList);
WX_DEFINE_LIST(wxHtmlProcessorList); WX_DEFINE_LIST(wxHtmlProcessorList)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxHtmlWindow // wxHtmlWindow

View File

@@ -43,7 +43,7 @@ FORCE_LINK_ME(m_image)
WX_DECLARE_OBJARRAY(int, CoordArray); WX_DECLARE_OBJARRAY(int, CoordArray);
#include "wx/arrimpl.cpp" // this is a magic incantation which must be done! #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"))) if (cel != NULL && tag.HasParam(wxT("HREF")))
{ {
wxString tmp = tag.GetParam(wxT("HREF")); wxString target;
wxString target = wxEmptyString; if (tag.HasParam(wxT("TARGET")))
if (tag.HasParam(wxT("TARGET"))) target = tag.GetParam(wxT("TARGET")); target = tag.GetParam(wxT("TARGET"));
cel->SetLink( wxHtmlLinkInfo(tmp, 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 );
} }
} }

View File

@@ -42,6 +42,7 @@
#pragma message enable nosimpint #pragma message enable nosimpint
#endif #endif
#include "wx/unix/private.h"
#include "wx/motif/private.h" #include "wx/motif/private.h"
static bool CheckForKeyUp(XEvent* event); static bool CheckForKeyUp(XEvent* event);
@@ -424,8 +425,8 @@ static void wxInputCallback( XtPointer, int* fd, XtInputId* )
timeout.tv_sec = 0; timeout.tv_sec = 0;
timeout.tv_usec = 0; timeout.tv_usec = 0;
FD_ZERO( &in ); wxFD_ZERO( &in );
FD_SET( *fd, &in ); wxFD_SET( *fd, &in );
if( select( *fd + 1, &in, NULL, NULL, &timeout ) <= 0 ) if( select( *fd + 1, &in, NULL, NULL, &timeout ) <= 0 )
break; break;
@@ -445,8 +446,8 @@ static void wxBreakDispatch()
timeout.tv_sec = 0; timeout.tv_sec = 0;
timeout.tv_usec = 0; timeout.tv_usec = 0;
FD_ZERO( &in ); wxFD_ZERO( &in );
FD_SET( idleFds[0], &in ); wxFD_SET( idleFds[0], &in );
if( select( idleFds[0] + 1, &in, NULL, NULL, &timeout ) > 0 ) if( select( idleFds[0] + 1, &in, NULL, NULL, &timeout ) > 0 )
return; return;

View File

@@ -293,7 +293,7 @@ public:
wxDynamicLibraryDetails *details = new wxDynamicLibraryDetails; wxDynamicLibraryDetails *details = new wxDynamicLibraryDetails;
details->m_path = path; details->m_path = path;
details->m_name = path.AfterLast(_T('/')); details->m_name = path.AfterLast(_T('/'));
details->m_address = wx_reinterpret_cast(void *, start); details->m_address = wxUIntToPtr(start);
details->m_length = end - start; details->m_length = end - start;
// try to extract the library version from its name // try to extract the library version from its name

View File

@@ -43,8 +43,8 @@
extern GtkWidget *wxGetRootWindow(); extern GtkWidget *wxGetRootWindow();
#endif #endif
static int extern "C" int wxCMPFUNC_CONV
cmp_families (const void *a, const void *b) wxCompareFamilies (const void *a, const void *b)
{ {
const char *a_name = pango_font_family_get_name (*(PangoFontFamily **)a); const char *a_name = pango_font_family_get_name (*(PangoFontFamily **)a);
const char *b_name = pango_font_family_get_name (*(PangoFontFamily **)b); const char *b_name = pango_font_family_get_name (*(PangoFontFamily **)b);
@@ -77,7 +77,7 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
wxTheApp->GetPangoContext(), wxTheApp->GetPangoContext(),
#endif #endif
&families, &n_families ); &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++) for (int i=0; i<n_families; i++)
{ {

View File

@@ -12,10 +12,6 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
/*
* PLEASE don't put C++ comments here - this is a C source file.
*/
#if defined(__WATCOMC__) #if defined(__WATCOMC__)
#include "wx/wxprec.h" #include "wx/wxprec.h"
#include <errno.h> #include <errno.h>
@@ -183,6 +179,7 @@ int _System soclose(int);
#ifndef __GSOCKET_STANDALONE__ #ifndef __GSOCKET_STANDALONE__
# include "wx/unix/gsockunx.h" # include "wx/unix/gsockunx.h"
# include "wx/unix/private.h"
# include "wx/gsocket.h" # include "wx/gsocket.h"
#else #else
# include "gsockunx.h" # include "gsockunx.h"
@@ -980,13 +977,13 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
tv.tv_sec = m_timeout / 1000; tv.tv_sec = m_timeout / 1000;
tv.tv_usec = (m_timeout % 1000) * 1000; tv.tv_usec = (m_timeout % 1000) * 1000;
FD_ZERO(&readfds); wxFD_ZERO(&readfds);
FD_ZERO(&writefds); wxFD_ZERO(&writefds);
FD_ZERO(&exceptfds); wxFD_ZERO(&exceptfds);
FD_SET(m_fd, &readfds); wxFD_SET(m_fd, &readfds);
if (flags & GSOCK_OUTPUT_FLAG || flags & GSOCK_CONNECTION_FLAG) if (flags & GSOCK_OUTPUT_FLAG || flags & GSOCK_CONNECTION_FLAG)
FD_SET(m_fd, &writefds); wxFD_SET(m_fd, &writefds);
FD_SET(m_fd, &exceptfds); wxFD_SET(m_fd, &exceptfds);
/* Check 'sticky' CONNECTION flag first */ /* Check 'sticky' CONNECTION flag first */
result |= (GSOCK_CONNECTION_FLAG & m_detected); result |= (GSOCK_CONNECTION_FLAG & m_detected);
@@ -1009,7 +1006,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
} }
/* Check for readability */ /* Check for readability */
if (FD_ISSET(m_fd, &readfds)) if (wxFD_ISSET(m_fd, &readfds))
{ {
char c; char c;
@@ -1038,7 +1035,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
} }
/* Check for writability */ /* Check for writability */
if (FD_ISSET(m_fd, &writefds)) if (wxFD_ISSET(m_fd, &writefds))
{ {
if (m_establishing && !m_server) if (m_establishing && !m_server)
{ {
@@ -1069,7 +1066,7 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags)
} }
/* Check for exceptions and errors (is this useful in Unices?) */ /* 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_establishing = false;
m_detected = GSOCK_LOST_FLAG; m_detected = GSOCK_LOST_FLAG;
@@ -1250,8 +1247,8 @@ GSocketError GSocket::Input_Timeout()
if (!m_non_blocking) if (!m_non_blocking)
{ {
FD_ZERO(&readfds); wxFD_ZERO(&readfds);
FD_SET(m_fd, &readfds); wxFD_SET(m_fd, &readfds);
ret = select(m_fd + 1, &readfds, NULL, NULL, &tv); ret = select(m_fd + 1, &readfds, NULL, NULL, &tv);
if (ret == 0) if (ret == 0)
{ {
@@ -1291,8 +1288,8 @@ GSocketError GSocket::Output_Timeout()
if (!m_non_blocking) if (!m_non_blocking)
{ {
FD_ZERO(&writefds); wxFD_ZERO(&writefds);
FD_SET(m_fd, &writefds); wxFD_SET(m_fd, &writefds);
ret = select(m_fd + 1, NULL, &writefds, NULL, &tv); ret = select(m_fd + 1, NULL, &writefds, NULL, &tv);
if (ret == 0) if (ret == 0)
{ {
@@ -1310,7 +1307,7 @@ GSocketError GSocket::Output_Timeout()
m_error = GSOCK_TIMEDOUT; m_error = GSOCK_TIMEDOUT;
return 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" )); GSocket_Debug(( "GSocket_Output_Timeout is buggy!\n" ));
} }
else { else {

View File

@@ -28,6 +28,7 @@
#include "wx/event.h" #include "wx/event.h"
#include "wx/window.h" #include "wx/window.h"
#include "wx/unix/private.h"
enum { enum {
wxJS_AXIS_X = 0, wxJS_AXIS_X = 0,
@@ -87,7 +88,7 @@ void* wxJoystickThread::Entry()
fd_set read_fds; fd_set read_fds;
struct timeval time_out = {0, 0}; struct timeval time_out = {0, 0};
FD_ZERO(&read_fds); wxFD_ZERO(&read_fds);
while (true) while (true)
{ {
if (TestDestroy()) if (TestDestroy())
@@ -100,9 +101,9 @@ void* wxJoystickThread::Entry()
else else
time_out.tv_usec = 10 * 1000; // check at least every 10 msec in blocking case 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); 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)); memset(&j_evt, 0, sizeof(j_evt));
read(m_device, &j_evt, sizeof(j_evt)); read(m_device, &j_evt, sizeof(j_evt));

View File

@@ -1417,7 +1417,10 @@ bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
// could adjust the code to ask confirmation if it already exists and // could adjust the code to ask confirmation if it already exists and
// overwriteprompt is true, but this is currently ignored as *Associate* has // overwriteprompt is true, but this is currently ignored as *Associate* has
// no overwrite prompt // 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; wxArrayString strExtensions;
wxString strDesc, strIcon; 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 // 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; if (strIcon.empty()) return false;
wxArrayString strExtensions; wxArrayString strExtensions;

View File

@@ -760,7 +760,7 @@ void *wxThreadInternal::PthreadStart(wxThread *thread)
wxLogTrace(TRACE_THREADS, wxLogTrace(TRACE_THREADS,
_T("Thread %ld Entry() returned %lu."), _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); wxCriticalSectionLocker lock(thread->m_critsect);
@@ -1215,43 +1215,22 @@ void wxThread::SetPriority(unsigned int prio)
case STATE_PAUSED: case STATE_PAUSED:
#ifdef HAVE_THREAD_PRIORITY_FUNCTIONS #ifdef HAVE_THREAD_PRIORITY_FUNCTIONS
#if defined(__LINUX__) #if defined(__LINUX__)
// On Linux, pthread_setschedparam with SCHED_OTHER does not allow // On Linux, pthread_setschedparam with SCHED_OTHER does not allow
// a priority other than 0. Instead, we use the BSD setpriority // a priority other than 0. Instead, we use the BSD setpriority
// which alllows us to set a 'nice' value between 20 to -20. Only // 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 // super user can set a value less than zero (more negative yields
// higher priority). setpriority set the static priority of a process, // higher priority). setpriority set the static priority of a
// but this is OK since Linux is configured as a thread per process. // process, but this is OK since Linux is configured as a thread
{ // per process.
float fPrio; //
float pSpan; // FIXME this is not true for 2.6!!
int iPrio;
// Map Wx priorites (WXTHREAD_MIN_PRIORITY - // map wx priorites WXTHREAD_MIN_PRIORITY..WXTHREAD_MAX_PRIORITY
// WXTHREAD_MAX_PRIORITY) into BSD priorities (20 - -20). // to Unix priorities 20..-20
// Do calculation of values instead of hard coding them if ( setpriority(PRIO_PROCESS, 0, -(2*prio)/5 + 20) == -1 )
// 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;
if (setpriority(PRIO_PROCESS, 0, iPrio) == -1)
{ {
wxLogError(_("Failed to set thread priority %d."), prio); wxLogError(_("Failed to set thread priority %d."), prio);
} }
}
#else // __LINUX__ #else // __LINUX__
{ {
struct sched_param sparam; struct sched_param sparam;
@@ -1541,7 +1520,8 @@ wxThread::~wxThread()
if ( m_internal->GetState() != STATE_EXITED && if ( m_internal->GetState() != STATE_EXITED &&
m_internal->GetState() != STATE_NEW ) 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(); m_critsect.Leave();

View File

@@ -15,8 +15,6 @@
// headers // headers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#include <pwd.h>
// for compilers that support precompilation, includes "wx.h". // for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
@@ -35,6 +33,9 @@
#include "wx/wfstream.h" #include "wx/wfstream.h"
#include "wx/unix/execute.h" #include "wx/unix/execute.h"
#include "wx/unix/private.h"
#include <pwd.h>
#if wxUSE_STREAMS #if wxUSE_STREAMS
@@ -425,8 +426,10 @@ bool wxPipeInputStream::CanRead() const
const int fd = m_file->fd(); const int fd = m_file->fd();
fd_set readfds; 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) ) switch ( select(fd + 1, &readfds, NULL, NULL, &tv) )
{ {
case -1: case -1:
@@ -454,13 +457,7 @@ bool wxPipeInputStream::CanRead() const
// wxExecute: the real worker function // wxExecute: the real worker function
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef __VMS long wxExecute(wxChar **argv, int flags, wxProcess *process)
#pragma message disable codeunreachable
#endif
long wxExecute(wxChar **argv,
int flags,
wxProcess *process)
{ {
// for the sync execution, we return -1 to indicate failure, but for async // for the sync execution, we return -1 to indicate failure, but for async
// case we return 0 which is never a valid PID // case we return 0 which is never a valid PID
@@ -677,12 +674,10 @@ long wxExecute(wxChar **argv,
return traits->WaitForChild(execData); return traits->WaitForChild(execData);
} }
#if !defined(__VMS) && !defined(__INTEL_COMPILER)
return ERROR_RETURN_CODE; return ERROR_RETURN_CODE;
}
#ifdef __VMS
#pragma message enable codeunreachable
#endif #endif
}
#undef ERROR_RETURN_CODE #undef ERROR_RETURN_CODE
#undef ARGS_CLEANUP #undef ARGS_CLEANUP

View File

@@ -53,6 +53,10 @@ static Atom _NET_SUPPORTED = 0;
if (name == 0) name = XInternAtom((display), #name, False) 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? // Is the window mapped?
static bool IsMapped(Display *display, Window window) static bool IsMapped(Display *display, Window window)
{ {
@@ -159,7 +163,7 @@ void wxSetIconsX11( WXDisplay* display, WXWindow window,
} }
XChangeProperty( (Display*)display, XChangeProperty( (Display*)display,
(Window)window, WindowCast(window),
_NET_WM_ICON, _NET_WM_ICON,
XA_CARDINAL, 32, XA_CARDINAL, 32,
PropModeReplace, PropModeReplace,
@@ -169,10 +173,10 @@ void wxSetIconsX11( WXDisplay* display, WXWindow window,
else else
{ {
XDeleteProperty( (Display*)display, XDeleteProperty( (Display*)display,
(Window)window, WindowCast(window),
_NET_WM_ICON ); _NET_WM_ICON );
} }
#endif #endif // !wxUSE_NANOX
} }
@@ -456,7 +460,7 @@ static void wxSetKDEFullscreen(Display *display, Window rootWnd,
wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display, wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display,
WXWindow rootWindow) WXWindow rootWindow)
{ {
Window root = (Window)rootWindow; Window root = WindowCast(rootWindow);
Display *disp = (Display*)display; Display *disp = (Display*)display;
// if WM supports _NET_WM_STATE_FULLSCREEN from wm-spec 1.2, use it: // if WM supports _NET_WM_STATE_FULLSCREEN from wm-spec 1.2, use it:
@@ -490,8 +494,8 @@ void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow,
// NB: please see the comment under "Fullscreen mode:" title above // NB: please see the comment under "Fullscreen mode:" title above
// for implications of changing this code. // for implications of changing this code.
Window wnd = (Window)window; Window wnd = WindowCast(window);
Window root = (Window)rootWindow; Window root = WindowCast(rootWindow);
Display *disp = (Display*)display; Display *disp = (Display*)display;
if (method == wxX11_FS_AUTODETECT) if (method == wxX11_FS_AUTODETECT)
@@ -807,7 +811,7 @@ bool wxGetKeyState(wxKeyCode key)
return (iMask & iKeyMask) != 0; return (iMask & iKeyMask) != 0;
} }
#endif #endif // __WXX11__ || __WXGTK__ || __WXMOTIF__

View File

@@ -27,6 +27,7 @@
#include "wx/timer.h" #include "wx/timer.h"
#include "wx/hash.h" #include "wx/hash.h"
#include "wx/module.h" #include "wx/module.h"
#include "wx/unix/private.h"
#include "wx/x11/private.h" #include "wx/x11/private.h"
#include "X11/Xlib.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) if (entry->m_fdInput != -1)
{ {
FD_SET(entry->m_fdInput, readset); wxFD_SET(entry->m_fdInput, readset);
if (entry->m_fdInput > *highest) if (entry->m_fdInput > *highest)
* highest = entry->m_fdInput; * highest = entry->m_fdInput;
} }
if (entry->m_fdOutput != -1) if (entry->m_fdOutput != -1)
{ {
FD_SET(entry->m_fdOutput, writeset); wxFD_SET(entry->m_fdOutput, writeset);
if (entry->m_fdOutput > *highest) if (entry->m_fdOutput > *highest)
* highest = entry->m_fdOutput; * highest = entry->m_fdOutput;
} }
@@ -198,12 +199,12 @@ void wxSocketTable::ProcessEvents(fd_set* readset, fd_set* writeset)
{ {
wxSocketTableEntry* entry = (wxSocketTableEntry*) node->GetData(); 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); (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); (entry->m_callbackOutput) (entry->m_fdOutput, entry->m_dataOutput);
} }
@@ -455,10 +456,10 @@ bool wxEventLoop::Dispatch()
fd_set readset; fd_set readset;
fd_set writeset; fd_set writeset;
int highest = fd; int highest = fd;
FD_ZERO(&readset); wxFD_ZERO(&readset);
FD_ZERO(&writeset); wxFD_ZERO(&writeset);
FD_SET(fd, &readset); wxFD_SET(fd, &readset);
#if wxUSE_SOCKETS #if wxUSE_SOCKETS
if (wxTheSocketTable) if (wxTheSocketTable)
@@ -473,7 +474,7 @@ bool wxEventLoop::Dispatch()
else else
{ {
// An X11 event was pending, so get it // An X11 event was pending, so get it
if (FD_ISSET( fd, &readset )) if (wxFD_ISSET( fd, &readset ))
XNextEvent( wxGlobalDisplay(), &event ); XNextEvent( wxGlobalDisplay(), &event );
#if wxUSE_SOCKETS #if wxUSE_SOCKETS

View File

@@ -42,7 +42,7 @@
#include "wx/xrc/xmlres.h" #include "wx/xrc/xmlres.h"
#include "wx/arrimpl.cpp" #include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(wxXmlResourceDataRecords); WX_DEFINE_OBJARRAY(wxXmlResourceDataRecords)
wxXmlResource *wxXmlResource::ms_instance = NULL; wxXmlResource *wxXmlResource::ms_instance = NULL;
@@ -679,7 +679,7 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent,
#include "wx/listimpl.cpp" #include "wx/listimpl.cpp"
WX_DECLARE_LIST(wxXmlSubclassFactory, wxXmlSubclassFactoriesList); WX_DECLARE_LIST(wxXmlSubclassFactory, wxXmlSubclassFactoriesList);
WX_DEFINE_LIST(wxXmlSubclassFactoriesList); WX_DEFINE_LIST(wxXmlSubclassFactoriesList)
wxXmlSubclassFactoriesList *wxXmlResource::ms_subclassFactories = NULL; wxXmlSubclassFactoriesList *wxXmlResource::ms_subclassFactories = NULL;
@@ -936,7 +936,7 @@ float wxXmlResourceHandler::GetFloat(const wxString& param, float defaultv)
setlocale(LC_NUMERIC, prevlocale); setlocale(LC_NUMERIC, prevlocale);
#endif #endif
return value; return wx_truncate_cast(float, value);
} }

View File

@@ -43,7 +43,7 @@ private:
#include "wx/arrimpl.cpp" #include "wx/arrimpl.cpp"
WX_DECLARE_OBJARRAY(XRCWidgetData,ArrayOfXRCWidgetData); WX_DECLARE_OBJARRAY(XRCWidgetData,ArrayOfXRCWidgetData);
WX_DEFINE_OBJARRAY(ArrayOfXRCWidgetData); WX_DEFINE_OBJARRAY(ArrayOfXRCWidgetData)
class XRCWndClassData class XRCWndClassData
{ {
@@ -148,7 +148,7 @@ public:
}; };
}; };
WX_DECLARE_OBJARRAY(XRCWndClassData,ArrayOfXRCWndClassData); WX_DECLARE_OBJARRAY(XRCWndClassData,ArrayOfXRCWndClassData);
WX_DEFINE_OBJARRAY(ArrayOfXRCWndClassData); WX_DEFINE_OBJARRAY(ArrayOfXRCWndClassData)
class XmlResApp : public wxAppConsole class XmlResApp : public wxAppConsole
@@ -502,8 +502,9 @@ static wxString FileToCppArray(wxString filename, int num)
wxFFile file(filename, wxT("rb")); wxFFile file(filename, wxT("rb"));
wxFileOffset offset = file.Length(); wxFileOffset offset = file.Length();
wxASSERT_MSG( offset >= 0 , wxT("Invalid 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); snum.Printf(_T("%i"), num);
output.Printf(_T("static size_t xml_res_size_") + snum + _T(" = %i;\n"), lng); 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")); wxFFile file(filename, wxT("rb"));
wxFileOffset offset = file.Length(); wxFileOffset offset = file.Length();
wxASSERT_MSG( offset >= 0 , wxT("Invalid 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); snum.Printf(_T("%i"), num);
output = _T(" xml_res_file_") + snum + _T(" = '''\\\n"); output = _T(" xml_res_file_") + snum + _T(" = '''\\\n");