Fix lots of warnings reported by Clang.
Mostly potentially lossy implicit conversions in headers (long->int). Also dangling else warnings. Struct/class mismatches. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
8778519200
commit
17473a770a
@ -251,7 +251,7 @@ protected: \
|
||||
typedef const value_type* const_iterator; \
|
||||
typedef value_type& reference; \
|
||||
typedef const value_type& const_reference; \
|
||||
typedef int difference_type; \
|
||||
typedef ptrdiff_t difference_type; \
|
||||
typedef size_t size_type; \
|
||||
\
|
||||
void assign(const_iterator first, const_iterator last); \
|
||||
|
@ -381,27 +381,27 @@ inline wxSize operator/(const wxSize& s, long i)
|
||||
|
||||
inline wxSize operator*(const wxSize& s, long i)
|
||||
{
|
||||
return wxSize(s.x * i, s.y * i);
|
||||
return wxSize(int(s.x * i), int(s.y * i));
|
||||
}
|
||||
|
||||
inline wxSize operator*(long i, const wxSize& s)
|
||||
{
|
||||
return wxSize(s.x * i, s.y * i);
|
||||
return wxSize(int(s.x * i), int(s.y * i));
|
||||
}
|
||||
|
||||
inline wxSize operator/(const wxSize& s, unsigned long i)
|
||||
{
|
||||
return wxSize(s.x / i, s.y / i);
|
||||
return wxSize(int(s.x / i), int(s.y / i));
|
||||
}
|
||||
|
||||
inline wxSize operator*(const wxSize& s, unsigned long i)
|
||||
{
|
||||
return wxSize(s.x * i, s.y * i);
|
||||
return wxSize(int(s.x * i), int(s.y * i));
|
||||
}
|
||||
|
||||
inline wxSize operator*(unsigned long i, const wxSize& s)
|
||||
{
|
||||
return wxSize(s.x * i, s.y * i);
|
||||
return wxSize(int(s.x * i), int(s.y * i));
|
||||
}
|
||||
|
||||
inline wxSize operator*(const wxSize& s, double i)
|
||||
@ -655,12 +655,12 @@ inline wxPoint operator/(const wxPoint& s, long i)
|
||||
|
||||
inline wxPoint operator*(const wxPoint& s, long i)
|
||||
{
|
||||
return wxPoint(s.x * i, s.y * i);
|
||||
return wxPoint(int(s.x * i), int(s.y * i));
|
||||
}
|
||||
|
||||
inline wxPoint operator*(long i, const wxPoint& s)
|
||||
{
|
||||
return wxPoint(s.x * i, s.y * i);
|
||||
return wxPoint(int(s.x * i), int(s.y * i));
|
||||
}
|
||||
|
||||
inline wxPoint operator/(const wxPoint& s, unsigned long i)
|
||||
@ -670,12 +670,12 @@ inline wxPoint operator/(const wxPoint& s, unsigned long i)
|
||||
|
||||
inline wxPoint operator*(const wxPoint& s, unsigned long i)
|
||||
{
|
||||
return wxPoint(s.x * i, s.y * i);
|
||||
return wxPoint(int(s.x * i), int(s.y * i));
|
||||
}
|
||||
|
||||
inline wxPoint operator*(unsigned long i, const wxPoint& s)
|
||||
{
|
||||
return wxPoint(s.x * i, s.y * i);
|
||||
return wxPoint(int(s.x * i), int(s.y * i));
|
||||
}
|
||||
|
||||
inline wxPoint operator*(const wxPoint& s, double i)
|
||||
|
@ -398,7 +398,7 @@ public:
|
||||
void Add(wxColour col, float pos) { Add(wxGraphicsGradientStop(col, pos)); }
|
||||
|
||||
// Get the number of stops.
|
||||
unsigned GetCount() const { return m_stops.size(); }
|
||||
size_t GetCount() const { return m_stops.size(); }
|
||||
|
||||
// Return the stop at the given index (which must be valid).
|
||||
wxGraphicsGradientStop Item(unsigned n) const { return m_stops.at(n); }
|
||||
|
@ -483,8 +483,9 @@ inline bool grow_lf70( size_t buckets, size_t items )
|
||||
#ifndef wxNEEDS_WX_HASH_MAP
|
||||
|
||||
// integer types
|
||||
class WXDLLIMPEXP_BASE wxIntegerHash
|
||||
struct WXDLLIMPEXP_BASE wxIntegerHash
|
||||
{
|
||||
private:
|
||||
WX_HASH_MAP_NAMESPACE::hash<long> longHash;
|
||||
WX_HASH_MAP_NAMESPACE::hash<unsigned long> ulongHash;
|
||||
WX_HASH_MAP_NAMESPACE::hash<int> intHash;
|
||||
@ -527,9 +528,8 @@ public:
|
||||
#else // wxNEEDS_WX_HASH_MAP
|
||||
|
||||
// integer types
|
||||
class WXDLLIMPEXP_BASE wxIntegerHash
|
||||
struct WXDLLIMPEXP_BASE wxIntegerHash
|
||||
{
|
||||
public:
|
||||
wxIntegerHash() { }
|
||||
unsigned long operator()( long x ) const { return (unsigned long)x; }
|
||||
unsigned long operator()( unsigned long x ) const { return x; }
|
||||
@ -547,9 +547,8 @@ public:
|
||||
|
||||
#endif // !wxNEEDS_WX_HASH_MAP/wxNEEDS_WX_HASH_MAP
|
||||
|
||||
class WXDLLIMPEXP_BASE wxIntegerEqual
|
||||
struct WXDLLIMPEXP_BASE wxIntegerEqual
|
||||
{
|
||||
public:
|
||||
wxIntegerEqual() { }
|
||||
bool operator()( long a, long b ) const { return a == b; }
|
||||
bool operator()( unsigned long a, unsigned long b ) const { return a == b; }
|
||||
@ -566,9 +565,8 @@ public:
|
||||
};
|
||||
|
||||
// pointers
|
||||
class WXDLLIMPEXP_BASE wxPointerHash
|
||||
struct WXDLLIMPEXP_BASE wxPointerHash
|
||||
{
|
||||
public:
|
||||
wxPointerHash() { }
|
||||
|
||||
#ifdef wxNEEDS_WX_HASH_MAP
|
||||
@ -580,9 +578,8 @@ public:
|
||||
wxPointerHash& operator=(const wxPointerHash&) { return *this; }
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxPointerEqual
|
||||
struct WXDLLIMPEXP_BASE wxPointerEqual
|
||||
{
|
||||
public:
|
||||
wxPointerEqual() { }
|
||||
bool operator()( const void* a, const void* b ) const { return a == b; }
|
||||
|
||||
@ -590,9 +587,8 @@ public:
|
||||
};
|
||||
|
||||
// wxString, char*, wchar_t*
|
||||
class WXDLLIMPEXP_BASE wxStringHash
|
||||
struct WXDLLIMPEXP_BASE wxStringHash
|
||||
{
|
||||
public:
|
||||
wxStringHash() {}
|
||||
unsigned long operator()( const wxString& x ) const
|
||||
{ return stringHash( x.wx_str() ); }
|
||||
@ -616,9 +612,8 @@ public:
|
||||
wxStringHash& operator=(const wxStringHash&) { return *this; }
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_BASE wxStringEqual
|
||||
struct WXDLLIMPEXP_BASE wxStringEqual
|
||||
{
|
||||
public:
|
||||
wxStringEqual() {}
|
||||
bool operator()( const wxString& a, const wxString& b ) const
|
||||
{ return a == b; }
|
||||
|
@ -345,9 +345,9 @@ protected:
|
||||
wxHtmlContainerCell *m_Parent;
|
||||
|
||||
// dimensions of fragment (m_Descent is used to position text & images)
|
||||
long m_Width, m_Height, m_Descent;
|
||||
int m_Width, m_Height, m_Descent;
|
||||
// position where the fragment is drawn:
|
||||
long m_PosX, m_PosY;
|
||||
int m_PosX, m_PosY;
|
||||
|
||||
// superscript/subscript/normal:
|
||||
wxHtmlScriptMode m_ScriptMode;
|
||||
|
@ -165,9 +165,9 @@ private:
|
||||
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_8
|
||||
inline int wxHtmlTag::GetBeginPos() const { return m_Begin - m_sourceStart; }
|
||||
inline int wxHtmlTag::GetEndPos1() const { return m_End1 - m_sourceStart; }
|
||||
inline int wxHtmlTag::GetEndPos2() const { return m_End2 - m_sourceStart; }
|
||||
inline int wxHtmlTag::GetBeginPos() const { return int(m_Begin - m_sourceStart); }
|
||||
inline int wxHtmlTag::GetEndPos1() const { return int(m_End1 - m_sourceStart); }
|
||||
inline int wxHtmlTag::GetEndPos2() const { return int(m_End2 - m_sourceStart); }
|
||||
#endif // WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
|
||||
|
@ -204,7 +204,7 @@ private:
|
||||
// actual hypertext link or empty string
|
||||
bool m_UseLink;
|
||||
// true if m_Link is not empty
|
||||
long m_CharHeight, m_CharWidth;
|
||||
int m_CharHeight, m_CharWidth;
|
||||
// average height of normal-sized text
|
||||
int m_Align;
|
||||
// actual alignment
|
||||
|
@ -218,7 +218,7 @@ inline const void *wxListCastElementToVoidPtr(const wxString& str)
|
||||
} \
|
||||
int IndexOf() const \
|
||||
{ \
|
||||
return *this ? std::distance( m_list->begin(), m_iter ) \
|
||||
return *this ? (int)std::distance( m_list->begin(), m_iter ) \
|
||||
: wxNOT_FOUND; \
|
||||
} \
|
||||
}; \
|
||||
|
@ -1067,7 +1067,7 @@ inline wxULongLong operator+(unsigned long l, const wxULongLong& ull) { return u
|
||||
inline wxLongLong operator-(unsigned long l, const wxULongLong& ull)
|
||||
{
|
||||
wxULongLong ret = wxULongLong(l) - ull;
|
||||
return wxLongLong((long)ret.GetHi(),ret.GetLo());
|
||||
return wxLongLong((wxInt32)ret.GetHi(),ret.GetLo());
|
||||
}
|
||||
|
||||
#if wxUSE_LONGLONG_NATIVE && wxUSE_STREAMS
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
long GetWidth() const { return GetW(); }
|
||||
long GetH() const;
|
||||
long GetHeight() const { return GetH(); }
|
||||
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
||||
wxRect GetRect() const { return wxRect((int)GetX(), (int)GetY(), (int)GetWidth(), (int)GetHeight()); }
|
||||
|
||||
private:
|
||||
void SetRects(long numRects, wxRect *rects);
|
||||
|
@ -814,7 +814,7 @@ protected:
|
||||
"Can't calculate number of cols if number of rows is not specified"
|
||||
);
|
||||
|
||||
return (m_children.GetCount() + m_rows - 1) / m_rows;
|
||||
return int(m_children.GetCount() + m_rows - 1) / m_rows;
|
||||
}
|
||||
|
||||
int CalcRows() const
|
||||
@ -825,7 +825,7 @@ protected:
|
||||
"Can't calculate number of cols if number of rows is not specified"
|
||||
);
|
||||
|
||||
return (m_children.GetCount() + m_cols - 1) / m_cols;
|
||||
return int(m_children.GetCount() + m_cols - 1) / m_cols;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -54,7 +54,7 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusBarNameStr[];
|
||||
class WXDLLIMPEXP_CORE wxStatusBarPane
|
||||
{
|
||||
public:
|
||||
wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0)
|
||||
wxStatusBarPane(int style = wxSB_NORMAL, int width = 0)
|
||||
: m_nStyle(style), m_nWidth(width)
|
||||
{ m_bEllipsized = false; }
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
// set the number of fields and call SetStatusWidths(widths) if widths are
|
||||
// given
|
||||
virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
|
||||
int GetFieldsCount() const { return m_panes.GetCount(); }
|
||||
int GetFieldsCount() const { return (int)m_panes.GetCount(); }
|
||||
|
||||
// field text
|
||||
// ----------
|
||||
|
@ -4557,8 +4557,8 @@ public:
|
||||
}
|
||||
virtual void Replace(long from, long to, const wxString& text)
|
||||
{
|
||||
SetTargetStart(from);
|
||||
SetTargetEnd(to);
|
||||
SetTargetStart((int)from);
|
||||
SetTargetEnd((int)to);
|
||||
ReplaceTarget(text);
|
||||
}
|
||||
|
||||
@ -4579,7 +4579,7 @@ public:
|
||||
|
||||
virtual void SetInsertionPoint(long pos)
|
||||
{
|
||||
SetCurrentPos(pos == -1 ? GetLastPosition() : pos);
|
||||
SetCurrentPos(int(pos == -1 ? GetLastPosition() : pos));
|
||||
}
|
||||
virtual long GetInsertionPoint() const { return GetCurrentPos(); }
|
||||
virtual long GetLastPosition() const { return GetTextLength(); }
|
||||
@ -4592,8 +4592,8 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSelectionStart(from);
|
||||
SetSelectionEnd(to);
|
||||
SetSelectionStart((int)from);
|
||||
SetSelectionEnd((int)to);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4619,9 +4619,9 @@ public:
|
||||
long f, t;
|
||||
GetSelection(&f, &t);
|
||||
if ( from )
|
||||
*from = f;
|
||||
*from = (int)f;
|
||||
if ( to )
|
||||
*to = t;
|
||||
*to = (int)t;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -4673,14 +4673,14 @@ public:
|
||||
|
||||
virtual long XYToPosition(long x, long y) const
|
||||
{
|
||||
long pos = PositionFromLine(y);
|
||||
long pos = PositionFromLine((int)y);
|
||||
pos += x;
|
||||
return pos;
|
||||
}
|
||||
|
||||
virtual bool PositionToXY(long pos, long *x, long *y) const
|
||||
{
|
||||
long l = LineFromPosition(pos);
|
||||
int l = LineFromPosition((int)pos);
|
||||
if ( l == -1 )
|
||||
return false;
|
||||
|
||||
@ -4693,7 +4693,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void ShowPosition(long pos) { GotoPos(pos); }
|
||||
virtual void ShowPosition(long pos) { GotoPos((int)pos); }
|
||||
|
||||
// FIXME-VC6: can't use wxWindow here because of "error C2603: illegal
|
||||
// access declaration: 'wxWindow' is not a direct base of
|
||||
|
@ -889,7 +889,7 @@ public:
|
||||
public: \
|
||||
WX_DEFINE_ITERATOR_CATEGORY(WX_STR_ITERATOR_TAG) \
|
||||
typedef wxUniChar value_type; \
|
||||
typedef int difference_type; \
|
||||
typedef ptrdiff_t difference_type; \
|
||||
typedef reference_type reference; \
|
||||
typedef pointer_type pointer; \
|
||||
\
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
wxUniChar(unsigned char c) { m_value = From8bit((char)c); }
|
||||
|
||||
#define wxUNICHAR_DEFINE_CTOR(type) \
|
||||
wxUniChar(type c) { m_value = c; }
|
||||
wxUniChar(type c) { m_value = (value_type)c; }
|
||||
wxDO_FOR_INT_TYPES(wxUNICHAR_DEFINE_CTOR)
|
||||
#undef wxUNICHAR_DEFINE_CTOR
|
||||
|
||||
@ -112,7 +112,7 @@ public:
|
||||
wxUniChar& operator=(unsigned char c) { m_value = From8bit((char)c); return *this; }
|
||||
|
||||
#define wxUNICHAR_DEFINE_OPERATOR_EQUAL(type) \
|
||||
wxUniChar& operator=(type c) { m_value = c; return *this; }
|
||||
wxUniChar& operator=(type c) { m_value = (value_type)c; return *this; }
|
||||
wxDO_FOR_INT_TYPES(wxUNICHAR_DEFINE_OPERATOR_EQUAL)
|
||||
#undef wxUNICHAR_DEFINE_OPERATOR_EQUAL
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
|
||||
wxWindowIDRef(long id)
|
||||
{
|
||||
Init(id);
|
||||
Init(wxWindowID(id));
|
||||
}
|
||||
|
||||
wxWindowIDRef(const wxWindowIDRef& id)
|
||||
@ -66,7 +66,7 @@ public:
|
||||
|
||||
wxWindowIDRef& operator=(long id)
|
||||
{
|
||||
Assign(id);
|
||||
Assign(wxWindowID(id));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -981,7 +981,7 @@ public:
|
||||
/**
|
||||
Returns the number of stops.
|
||||
*/
|
||||
unsigned GetCount() const;
|
||||
size_t GetCount() const;
|
||||
|
||||
/**
|
||||
Set the start colour to @a col
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
/**
|
||||
Constructs the pane with the given @a style and @a width.
|
||||
*/
|
||||
wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0);
|
||||
wxStatusBarPane(int style = wxSB_NORMAL, int width = 0);
|
||||
|
||||
/**
|
||||
Returns the pane width; it maybe negative, indicating a variable-width field.
|
||||
|
@ -484,7 +484,9 @@ WX_IMPLEMENT_ANY_VALUE_TYPE(wxAnyValueTypeImpl<wxDateTime>)
|
||||
|
||||
class wxAnyNullValue
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
// this field is unused, but can't be private to avoid Clang's
|
||||
// "Private field 'm_dummy' is not used" warning
|
||||
void* m_dummy;
|
||||
};
|
||||
|
||||
|
@ -1390,7 +1390,7 @@ wxChar *wxDoGetCwd(wxChar *buf, int sz)
|
||||
buf = new wxChar[sz + 1];
|
||||
}
|
||||
|
||||
bool ok wxDUMMY_INITIALIZE(false);
|
||||
bool ok = false;
|
||||
|
||||
// for the compilers which have Unicode version of _getcwd(), call it
|
||||
// directly, for the others call the ANSI version and do the translation
|
||||
|
@ -571,12 +571,14 @@ bool wxLocale::Init(int language, int flags)
|
||||
namespace
|
||||
{
|
||||
|
||||
#ifndef __WXOSX__
|
||||
// Small helper function: get the value of the given environment variable and
|
||||
// return true only if the variable was found and has non-empty value.
|
||||
inline bool wxGetNonEmptyEnvVar(const wxString& name, wxString* value)
|
||||
{
|
||||
return wxGetEnv(name, value) && !value->empty();
|
||||
}
|
||||
#endif
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
@ -591,7 +593,7 @@ inline bool wxGetNonEmptyEnvVar(const wxString& name, wxString* value)
|
||||
#if defined(__UNIX__)
|
||||
// first get the string identifying the language from the environment
|
||||
wxString langFull;
|
||||
#ifdef __WXMAC__
|
||||
#ifdef __WXOSX__
|
||||
wxCFRef<CFLocaleRef> userLocaleRef(CFLocaleCopyCurrent());
|
||||
|
||||
// because the locale identifier (kCFLocaleIdentifier) is formatted a little bit differently, eg
|
||||
|
@ -965,6 +965,7 @@ outlineView:(NSOutlineView*)outlineView
|
||||
delete[] dataFormats;
|
||||
delete itemObject;
|
||||
if (dataStringAvailable)
|
||||
{
|
||||
if (itemStringAvailable)
|
||||
{
|
||||
if (itemCounter > 0)
|
||||
@ -973,6 +974,7 @@ outlineView:(NSOutlineView*)outlineView
|
||||
}
|
||||
else
|
||||
dataStringAvailable = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1701,7 +1703,7 @@ outlineView:(NSOutlineView*)outlineView
|
||||
NSArray* sortDescriptors;
|
||||
NSSortDescriptor* sortDescriptor;
|
||||
|
||||
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:[NSString stringWithFormat:@"%d",[outlineView columnWithIdentifier:[tableColumn identifier]]]
|
||||
sortDescriptor = [[NSSortDescriptor alloc] initWithKey:[NSString stringWithFormat:@"%ld",(long)[outlineView columnWithIdentifier:[tableColumn identifier]]]
|
||||
ascending:YES];
|
||||
sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
|
||||
[tableColumn setSortDescriptorPrototype:sortDescriptor];
|
||||
|
@ -299,8 +299,8 @@ public:
|
||||
}
|
||||
virtual void Replace(long from, long to, const wxString& text)
|
||||
{
|
||||
SetTargetStart(from);
|
||||
SetTargetEnd(to);
|
||||
SetTargetStart((int)from);
|
||||
SetTargetEnd((int)to);
|
||||
ReplaceTarget(text);
|
||||
}
|
||||
|
||||
@ -321,7 +321,7 @@ public:
|
||||
|
||||
virtual void SetInsertionPoint(long pos)
|
||||
{
|
||||
SetCurrentPos(pos == -1 ? GetLastPosition() : pos);
|
||||
SetCurrentPos(int(pos == -1 ? GetLastPosition() : pos));
|
||||
}
|
||||
virtual long GetInsertionPoint() const { return GetCurrentPos(); }
|
||||
virtual long GetLastPosition() const { return GetTextLength(); }
|
||||
@ -334,8 +334,8 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSelectionStart(from);
|
||||
SetSelectionEnd(to);
|
||||
SetSelectionStart((int)from);
|
||||
SetSelectionEnd((int)to);
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,9 +361,9 @@ public:
|
||||
long f, t;
|
||||
GetSelection(&f, &t);
|
||||
if ( from )
|
||||
*from = f;
|
||||
*from = (int)f;
|
||||
if ( to )
|
||||
*to = t;
|
||||
*to = (int)t;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -415,14 +415,14 @@ public:
|
||||
|
||||
virtual long XYToPosition(long x, long y) const
|
||||
{
|
||||
long pos = PositionFromLine(y);
|
||||
long pos = PositionFromLine((int)y);
|
||||
pos += x;
|
||||
return pos;
|
||||
}
|
||||
|
||||
virtual bool PositionToXY(long pos, long *x, long *y) const
|
||||
{
|
||||
long l = LineFromPosition(pos);
|
||||
int l = LineFromPosition((int)pos);
|
||||
if ( l == -1 )
|
||||
return false;
|
||||
|
||||
@ -435,7 +435,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void ShowPosition(long pos) { GotoPos(pos); }
|
||||
virtual void ShowPosition(long pos) { GotoPos((int)pos); }
|
||||
|
||||
// FIXME-VC6: can't use wxWindow here because of "error C2603: illegal
|
||||
// access declaration: 'wxWindow' is not a direct base of
|
||||
|
Loading…
Reference in New Issue
Block a user