1. more HP-UX warning fixes (almost done...)

2. added a macro WXUNUSED_UNLESS_DEBUG()


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5273 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-01-06 15:42:32 +00:00
parent c0f587c500
commit 6f2a55e34a
14 changed files with 77 additions and 74 deletions

View File

@@ -972,23 +972,23 @@ public:
// ------------------------------------------------------------------------
// return the timespan for the given number of seconds
static wxTimeSpan Seconds(int sec) { return wxTimeSpan(0, 0, sec); }
static wxTimeSpan Seconds(long sec) { return wxTimeSpan(0, 0, sec); }
static wxTimeSpan Second() { return Seconds(1); }
// return the timespan for the given number of minutes
static wxTimeSpan Minutes(int min) { return wxTimeSpan(0, min, 0 ); }
static wxTimeSpan Minutes(long min) { return wxTimeSpan(0, min, 0 ); }
static wxTimeSpan Minute() { return Minutes(1); }
// return the timespan for the given number of hours
static wxTimeSpan Hours(int hours) { return wxTimeSpan(hours, 0, 0); }
static wxTimeSpan Hours(long hours) { return wxTimeSpan(hours, 0, 0); }
static wxTimeSpan Hour() { return Hours(1); }
// return the timespan for the given number of days
static wxTimeSpan Days(int days) { return Hours(24 * days); }
static wxTimeSpan Days(long days) { return Hours(24 * days); }
static wxTimeSpan Day() { return Days(1); }
// return the timespan for the given number of weeks
static wxTimeSpan Weeks(int days) { return Days(7 * days); }
static wxTimeSpan Weeks(long days) { return Days(7 * days); }
static wxTimeSpan Week() { return Weeks(1); }
// default ctor constructs the 0 time span
@@ -997,10 +997,10 @@ public:
// from separate values for each component, date set to 0 (hours are
// not restricted to 0..24 range, neither are minutes, seconds or
// milliseconds)
inline wxTimeSpan(int hours,
int minutes = 0,
int seconds = 0,
int milliseconds = 0);
inline wxTimeSpan(long hours,
long minutes = 0,
long seconds = 0,
long milliseconds = 0);
// default copy ctor is ok

View File

