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/mimetype.h
wx/unix/pipe.h
wx/unix/private.h
wx/unix/stackwalk.h
wx/unix/stdpaths.h
</set>

12
configure vendored
View File

@@ -14043,7 +14043,6 @@ if test "x$XLCXX" = "xyes" -a "x$USE_AIX" = "x1"; then
CXXFLAGS="$CXXFLAGS -qunique"
fi
case "${host}" in
powerpc-*-darwin* )
echo "$as_me:$LINENO: checking if __POWERPC__ is already defined" >&5
@@ -42627,9 +42626,16 @@ fi
INCLUDES="-I\${top_builddir}lib/wx/include/${TOOLCHAIN_FULLNAME} \
-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"
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
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"
fi
dnl This case is for PowerPC OS X vs. everything else
case "${host}" in
powerpc-*-darwin* )
@@ -6850,10 +6849,42 @@ INCLUDES="-I\${top_builddir}lib/wx/include/${TOOLCHAIN_FULLNAME} \
-I\${top_srcdir}/include $TOOLKIT_INCLUDE"
dnl C/C++ compiler options used to compile wxWidgets
if test "$GXX" = yes ; then
dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
dnl
dnl check for icc before gcc as icc is also recognized as gcc
if test "$GCC" = yes ; then
dnl Warnings which can't be easily suppressed in C code are disabled:
dnl
dnl remark #810: conversion from "x" to "y" may lose significant bits
dnl remark #869: parameter "foo" was never referenced
dnl remark #1572: floating-point equality and inequality comparisons
dnl are unreliable
dnl remark #1684: conversion from pointer to same-sized integral type
dnl
dnl (for others see below)
CWARNINGS="-Wall -wd810,869,981,1418,1572,1684"
elif test "$GCC" = yes ; then
CWARNINGS="-Wall -Wundef"
CXXWARNINGS="$CWARNINGS -Wno-ctor-dtor-privacy"
fi
if test "$INTELCXX" = yes ; then
dnl Intel compiler gives some warnings which simply can't be worked
dnl around or of which we have too many (810, 869) so it's impractical to
dnl keep them enabled even if in theory it would be nice and some others
dnl (279) are generated for standard macros and so there is nothing we can
dnl do about them
dnl
dnl remark #279: controlling expression is constant
dnl remark #383: value copied to temporary, reference to temporary used
dnl remark #444: destructor for base class "xxx" is not virtual
dnl remark #810: conversion from "x" to "y" may lose significant bits
dnl remark #869: parameter "foo" was never referenced
dnl remark #981: operands are evaluated in unspecified order
dnl remark #1418: external definition with no prior declaration
dnl remark #1419: external declaration in primary source file
CXXWARNINGS="-Wall -wd279,383,444,869,981,1418,1419"
elif test "$GXX" = yes ; then
dnl CXXWARNINGS="-Wall -W -Wcast-qual -Werror"
CXXWARNINGS="-Wall -Wundef -Wno-ctor-dtor-privacy"
fi
EXTRA_CFLAGS="$WXDEBUG $WXODBCFLAG $PROFILE $OPTIMISE"

View File

@@ -661,6 +661,7 @@ public:
} \
wxAppInitializer \
wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \
DECLARE_APP(appname) \
appname& wxGetApp() { return *(appname *)wxTheApp; }
// Same as IMPLEMENT_APP() normally but doesn't include themes support in
@@ -684,5 +685,13 @@ public:
// function
#define DECLARE_APP(appname) extern appname& wxGetApp();
// declare the stuff defined by IMPLEMENT_APP() macro, it's not really needed
// anywhere else but at the very least it suppresses icc warnings about
// defining extern symbols without prior declaration, and it shouldn't do any
// harm
extern wxAppConsole *wxCreateApp();
extern wxAppInitializer wxTheAppInitializer;
#endif // _WX_APP_H_BASE_

View File

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

View File

