Fix MSVC C4312 warnings when casting 32bit ints to pointer types on 64bit builds

This commit is contained in:
david-beinder 2021-06-04 21:41:40 +02:00 committed by Mark Roszko
parent d32d107923
commit 86add3bb85
5 changed files with 19 additions and 13 deletions

View File

@ -455,7 +455,8 @@ void MODEL_3D::Draw( bool aTransparent, float aOpacity, bool aUseSelectedMateria
}
glDrawElements( GL_TRIANGLES, mat.m_render_idx_count, m_index_buffer_type,
reinterpret_cast<const void*>( mat.m_render_idx_buffer_offset ) );
reinterpret_cast<const void*>(
static_cast<uintptr_t>( mat.m_render_idx_buffer_offset ) ) );
}
}
@ -509,6 +510,7 @@ void MODEL_3D::DrawBboxes() const
? sizeof( GLushort ) : sizeof( GLuint );
glDrawElements( GL_LINES, bbox_idx_count * m_meshes_bbox.size(), m_bbox_index_buffer_type,
reinterpret_cast<const void*>( bbox_idx_count * idx_size ) );
reinterpret_cast<const void*>(
static_cast<uintptr_t>( bbox_idx_count * idx_size ) ) );
}

View File

@ -123,7 +123,7 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow()
mgr->ResetTools( TOOL_BASE::MODEL_RELOAD );
// Notify GAL
mgr->RunAction( ACTIONS::gridPreset, true, gridCfg.last_size_idx );
mgr->RunAction( ACTIONS::gridPreset, true, static_cast<intptr_t>( gridCfg.last_size_idx ) );
mgr->RunAction( ACTIONS::gridSetOrigin, true, new VECTOR2D( m_parent->GetGridOrigin() ) );
m_parent->UpdateGridSelectBox();

View File

@ -348,7 +348,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
}
else
{
m_toolManager->RunAction( ACTIONS::gridPreset, true, idx );
m_toolManager->RunAction( ACTIONS::gridPreset, true, static_cast<intptr_t>( idx ) );
}
UpdateStatusBar();
@ -453,7 +453,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
return;
m_toolManager->RunAction( "common.Control.zoomPreset", true, id );
m_toolManager->RunAction( ACTIONS::zoomPreset, true, static_cast<intptr_t>( id ) );
UpdateStatusBar();
m_canvas->Refresh();
}

View File

@ -253,7 +253,8 @@ bool EDIT_TOOL::invokeInlineRouter( int aDragMode )
if( theRouter->CanInlineDrag( aDragMode ) )
{
m_toolMgr->RunAction( PCB_ACTIONS::routerInlineDrag, true, aDragMode );
m_toolMgr->RunAction( PCB_ACTIONS::routerInlineDrag, true,
static_cast<intptr_t>( aDragMode ) );
return true;
}

View File

@ -302,7 +302,7 @@ void NET_GRID_TABLE::HideOtherNets( const NET_GRID_ENTRY& aNet )
void NET_GRID_TABLE::updateNetVisibility( const NET_GRID_ENTRY& aNet )
{
const TOOL_ACTION& action = aNet.visible ? PCB_ACTIONS::showNet : PCB_ACTIONS::hideNet;
m_frame->GetToolManager()->RunAction( action, true, aNet.code );
m_frame->GetToolManager()->RunAction( action, true, static_cast<intptr_t>( aNet.code ) );
}
@ -2488,21 +2488,24 @@ void APPEARANCE_CONTROLS::onNetContextMenu( wxCommandEvent& aEvent )
case ID_HIGHLIGHT_NET:
{
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::highlightNet, true, net.code );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::highlightNet, true,
static_cast<intptr_t>( net.code ) );
m_frame->GetCanvas()->Refresh();
break;
}
case ID_SELECT_NET:
{
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectNet, true, net.code );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectNet, true,
static_cast<intptr_t>( net.code ) );
m_frame->GetCanvas()->Refresh();
break;
}
case ID_DESELECT_NET:
{
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::deselectNet, true, net.code );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::deselectNet, true,
static_cast<intptr_t>( net.code ) );
m_frame->GetCanvas()->Refresh();
break;
}
@ -2553,7 +2556,7 @@ void APPEARANCE_CONTROLS::showNetclass( const wxString& aClassName, bool aShow )
{
if( net->GetNetClass() == defaultClass )
{
manager->RunAction( action, true, net->GetNetCode() );
manager->RunAction( action, true, static_cast<intptr_t>( net->GetNetCode() ) );
int row = m_netsTable->GetRowByNetcode( net->GetNetCode() );
@ -2571,7 +2574,7 @@ void APPEARANCE_CONTROLS::showNetclass( const wxString& aClassName, bool aShow )
if( NETINFO_ITEM* net = nets.GetNetItem( member ) )
{
int code = net->GetNetCode();
manager->RunAction( action, true, code );
manager->RunAction( action, true, static_cast<intptr_t>( code ) );
int row = m_netsTable->GetRowByNetcode( code );
@ -2746,7 +2749,7 @@ void APPEARANCE_CONTROLS::onNetclassContextMenu( wxCommandEvent& aEvent )
if( !aItem )
return;
int code = aItem->GetNetCode();
intptr_t code = static_cast<intptr_t>( aItem->GetNetCode() );
m_frame->GetToolManager()->RunAction( action, true, code );
} );
}