@@ -362,10 +362,10 @@ wxDateTime wxDateTime::ToTimezone(const wxDateTime::TimeZone& tz,
// wxTimeSpan construction
// ----------------------------------------------------------------------------
wxTimeSpan::wxTimeSpan(int hours, int minutes, int seconds, int milliseconds)
wxTimeSpan::wxTimeSpan(long hours, long minutes, long seconds, long milliseconds)
{
// assign first to avoid precision loss
m_diff = (long)hours;
m_diff = hours;
m_diff *= 60l;
m_diff += minutes;
m_diff *= 60l;

View File

@@ -317,6 +317,13 @@ typedef int wxWindowID;
#define WXUNUSED(identifier) identifier
#endif
// some arguments are only used in debug mode, but unused in release one
#ifdef __WXDEBUG__
#define WXUNUSED_UNLESS_DEBUG(param) param
#else
#define WXUNUSED_UNLESS_DEBUG(param) WXUNUSED(param)
#endif
// ----------------------------------------------------------------------------
// portable calling conventions macros
// ----------------------------------------------------------------------------

View File

@@ -107,7 +107,7 @@ public:
wxRegionIterator();
wxRegionIterator(const wxRegion& region);
void Reset() { m_current = 0; }
void Reset() { m_current = 0u; }
void Reset(const wxRegion& region);
operator bool () const;
@@ -125,8 +125,8 @@ public:
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
private:
long m_current;
wxRegion m_region;
size_t m_current;
wxRegion m_region;
private:
DECLARE_DYNAMIC_CLASS(wxRegionIterator);

View File

@@ -107,7 +107,7 @@ public:
wxRegionIterator();
wxRegionIterator(const wxRegion& region);
void Reset() { m_current = 0; }
void Reset() { m_current = 0u; }
void Reset(const wxRegion& region);
operator bool () const;
@@ -125,8 +125,8 @@ public:
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
private:
long m_current;
wxRegion m_region;
size_t m_current;
wxRegion m_region;
private:
DECLARE_DYNAMIC_CLASS(wxRegionIterator);

View File

@@ -77,7 +77,7 @@ struct wxCmdLineOption
// types increases, so always use the accessor functions and don't access
// the fields directly!)
void Check(wxCmdLineParamType typ) const
void Check(wxCmdLineParamType WXUNUSED_UNLESS_DEBUG(typ)) const
{
wxASSERT_MSG( type == typ, _T("type mismatch in wxCmdLineOption") );
}
@@ -188,7 +188,7 @@ void wxCmdLineParserData::SetArguments(int argc, char **argv)
}
}
void wxCmdLineParserData::SetArguments(const wxString& cmdline)
void wxCmdLineParserData::SetArguments(const wxString& WXUNUSED(cmdline))
{
// either use wxMSW wxApp::ConvertToStandardCommandArgs() or move its logic
// here and use this method from it - but don't duplicate the code

View File

@@ -269,7 +269,7 @@ void wxTextValidator::OnChar(wxKeyEvent& event)
if ( m_validatorWindow )
{
long keyCode = event.KeyCode();
int keyCode = (int)event.KeyCode();
// we don't filter special keys and Delete
if (

View File

@@ -471,8 +471,7 @@ void wxListLineData::SetPosition( wxDC *dc, int x, int y, int window_width )
void wxListLineData::SetColumnPosition( int index, int x )
{
int i = index;
wxNode *node = m_items.Nth( i );
wxNode *node = m_items.Nth( (size_t)index );
if (node)
{
wxListItemData *item = (wxListItemData*)node->Data();
@@ -613,10 +612,10 @@ void wxListLineData::SetAttributes(wxDC *dc,
void wxListLineData::DoDraw( wxDC *dc, bool hilight, bool paintBG )
{
long dev_x = dc->LogicalToDeviceX( m_bound_all.x-2 );
long dev_y = dc->LogicalToDeviceY( m_bound_all.y-2 );
long dev_w = dc->LogicalToDeviceXRel( m_bound_all.width+4 );
long dev_h = dc->LogicalToDeviceYRel( m_bound_all.height+4 );
wxCoord dev_x = dc->LogicalToDeviceX( m_bound_all.x-2 );
wxCoord dev_y = dc->LogicalToDeviceY( m_bound_all.y-2 );
wxCoord dev_w = dc->LogicalToDeviceXRel( m_bound_all.width+4 );
wxCoord dev_h = dc->LogicalToDeviceYRel( m_bound_all.height+4 );
if (!m_owner->IsExposed( dev_x, dev_y, dev_w, dev_h ))
{
@@ -918,8 +917,8 @@ void wxListHeaderWindow::DrawCurrent()
void wxListHeaderWindow::OnMouse( wxMouseEvent &event )
{
int x = event.GetX();
int y = event.GetY();
wxCoord x = (wxCoord)event.GetX();
wxCoord y = (wxCoord)event.GetY();
if (m_isDragging)
{
DrawCurrent();
@@ -1293,7 +1292,7 @@ void wxListMainWindow::DeleteLine( wxListLineData *line )
void wxListMainWindow::EditLabel( long item )
{
wxNode *node = m_lines.Nth( item );
wxNode *node = m_lines.Nth( (size_t)item );
wxCHECK_RET( node, wxT("wrong index in wxListCtrl::Edit()") );
m_currentEdit = (wxListLineData*) node->Data();
@@ -1366,8 +1365,8 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
wxClientDC dc(this);
PrepareDC(dc);
long x = dc.DeviceToLogicalX( (long)event.GetX() );
long y = dc.DeviceToLogicalY( (long)event.GetY() );
wxCoord x = dc.DeviceToLogicalX( (wxCoord)event.GetX() );
wxCoord y = dc.DeviceToLogicalY( (wxCoord)event.GetY() );
/* Did we actually hit an item ? */
long hitResult = 0;
@@ -1590,7 +1589,7 @@ void wxListMainWindow::OnChar( wxKeyEvent &event )
/* we send a list_key event up */
wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
le.m_code = event.KeyCode();
le.m_code = (int)event.KeyCode();
le.SetEventObject( parent );
parent->GetEventHandler()->ProcessEvent( le );
@@ -2000,7 +1999,7 @@ int wxListMainWindow::GetCountPerPage()
void wxListMainWindow::SetItem( wxListItem &item )
{
m_dirty = TRUE;
wxNode *node = m_lines.Nth( item.m_itemId );
wxNode *node = m_lines.Nth( (size_t)item.m_itemId );
if (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2017,7 +2016,7 @@ void wxListMainWindow::SetItemState( long item, long state, long stateMask )
if (stateMask & wxLIST_STATE_FOCUSED)
{
wxNode *node = m_lines.Nth( item );
wxNode *node = m_lines.Nth( (size_t)item );
if (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2031,10 +2030,10 @@ void wxListMainWindow::SetItemState( long item, long state, long stateMask )
if (stateMask & wxLIST_STATE_SELECTED)
{
bool on = state & wxLIST_STATE_SELECTED;
bool on = (state & wxLIST_STATE_SELECTED) != 0;
if (!on && (m_mode & wxLC_SINGLE_SEL)) return;
wxNode *node = m_lines.Nth( item );
wxNode *node = m_lines.Nth( (size_t)item );
if (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2047,7 +2046,7 @@ void wxListMainWindow::SetItemState( long item, long state, long stateMask )
RefreshLine( m_current );
if (oldCurrent) RefreshLine( oldCurrent );
}
bool on = state & wxLIST_STATE_SELECTED;
bool on = (state & wxLIST_STATE_SELECTED) != 0;
if (on != line->IsHilighted())
{
line->Hilight( on );
@@ -2062,7 +2061,7 @@ int wxListMainWindow::GetItemState( long item, long stateMask )
int ret = wxLIST_STATE_DONTCARE;
if (stateMask & wxLIST_STATE_FOCUSED)
{
wxNode *node = m_lines.Nth( item );
wxNode *node = m_lines.Nth( (size_t)item );
if (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2071,7 +2070,7 @@ int wxListMainWindow::GetItemState( long item, long stateMask )
}
if (stateMask & wxLIST_STATE_SELECTED)
{
wxNode *node = m_lines.Nth( item );
wxNode *node = m_lines.Nth( (size_t)item );
if (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2083,7 +2082,7 @@ int wxListMainWindow::GetItemState( long item, long stateMask )
void wxListMainWindow::GetItem( wxListItem &item )
{
wxNode *node = m_lines.Nth( item.m_itemId );
wxNode *node = m_lines.Nth( (size_t)item.m_itemId );
if (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2105,7 +2104,7 @@ int wxListMainWindow::GetItemCount()
void wxListMainWindow::GetItemRect( long index, wxRect &rect )
{
wxNode *node = m_lines.Nth( index );
wxNode *node = m_lines.Nth( (size_t)index );
if (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2122,7 +2121,7 @@ void wxListMainWindow::GetItemRect( long index, wxRect &rect )
bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos)
{
wxNode *node = m_lines.Nth( item );
wxNode *node = m_lines.Nth( (size_t)item );
if (node)
{
wxRect rect;
@@ -2322,7 +2321,7 @@ long wxListMainWindow::GetNextItem( long item, int WXUNUSED(geometry), int state
long ret = 0;
if (item > 0) ret = item;
if(ret >= GetItemCount()) return -1;
wxNode *node = m_lines.Nth( ret );
wxNode *node = m_lines.Nth( (size_t)ret );
while (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2338,7 +2337,7 @@ long wxListMainWindow::GetNextItem( long item, int WXUNUSED(geometry), int state
void wxListMainWindow::DeleteItem( long index )
{
m_dirty = TRUE;
wxNode *node = m_lines.Nth( index );
wxNode *node = m_lines.Nth( (size_t)index );
if (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2406,8 +2405,7 @@ void wxListMainWindow::EnsureVisible( long index )
wxListLineData *oldCurrent = m_current;
m_current = (wxListLineData *) NULL;
int i = index;
wxNode *node = m_lines.Nth( i );
wxNode *node = m_lines.Nth( (size_t)index );
if (node) m_current = (wxListLineData*)node->Data();
if (m_current) MoveToFocus();
m_current = oldCurrent;
@@ -2418,7 +2416,7 @@ long wxListMainWindow::FindItem(long start, const wxString& str, bool WXUNUSED(p
long pos = start;
wxString tmp = str;
if (pos < 0) pos = 0;
wxNode *node = m_lines.Nth( pos );
wxNode *node = m_lines.Nth( (size_t)pos );
while (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2435,7 +2433,7 @@ long wxListMainWindow::FindItem(long start, long data)
{
long pos = start;
if (pos < 0) pos = 0;
wxNode *node = m_lines.Nth( pos );
wxNode *node = m_lines.Nth( (size_t)pos );
while (node)
{
wxListLineData *line = (wxListLineData*)node->Data();
@@ -2458,7 +2456,7 @@ long wxListMainWindow::HitTest( int x, int y, int &flags )
long ret = line->IsHit( x, y );
if (ret & flags)
{
flags = ret;
flags = (int)ret;
return count;
}
node = node->Next();
@@ -2491,7 +2489,7 @@ void wxListMainWindow::InsertItem( wxListItem &item )
line->SetItem( 0, item );
if ((item.m_itemId >= 0) && (item.m_itemId < (int)m_lines.GetCount()))
{
wxNode *node = m_lines.Nth( item.m_itemId );
wxNode *node = m_lines.Nth( (size_t)item.m_itemId );
if (node) m_lines.Insert( node, line );
}
else
@@ -2509,7 +2507,7 @@ void wxListMainWindow::InsertColumn( long col, wxListItem &item )
wxListHeaderData *column = new wxListHeaderData( item );
if ((col >= 0) && (col < (int)m_columns.GetCount()))
{
wxNode *node = m_columns.Nth( col );
wxNode *node = m_columns.Nth( (size_t)col );
if (node)
m_columns.Insert( node, column );
}

View File

@@ -73,7 +73,7 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
if (style & wxICON_MASK)
{
wxStaticBitmap *icon = new wxStaticBitmap(
this, -1, wxTheApp->GetStdIcon(style & wxICON_MASK));
this, -1, wxTheApp->GetStdIcon((int)(style & wxICON_MASK)));
icon_text->Add( icon, 0, wxCENTER );
}

View File

@@ -162,8 +162,8 @@ void wxSplitterWindow::OnIdle(wxIdleEvent& WXUNUSED(event))
void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event)
{
wxCoord x = event.GetX(),
y = event.GetY();
wxCoord x = (wxCoord)event.GetX(),
y = (wxCoord)event.GetY();
// reset the cursor
#ifdef __WXMOTIF__

View File

@@ -70,8 +70,8 @@ public:
m_height = size.y;
}
long GetWidth() const { return m_width; }
long GetHeight() const { return m_height; }
wxCoord GetWidth() const { return m_width; }
wxCoord GetHeight() const { return m_height; }
wxCoord m_x;
wxCoord m_y;
@@ -303,8 +303,8 @@ bool wxToolBarSimple::Realize()
m_lastX = m_xMargin;
m_lastY += maxToolHeight + m_toolPacking;
}
tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
tool->m_x = (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
tool->m_y = (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
m_lastX += maxToolWidth + m_toolPacking;
}
@@ -316,8 +316,8 @@ bool wxToolBarSimple::Realize()
m_lastX += (maxToolWidth + m_toolPacking);
m_lastY = m_yMargin;
}
tool->m_x = (long) (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
tool->m_y = (long) (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
tool->m_x = (m_lastX + (maxToolWidth - tool->GetWidth())/2.0);
tool->m_y = (m_lastY + (maxToolHeight - tool->GetHeight())/2.0);
m_lastY += maxToolHeight + m_toolPacking;
}
@@ -586,10 +586,10 @@ void wxToolBarSimple::DrawTool(wxDC& dc, wxToolBarToolBase *toolBase)
}
else
{
long x = tool->m_x;
long y = tool->m_y;
long w = bitmap.GetWidth();
long h = bitmap.GetHeight();
wxCoord x = tool->m_x;
wxCoord y = tool->m_y;
wxCoord w = bitmap.GetWidth();
wxCoord h = bitmap.GetHeight();
wxPen thick_black_pen("BLACK", 3, wxSOLID);
memDC.SelectObject(bitmap);

View File

@@ -167,8 +167,8 @@ private:
// children but has a [+] button
int m_isBold :1; // render the label in bold font
int m_x, m_y;
long m_height, m_width;
wxCoord m_x, m_y;
wxCoord m_height, m_width;
int m_xCross, m_yCross;
int m_level;

View File

@@ -333,19 +333,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
wxRegionIterator::wxRegionIterator()
{
m_current = 0;
Reset();
}
wxRegionIterator::wxRegionIterator( const wxRegion& region )
{
m_region = region;
m_current = 0;
Reset(region);
}
void wxRegionIterator::Reset( const wxRegion& region )
{
m_region = region;
m_current = 0;
Reset();
}
wxRegionIterator::operator bool () const

View File

@@ -333,19 +333,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
wxRegionIterator::wxRegionIterator()
{
m_current = 0;
Reset();
}
wxRegionIterator::wxRegionIterator( const wxRegion& region )
{
m_region = region;
m_current = 0;
Reset(region);
}
void wxRegionIterator::Reset( const wxRegion& region )
{
m_region = region;
m_current = 0;
Reset();
}
wxRegionIterator::operator bool () const