@@ -318,7 +318,13 @@ public:
// ctor: you can specify the text here or in SetText(), or override
// GetText()
wxTextDataObject(const wxString& text = wxEmptyString)
: wxDataObjectSimple(wxUSE_UNICODE?wxDF_UNICODETEXT:wxDF_TEXT),
: wxDataObjectSimple(
#if wxUSE_UNICODE
wxDF_UNICODETEXT
#else
wxDF_TEXT
#endif
),
m_text(text)
{
}
@@ -332,19 +338,8 @@ public:
// implement base class pure virtuals
// ----------------------------------
#if wxUSE_UNICODE && defined(__WXGTK20__)
virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; }
virtual void GetAllFormats(wxDataFormat *formats,
wxDataObjectBase::Direction WXUNUSED(dir) = Get) const;
virtual size_t GetDataSize() const { return GetDataSize(GetPreferredFormat()); }
virtual bool GetDataHere(void *buf) const { return GetDataHere(GetPreferredFormat(), buf); }
virtual bool SetData(size_t len, const void *buf) { return SetData(GetPreferredFormat(), len, buf); }
size_t GetDataSize(const wxDataFormat& format) const;
bool GetDataHere(const wxDataFormat& format, void *pBuf) const;
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf);
#elif wxUSE_UNICODE && defined(__WXMAC__)
// some platforms have 2 and not 1 format for text data
#if wxUSE_UNICODE && (defined(__WXGTK20__) || defined(__WXMAC__))
virtual size_t GetFormatCount(Direction WXUNUSED(dir) = Get) const { return 2; }
virtual void GetAllFormats(wxDataFormat *formats,
wxDataObjectBase::Direction WXUNUSED(dir) = Get) const;

View File

