Loading pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -34,9 +34,11 @@ namespace PCAD2KICAD { static KEYWORD empty_keywords[1] = {}; static const char ACCEL_ASCII_KEYWORD[] = "ACCEL_ASCII"; void LoadInputFile( wxString aFileName, wxXmlDocument* aXmlDoc ) { char line[sizeof( ACCEL_ASCII_KEYWORD )]; int tok; XNODE* iNode = NULL, *cNode = NULL; wxString str, propValue, content; Loading @@ -47,6 +49,14 @@ void LoadInputFile( wxString aFileName, wxXmlDocument* aXmlDoc ) if( !fp ) THROW_IO_ERROR( wxT( "Unable to open file: " ) + aFileName ); // check file format if( !fgets( line, sizeof( line ), fp ) || strcmp( line, ACCEL_ASCII_KEYWORD ) ) THROW_IO_ERROR( "Unknown file type" ); // rewind the file fseek( fp, 0, SEEK_SET ); // lexer now owns fp, will close on exception or return DSNLEXER lexer( empty_keywords, 0, fp, aFileName ); Loading Loading
pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -34,9 +34,11 @@ namespace PCAD2KICAD { static KEYWORD empty_keywords[1] = {}; static const char ACCEL_ASCII_KEYWORD[] = "ACCEL_ASCII"; void LoadInputFile( wxString aFileName, wxXmlDocument* aXmlDoc ) { char line[sizeof( ACCEL_ASCII_KEYWORD )]; int tok; XNODE* iNode = NULL, *cNode = NULL; wxString str, propValue, content; Loading @@ -47,6 +49,14 @@ void LoadInputFile( wxString aFileName, wxXmlDocument* aXmlDoc ) if( !fp ) THROW_IO_ERROR( wxT( "Unable to open file: " ) + aFileName ); // check file format if( !fgets( line, sizeof( line ), fp ) || strcmp( line, ACCEL_ASCII_KEYWORD ) ) THROW_IO_ERROR( "Unknown file type" ); // rewind the file fseek( fp, 0, SEEK_SET ); // lexer now owns fp, will close on exception or return DSNLEXER lexer( empty_keywords, 0, fp, aFileName ); Loading