← Back to team overview

kicad-developers team mailing list archive

Compile errors in commits 577c1be3, 128ae8b4 & bd19892c

 

Hi all,

I just tried compiling from master and seems there is a bug in commits
577c1be3, 128ae8b4 &  bd19892c .  I am building in MSVC (Windows 10) using
Jon's CMakeSettings.json configuration file (with modified file paths),
using the "x64-Debug" configuration.


It seems this was a simple fix. See attached diff that fixed the compile
errors for me. Could someone with commit rights please review and push the
attached diff if happy?

Extract below of locations of the compile errors:

*Commit  577c1be3  *
--- pcbnew/dialogs/panel_setup_rules.cpp line 262 ---
        line = (int) strtol( parts[0], nullptr, 10 );
        offset = (int) strtol( parts[1], nullptr, 10 );
--- end ---


Error C2664 'long strtol(const char *,char **,int)': cannot convert
argument 1 from '_Ty' to 'const char *'
C:\MySources\kicad\build\x64-Debug\kicad
C:\MySources\kicad\pcbnew\dialogs\panel_setup_rules.cpp 262
Error C2664 'long strtol(const char *,char **,int)': cannot convert
argument 1 from '_Ty' to 'const char *'
C:\MySources\kicad\build\x64-Debug\kicad
C:\MySources\kicad\pcbnew\dialogs\panel_setup_rules.cpp 263

*Commits 128aeb4 & bd19892c*

--- qa/drc_proto/drc_engine.cpp line 245 ---

            drc_dbg(8, "   -> check condition '%s'\n", (const char*)
condition->m_Expression );

            bool result = condition->EvaluateFor( a, b );
            if( result )
            {
                drc_dbg(8, "   -> rule '%s' matches, triggered by condition
'%s'\n", (const char*) rcond->rule->m_Name.c_str(), (const char*)
condition->m_Expression );
                return rcond->rule;
            }

--- end ---

Error C2440 'type cast': cannot convert from 'wxString' to 'const char *'
C:\MySources\kicad\build\x64-Debug\kicad
C:\MySources\kicad\qa\drc_proto\drc_engine.cpp 245
Error C2440 'type cast': cannot convert from 'wxString' to 'const char *'
C:\MySources\kicad\build\x64-Debug\kicad
C:\MySources\kicad\qa\drc_proto\drc_engine.cpp 250


Thanks

Roberto
 pcbnew/dialogs/panel_setup_rules.cpp | 6 +++---
 qa/drc_proto/drc_engine.cpp          | 6 ++++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/pcbnew/dialogs/panel_setup_rules.cpp b/pcbnew/dialogs/panel_setup_rules.cpp
index 978452b98..4222d6327 100644
--- a/pcbnew/dialogs/panel_setup_rules.cpp
+++ b/pcbnew/dialogs/panel_setup_rules.cpp
@@ -253,14 +253,14 @@ void PANEL_SETUP_RULES::OnErrorLinkClicked( wxHtmlLinkEvent& event )
 {
     wxString      link = event.GetLinkInfo().GetHref();
     wxArrayString parts;
-    int           line = 0, offset = 0;
+    long           line = 0, offset = 0;
 
     wxStringSplit( link, parts, ':' );
 
     if( parts.size() > 1 )
     {
-        line = (int) strtol( parts[0], nullptr, 10 );
-        offset = (int) strtol( parts[1], nullptr, 10 );
+        parts[0].ToLong( &line );
+        parts[1].ToLong( &offset );
     }
 
     int pos = m_textEditor->PositionFromLine( line - 1 ) + ( offset - 1 );
diff --git a/qa/drc_proto/drc_engine.cpp b/qa/drc_proto/drc_engine.cpp
index 4391db88a..079c854ef 100644
--- a/qa/drc_proto/drc_engine.cpp
+++ b/qa/drc_proto/drc_engine.cpp
@@ -242,12 +242,14 @@ test::DRC_RULE* test::DRC_ENGINE::EvalRulesForItems( test::DRC_RULE_ID_T ruleID,
     {
         for( auto condition : rcond->conditions )
         {
-            drc_dbg(8, "   -> check condition '%s'\n", (const char*) condition->m_Expression );
+            drc_dbg(8, "   -> check condition '%s'\n", (const char*) condition->m_Expression.c_str() );
 
             bool result = condition->EvaluateFor( a, b );
             if( result )
             {
-                drc_dbg(8, "   -> rule '%s' matches, triggered by condition '%s'\n", (const char*) rcond->rule->m_Name.c_str(), (const char*) condition->m_Expression );
+                drc_dbg( 8, "   -> rule '%s' matches, triggered by condition '%s'\n",
+                        (const char*) rcond->rule->m_Name.c_str(),
+                        (const char*) condition->m_Expression.c_str() );
                 return rcond->rule;
             }
         }

Follow ups