@@ -297,7 +297,23 @@ typedef int wxWindowID;
truncate from a larger to smaller type, static_cast<> can't be used for it
as it results in warnings when using some compilers (SGI mipspro for example)
*/
#define wx_truncate_cast(t, x) ((t)(x))
#if defined(__INTELC__) && defined(__cplusplus)
template <typename T, typename X>
inline T wx_truncate_cast_impl(X x)
{
#pragma warning(push)
/* explicit conversion of a 64-bit integral type to a smaller integral type */
#pragma warning(disable: 1683)
return (T)x;
#pragma warning(pop)
}
#define wx_truncate_cast(t, x) wx_truncate_cast_impl<t>(x)
#else /* !__INTELC__ */
#define wx_truncate_cast(t, x) ((t)(x))
#endif /* __INTELC__/!__INTELC__ */
/* for consistency with wxStatic/DynamicCast defined in wx/object.h */
#define wxConstCast(obj, className) wx_const_cast(className *, obj)
@@ -844,29 +860,43 @@ inline wxUIntPtr wxPtrToUInt(const void *p)
/*
VC++ 7.1 gives warnings about casts such as below even when they're
explicit with /Wp64 option, suppress them as we really know what we're
doing here
doing here. Same thing with icc with -Wall.
*/
#ifdef __VISUALC__
#pragma warning(disable: 4311) /* pointer truncation from '' to '' */
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(push)
#ifdef __VISUALC__
/* pointer truncation from '' to '' */
#pragma warning(disable: 4311)
#elif defined(__INTELC__)
/* conversion from pointer to same-sized integral type */
#pragma warning(disable: 1684)
#endif
#endif
return wx_reinterpret_cast(wxUIntPtr, p);
#ifdef __VISUALC__
#pragma warning(default: 4311)
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
inline void *wxUIntToPtr(wxUIntPtr p)
{
#ifdef __VISUALC__
#pragma warning(disable: 4312) /* conversion to type of greater size */
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(push)
#ifdef __VISUALC__
/* conversion to type of greater size */
#pragma warning(disable: 4312)
#elif defined(__INTELC__)
/* invalid type conversion: "wxUIntPtr={unsigned long}" to "void *" */
#pragma warning(disable: 171)
#endif
#endif
return wx_reinterpret_cast(void *, p);
#ifdef __VISUALC__
#pragma warning(default: 4312)
#if defined(__VISUALC__) || defined(__INTELC__)
#pragma warning(pop)
#endif
}
#endif /*__cplusplus*/

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
#define WX_APPEND_ARRAY(array, other) \
{ \
size_t count = (other).size(); \
for ( size_t n = 0; n < count; n++ ) \
size_t wxAAcnt = (other).size(); \
for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \
{ \
(array).push_back((other)[n]); \
(array).push_back((other)[wxAAn]); \
} \
}
@@ -982,10 +982,10 @@ WX_DEFINE_USER_EXPORTED_ARRAY_PTR(void *, wxArrayPtrVoid, class WXDLLIMPEXP_BASE
// count on it)!
#define WX_CLEAR_ARRAY(array) \
{ \
size_t count = (array).size(); \
for ( size_t n = 0; n < count; n++ ) \
size_t wxAAcnt = (array).size(); \
for ( size_t wxAAn = 0; wxAAn < wxAAcnt; wxAAn++ ) \
{ \
delete (array)[n]; \
delete (array)[wxAAn]; \
} \
\
(array).clear(); \

View File

@@ -63,7 +63,8 @@ public:
bool GetValue() const;
// Set the label
void SetLabel(const wxBitmap& label);
virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
virtual void SetLabel(const wxBitmap& label);
bool Enable(bool enable = TRUE);
static wxVisualAttributes

View File

@@ -63,7 +63,8 @@ public:
bool GetValue() const;
// Set the label
void SetLabel(const wxBitmap& label);
virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
virtual void SetLabel(const wxBitmap& label);
bool Enable(bool enable = TRUE);
static wxVisualAttributes

View File

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

View File

@@ -98,4 +98,17 @@ inline bool wxIsSameDouble(double x, double y) { return x == y; }
#endif /* __cplusplus */
#if wxUSE_APPLE_IEEE
#ifdef __cplusplus
extern "C" {
#endif
/* functions from common/extended.c */
extern wxFloat64 ConvertFromIeeeExtended(const wxInt8 *bytes);
extern void ConvertToIeeeExtended(wxFloat64 num, wxInt8 *bytes);
#ifdef __cplusplus
}
#endif
#endif /* wxUSE_APPLE_IEEE */
#endif /* _WX_MATH_H_ */

View File

@@ -13,7 +13,7 @@
#define _WX_FONT_H_
#if __WXMOTIF20__ && !__WXLESSTIF__
#define wxMOTIF_NEW_FONT_HANDLING 0 // safe default, change to 1 to enable
#define wxMOTIF_NEW_FONT_HANDLING 1 // safe default, change to 1 to enable
#else
#define wxMOTIF_NEW_FONT_HANDLING 0
#endif

View File

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

View File

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

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

View File

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

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

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1132,13 +1132,16 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName,
return false;
// get the file size (assume it is less than 4Gb...)
wxFileOffset nSize = fileMsg.Length();
if ( nSize == wxInvalidOffset )
wxFileOffset lenFile = fileMsg.Length();
if ( lenFile == wxInvalidOffset )
return false;
size_t nSize = wx_truncate_cast(size_t, lenFile);
wxASSERT_MSG( nSize == lenFile, _T("message catalog bigger than 4GB?") );
// read the whole file in memory
m_pData = new size_t8[nSize];
if ( fileMsg.Read(m_pData, (size_t)nSize) != nSize ) {
if ( fileMsg.Read(m_pData, nSize) != nSize ) {
wxDELETEA(m_pData);
return false;
}

View File

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

View File

@@ -50,12 +50,17 @@ wxMemoryInputStream::wxMemoryInputStream(const void *data, size_t len)
wxMemoryInputStream::wxMemoryInputStream(const wxMemoryOutputStream& stream)
{
ssize_t len = (ssize_t)stream.GetLength();
if (len == wxInvalidOffset) {
const wxFileOffset lenFile = stream.GetLength();
if ( lenFile == wxInvalidOffset )
{
m_i_streambuf = NULL;
m_lasterror = wxSTREAM_EOF;
return;
}
const size_t len = wx_truncate_cast(size_t, lenFile);
wxASSERT_MSG( len == lenFile, _T("huge files not supported") );
m_i_streambuf = new wxStreamBuffer(wxStreamBuffer::read);
m_i_streambuf->SetBufferIO(len); // create buffer
stream.CopyTo(m_i_streambuf->GetBufferStart(), len);

View File

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

View File

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

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

View File

@@ -576,7 +576,7 @@ wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode)
}
if (diff < 0 || diff > last_access)
return wxInvalidOffset;
size_t int_diff = (size_t)diff;
size_t int_diff = wx_truncate_cast(size_t, diff);
wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") );
SetIntPosition(int_diff);
return diff;
@@ -603,7 +603,7 @@ wxFileOffset wxStreamBuffer::Seek(wxFileOffset pos, wxSeekMode mode)
}
else
{
size_t int_diff = (size_t)diff;
size_t int_diff = wx_truncate_cast(size_t, diff);
wxCHECK_MSG( (wxFileOffset)int_diff == diff, wxInvalidOffset, wxT("huge file not supported") );
SetIntPosition(int_diff);
return pos;
@@ -660,7 +660,13 @@ wxStreamBase::~wxStreamBase()
size_t wxStreamBase::GetSize() const
{
wxFileOffset length = GetLength();
return length == wxInvalidOffset ? 0 : (size_t)length;
if ( length == wxInvalidOffset )
return 0;
const size_t len = wx_truncate_cast(size_t, length);
wxASSERT_MSG( len == length, _T("large files not supported") );
return len;
}
wxFileOffset wxStreamBase::OnSysSeek(wxFileOffset WXUNUSED(seek), wxSeekMode WXUNUSED(mode))
@@ -994,7 +1000,7 @@ size_t wxCountingOutputStream::OnSysWrite(const void *WXUNUSED(buffer),
wxFileOffset wxCountingOutputStream::OnSysSeek(wxFileOffset pos, wxSeekMode mode)
{
ssize_t new_pos = (ssize_t)pos;
ssize_t new_pos = wx_truncate_cast(ssize_t, pos);
switch ( mode )
{

View File

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

View File

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

View File

@@ -113,7 +113,7 @@ wxChar wxURI::TranslateEscape(const wxChar* s)
{
wxASSERT_MSG( IsHex(s[0]) && IsHex(s[1]), wxT("Invalid escape sequence!"));
return (wxChar)( CharToHex(s[0]) << 4 ) | CharToHex(s[1]);
return wx_truncate_cast(wxChar, (CharToHex(s[0]) << 4 ) | CharToHex(s[1]));
}
wxString wxURI::Unescape(const wxString& uri)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1590,7 +1590,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
#endif
}
void wxBitmap::UngetRawData(wxPixelDataBase& data)
void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data))
{
}
@@ -1621,19 +1621,36 @@ wxBitmapHandler::~wxBitmapHandler()
{
}
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
bool wxBitmapHandler::Create(wxBitmap * WXUNUSED(bitmap),
void * WXUNUSED(data),
long WXUNUSED(type),
int WXUNUSED(width),
int WXUNUSED(height),
int WXUNUSED(depth))
{
wxFAIL_MSG( _T("not implemented") );
return false;
}
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
bool wxBitmapHandler::LoadFile(wxBitmap * WXUNUSED(bitmap),
const wxString& WXUNUSED(name),
long WXUNUSED(flags),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{
wxFAIL_MSG( _T("not implemented") );
return false;
}
bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
bool wxBitmapHandler::SaveFile(const wxBitmap * WXUNUSED(bitmap),
const wxString& WXUNUSED(name),
int WXUNUSED(type),
const wxPalette * WXUNUSED(palette))
{
wxFAIL_MSG( _T("not implemented") );
return false;
}

View File

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

View File

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

View File

@@ -148,7 +148,8 @@ egg_tray_icon_get_type (void)
(GInstanceInitFunc) egg_tray_icon_init
};
our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon",
&our_info, (GTypeFlags)0);
}
return our_type;

View File

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

@@ -1590,7 +1590,7 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp)
#endif
}
void wxBitmap::UngetRawData(wxPixelDataBase& data)
void wxBitmap::UngetRawData(wxPixelDataBase& WXUNUSED(data))
{
}
@@ -1621,19 +1621,36 @@ wxBitmapHandler::~wxBitmapHandler()
{
}
bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth)
bool wxBitmapHandler::Create(wxBitmap * WXUNUSED(bitmap),
void * WXUNUSED(data),
long WXUNUSED(type),
int WXUNUSED(width),
int WXUNUSED(height),
int WXUNUSED(depth))
{
wxFAIL_MSG( _T("not implemented") );
return false;
}
bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight)
bool wxBitmapHandler::LoadFile(wxBitmap * WXUNUSED(bitmap),
const wxString& WXUNUSED(name),
long WXUNUSED(flags),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{
wxFAIL_MSG( _T("not implemented") );
return false;
}
bool wxBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette)
bool wxBitmapHandler::SaveFile(const wxBitmap * WXUNUSED(bitmap),
const wxString& WXUNUSED(name),
int WXUNUSED(type),
const wxPalette * WXUNUSED(palette))
{
wxFAIL_MSG( _T("not implemented") );
return false;
}

