From 69b7c2a1b67f05f9738dfb97d740d16a4557c07a Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Tue, 7 May 2013 19:31:52 +0200 Subject: [PATCH] Removed some spurious float casts (explanation: float is implicitly promoted to double anyway, it's only useful for storage; also a fp variable forces conversion of other int in the expression without needing a cast) Typo fixes in some comments 'floatting' -> 'floating' :D --- common/common_plot_functions.cpp | 16 ++++++++-------- common/copy_to_clipboard.cpp | 4 ++-- eeschema/component_references_lister.cpp | 6 +++--- eeschema/pinedit.cpp | 12 ++++++------ gerbview/gerbview_frame.cpp | 4 ++-- include/param_config.h | 2 +- pcbnew/dimension.cpp | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp index 57ce954da2..96414da851 100644 --- a/common/common_plot_functions.cpp +++ b/common/common_plot_functions.cpp @@ -238,7 +238,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; ln = Mm2mils( 49 ); if( lnMsg > ln ) - sz.x *= float( ln ) / lnMsg; + sz.x *= double( ln ) / lnMsg; pos.x = (refx - Mm2mils( 25 )) * iusPerMil; pos.y = (refy - Mm2mils( 7.5 )) * iusPerMil; plotter->Text( pos, plotClr, @@ -354,7 +354,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; ln = Mm2mils( 119 ); if( lnMsg > ln ) - sz.x *= float( ln ) / lnMsg; + sz.x *= double( ln ) / lnMsg; pos.x = (refx - Mm2mils( 60 )) * iusPerMil; pos.y = (refy - Mm2mils( 47.5 )) * iusPerMil; plotter->Text( pos, plotClr, @@ -371,7 +371,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; ln = Mm2mils( 22 ); if( lnMsg > ln ) - sz.x *= float( ln ) / lnMsg; + sz.x *= double( ln ) / lnMsg; pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil; pos.y = (refy - Mm2mils( 27.5 )) * iusPerMil; plotter->Text( pos, plotClr, @@ -388,7 +388,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; ln = Mm2mils( 22 ); if( lnMsg > ln ) - sz.x *= float( ln ) / lnMsg; + sz.x *= double( ln ) / lnMsg; pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil; pos.y = (refy - Mm2mils( 22.5 )) * iusPerMil; plotter->Text( pos, plotClr, @@ -405,7 +405,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; ln = Mm2mils( 22 ); if( lnMsg > ln ) - sz.x *= float( ln ) / lnMsg; + sz.x *= double( ln ) / lnMsg; pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil; pos.y = (refy - Mm2mils( 2.5 )) * iusPerMil; plotter->Text( pos, plotClr, @@ -485,7 +485,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; ln = Mm2mils( 109 ); if( lnMsg > ln ) - sz.x *= float( ln ) / lnMsg; + sz.x *= double( ln ) / lnMsg; pos.x = (refx - Mm2mils( 65 )) * iusPerMil; pos.y = (refy - Mm2mils( 7.5 )) * iusPerMil; plotter->Text( pos, plotClr, @@ -589,7 +589,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; ln = Mm2mils( 69 ); if( lnMsg > ln ) - sz.x *= float( ln ) / lnMsg; + sz.x *= double( ln ) / lnMsg; pos.x = (refx + Mm2mils( 35 )) * iusPerMil; pos.y = (refy + Mm2mils( 7 )) * iusPerMil; plotter->Text( pos, plotClr, @@ -642,7 +642,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; ln = Mm2mils( 69 ); if( lnMsg > ln ) - sz.x *= float( ln ) / lnMsg; + sz.x *= double( ln ) / lnMsg; pos.x = (refx - Mm2mils( 7 )) * iusPerMil; pos.y = (refy + Mm2mils( 35 )) * iusPerMil; plotter->Text( pos, plotClr, diff --git a/common/copy_to_clipboard.cpp b/common/copy_to_clipboard.cpp index 95ff829288..4f3130b7f7 100644 --- a/common/copy_to_clipboard.cpp +++ b/common/copy_to_clipboard.cpp @@ -71,8 +71,8 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) wxRect DrawArea; BASE_SCREEN* screen = aFrame->GetCanvas()->GetScreen(); - /* scale is the ratio resolution/internal units */ - float scale = 82.0 / 1000.0 / (double) screen->MilsToIuScalar(); + // scale is the ratio resolution/internal units + double scale = 82.0 / 1000.0 / (double) screen->MilsToIuScalar(); if( screen->IsBlockActive() ) { diff --git a/eeschema/component_references_lister.cpp b/eeschema/component_references_lister.cpp index a6c92abe5f..1b02e2573c 100644 --- a/eeschema/component_references_lister.cpp +++ b/eeschema/component_references_lister.cpp @@ -223,8 +223,8 @@ static bool engStrToDouble( wxString aStr, double* aDouble ) multiplier = 1e12; break; case 'R': - case '.': // floatting point separator - case ',': // floatting point separator (some languages) + case '.': // floating point separator + case ',': // floating point separator (some languages) default: multiplier = 1; break; @@ -262,7 +262,7 @@ static bool engStrToDouble( wxString aStr, double* aDouble ) break; } - LOCALE_IO dummy; // set to C floatting point standard + LOCALE_IO dummy; // set to C floating point standard valueStr.ToDouble( aDouble ); *aDouble *= multiplier; diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index f84128f232..89bf1c08fb 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -653,12 +653,12 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event ) %.3f) conflicts with pin %s \"%s\" at location (%.3f, %.3f)" ), GetChars( stringCurrPinNum ), GetChars( curr_pin->GetName() ), - (float) curr_pin->GetPosition().x / 1000.0, - (float) -curr_pin->GetPosition().y / 1000.0, + curr_pin->GetPosition().x / 1000.0, + -curr_pin->GetPosition().y / 1000.0, GetChars( stringPinNum ), GetChars( Pin->GetName() ), - (float) Pin->GetPosition().x / 1000.0, - (float) -Pin->GetPosition().y / 1000.0 ); + Pin->GetPosition().x / 1000.0, + -Pin->GetPosition().y / 1000.0 ); if( m_component->GetPartCount() > 1 ) { @@ -696,8 +696,8 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event ) msg.Printf( _( "Off grid pin %s \"%s\" at location (%.3f, %.3f)" ), GetChars( stringPinNum ), GetChars( Pin->GetName() ), - (float) Pin->GetPosition().x / 1000.0, - (float) -Pin->GetPosition().y / 1000.0 ); + Pin->GetPosition().x / 1000.0, + -Pin->GetPosition().y / 1000.0 ); if( m_component->GetPartCount() > 1 ) { diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 7585a1bf1b..550931d7f4 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -418,8 +418,8 @@ void GERBVIEW_FRAME::Liste_D_Codes() Line.Printf( wxT( "tool %2.2d: D%2.2d V %2.4f H %2.4f %s" ), jj, pt_D_code->m_Num_Dcode, - (float) pt_D_code->m_Size.y / scale, - (float) pt_D_code->m_Size.x / scale, + pt_D_code->m_Size.y / scale, + pt_D_code->m_Size.x / scale, D_CODE::ShowApertureType( pt_D_code->m_Shape ) ); diff --git a/include/param_config.h b/include/param_config.h index 59785fc088..cc27089349 100644 --- a/include/param_config.h +++ b/include/param_config.h @@ -20,7 +20,7 @@ * We cannot use wxConfigBase->Write for a double, because * this function uses a format with very few digits in mantissa, * and truncation issues are frequent. - * We use here a better floatting format. + * We use here a better floating format. * * Note: prior to 2.9.1, the separator was localized, and after, uses * the "C" notation diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index 9179b0112f..391addb6f9 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -325,7 +325,7 @@ static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC, { wxPoint delta; int dx, dy; - float angle, depl; + double angle, depl; delta = Dimension->m_featureLineDO - Dimension->m_featureLineGO; /* Calculating the direction of travel perpendicular to the selected axis. */