View File

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

View File

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

View File

@@ -148,7 +148,8 @@ egg_tray_icon_get_type (void)
(GInstanceInitFunc) egg_tray_icon_init
};
our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon",
&our_info, (GTypeFlags)0);
}
return our_type;

View File

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -43,7 +43,7 @@ FORCE_LINK_ME(m_image)
WX_DECLARE_OBJARRAY(int, CoordArray);
#include "wx/arrimpl.cpp" // this is a magic incantation which must be done!
WX_DEFINE_OBJARRAY(CoordArray);
WX_DEFINE_OBJARRAY(CoordArray)
// ---------------------------------------------------------------------------
@@ -692,12 +692,13 @@ TAG_HANDLER_BEGIN(IMG, "IMG,MAP,AREA")
}
if (cel != NULL && tag.HasParam(wxT("HREF")))
{
wxString tmp = tag.GetParam(wxT("HREF"));
wxString target = wxEmptyString;
if (tag.HasParam(wxT("TARGET"))) target = tag.GetParam(wxT("TARGET"));
cel->SetLink( wxHtmlLinkInfo(tmp, target));
wxString target;
if (tag.HasParam(wxT("TARGET")))
target = tag.GetParam(wxT("TARGET"));
cel->SetLink(wxHtmlLinkInfo(tag.GetParam(wxT("HREF")), target));
}
if (cel != NULL) m_WParser->GetContainer()->InsertCell( cel );
if (cel != NULL)
m_WParser->GetContainer()->InsertCell( cel );
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1417,7 +1417,10 @@ bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
// could adjust the code to ask confirmation if it already exists and
// overwriteprompt is true, but this is currently ignored as *Associate* has
// no overwrite prompt
bool wxFileTypeImpl::SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt /*= true*/)
bool
wxFileTypeImpl::SetCommand(const wxString& cmd,
const wxString& verb,
bool WXUNUSED(overwriteprompt))
{
wxArrayString strExtensions;
wxString strDesc, strIcon;
@@ -1441,7 +1444,7 @@ bool wxFileTypeImpl::SetCommand(const wxString& cmd, const wxString& verb, bool
}
// ignore index on the grouds that we only have one icon in a Unix file
bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon /*= wxEmptyString*/, int /*index = 0*/)
bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon, int WXUNUSED(index))
{
if (strIcon.empty()) return false;
wxArrayString strExtensions;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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