From 38269efa478531b7746ad84d99830130ac577bf3 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 25 Mar 2011 21:07:27 +0100 Subject: [PATCH 1/2] Fix bug 741352 --- common/build_version.cpp | 2 +- cvpcb/genequiv.cpp | 7 +++--- eeschema/lib_field.cpp | 30 ++++++++-------------- eeschema/sch_component.cpp | 32 +++++++----------------- eeschema/sch_field.cpp | 8 +++--- eeschema/sch_screen.cpp | 16 ++++++------ eeschema/sch_sheet.cpp | 40 +++++++++++------------------- packaging/windows/nsis/install.nsi | 2 +- pcbnew/class_dimension.cpp | 2 +- pcbnew/class_module.cpp | 2 +- pcbnew/class_netclass.cpp | 6 ++--- pcbnew/class_netinfo_item.cpp | 4 +-- pcbnew/class_pad.cpp | 9 ++++--- pcbnew/class_text_mod.cpp | 33 ++++++++++++++---------- pcbnew/class_zone.cpp | 4 +-- pcbnew/gen_modules_placefile.cpp | 11 +++----- pcbnew/ioascii.cpp | 16 ++++++------ version.txt | 2 +- 18 files changed, 97 insertions(+), 129 deletions(-) diff --git a/common/build_version.cpp b/common/build_version.cpp index dccd1fa756..55098504a6 100644 --- a/common/build_version.cpp +++ b/common/build_version.cpp @@ -6,7 +6,7 @@ #endif #ifndef KICAD_BUILD_VERSION -#define KICAD_BUILD_VERSION "(2011-03-23)" +#define KICAD_BUILD_VERSION "(2011-03-25)" #endif // uncomment this line only when creating a stable version diff --git a/cvpcb/genequiv.cpp b/cvpcb/genequiv.cpp index e84b85709d..f4f6d7866b 100644 --- a/cvpcb/genequiv.cpp +++ b/cvpcb/genequiv.cpp @@ -43,9 +43,10 @@ void CVPCB_MAINFRAME::WriteStuffList( wxCommandEvent& event ) { if( component.m_Module.empty() ) continue; - fprintf( FileEquiv, "comp = \"%s\" module = \"%s\"\n", - TO_UTF8( component.m_Reference ), - TO_UTF8( component.m_Module ) ); + + fprintf( FileEquiv, "comp = %s module = %s\n", + EscapedUTF8( component.m_Reference ).c_str(), + EscapedUTF8( component.m_Module ).c_str() ); } fclose( FileEquiv ); diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index a9ee87d85f..544caa01fe 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -113,8 +113,10 @@ bool LIB_FIELD::Save( FILE* ExportFile ) if( text.IsEmpty() ) text = wxT( "~" ); - if( fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c%c%c", - m_id, TO_UTF8( text ), m_Pos.x, m_Pos.y, m_Size.x, + if( fprintf( ExportFile, "F%d %s %d %d %d %c %c %c %c%c%c", + m_id, + EscapedUTF8( text ).c_str(), // wraps in quotes + m_Pos.x, m_Pos.y, m_Size.x, m_Orient == 0 ? 'H' : 'V', (m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V', hjustify, vjustify, @@ -129,10 +131,11 @@ bool LIB_FIELD::Save( FILE* ExportFile ) */ wxString defName = TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id ); - if( m_id >= FIELD1 && !m_name.IsEmpty() - && m_name != defName - && fprintf( ExportFile, " \"%s\"", TO_UTF8( m_name ) ) < 0 ) + if( m_id >= FIELD1 && !m_name.IsEmpty() && m_name != defName + && fprintf( ExportFile, " %s", EscapedUTF8( m_name ).c_str() ) < 0 ) + { return false; + } if( fprintf( ExportFile, "\n" ) < 0 ) return false; @@ -148,8 +151,6 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) char textVisible; char textHJustify; char textVJustify[256]; - char fieldUserName[1024]; - char* text; if( sscanf( line + 1, "%d", &m_id ) != 1 || m_id < 0 ) { @@ -169,21 +170,12 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) if( *line == 0 ) return false; - line++; - text = line; - - /* Find end of text. */ - while( *line && (*line != '"') ) - line++; + line += ReadDelimitedText( &m_Text, line ); if( *line == 0 ) return false; - *line = 0; - line++; - - fieldUserName[0] = 0; memset( textVJustify, 0, sizeof( textVJustify ) ); cnt = sscanf( line, " %d %d %d %c %c %c %s", &m_Pos.x, &m_Pos.y, &m_Size.y, @@ -196,7 +188,6 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) return false; } - m_Text = FROM_UTF8( text ); m_Size.x = m_Size.y; if( textOrient == 'H' ) @@ -270,8 +261,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) } else { - ReadDelimitedText( fieldUserName, line, sizeof( fieldUserName ) ); - m_name = FROM_UTF8( fieldUserName ); + ReadDelimitedText( &m_name, line ); } return true; diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 42e7259b90..87a7dd300b 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1195,12 +1195,10 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) { int fieldNdx; - char FieldUserName[1024]; + wxString fieldText; GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER; GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER; - FieldUserName[0] = 0; - ptcar = (char*) aLine; while( *ptcar && (*ptcar != '"') ) @@ -1213,32 +1211,20 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) return false; } - for( ptcar++, ii = 0; ; ii++, ptcar++ ) + ptcar += ReadDelimitedText( &fieldText, ptcar ); + if( *ptcar == 0 ) { - Name1[ii] = *ptcar; - if( *ptcar == 0 ) - { - aErrorMsg.Printf( wxT( "Component field F at line %d, aborted" ), - aLine.LineNumber() ); - return false; - } - - if( *ptcar == '"' ) - { - Name1[ii] = 0; - ptcar++; - break; - } + aErrorMsg.Printf( wxT( "Component field F at line %d, aborted" ), + aLine.LineNumber() ); + return false; } fieldNdx = atoi( line + 2 ); - ReadDelimitedText( FieldUserName, ptcar, sizeof(FieldUserName) ); + ReadDelimitedText( &fieldName, ptcar ); - if( !FieldUserName[0] ) + if( fieldName.IsEmpty() ) fieldName = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx ); - else - fieldName = FROM_UTF8( FieldUserName ); if( fieldNdx >= GetFieldCount() ) { @@ -1264,7 +1250,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) GetField( fieldNdx )->m_Name = fieldName; } - GetField( fieldNdx )->m_Text = FROM_UTF8( Name1 ); + GetField( fieldNdx )->m_Text = fieldText; memset( Char3, 0, sizeof(Char3) ); if( ( ii = sscanf( ptcar, "%s %d %d %d %X %s %s", Char1, &GetField( fieldNdx )->m_Pos.x, diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index f8bc48fc06..4a40efaf5b 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -27,7 +27,7 @@ #include "sch_component.h" #include "sch_field.h" #include "template_fieldnames.h" - +#include "kicad_string.h" SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent, wxString aName ) : SCH_ITEM( aParent, SCH_FIELD_T ), @@ -329,9 +329,9 @@ bool SCH_FIELD::Save( FILE* aFile ) const else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP ) vjustify = 'T'; - if( fprintf( aFile, "F %d \"%s\" %c %-3d %-3d %-3d %4.4X %c %c%c%c", + if( fprintf( aFile, "F %d %s %c %-3d %-3d %-3d %4.4X %c %c%c%c", m_FieldId, - TO_UTF8( m_Text ), + EscapedUTF8( m_Text ).c_str(), // wraps in quotes too m_Orient == TEXT_ORIENT_HORIZ ? 'H' : 'V', m_Pos.x, m_Pos.y, m_Size.x, @@ -346,7 +346,7 @@ bool SCH_FIELD::Save( FILE* aFile ) const // Save field name, if the name is user definable if( m_FieldId >= FIELD1 ) { - if( fprintf( aFile, " \"%s\"", TO_UTF8( m_Name ) ) == EOF ) + if( fprintf( aFile, " %s", EscapedUTF8( m_Name ).c_str() ) == EOF ) { return false; } diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index ab3ed1fcbc..9959386fca 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -480,14 +480,14 @@ bool SCH_SCREEN::Save( FILE* aFile ) const m_CurrentSheetDesc->m_Size.x, m_CurrentSheetDesc->m_Size.y ) < 0 || fprintf( aFile, "encoding utf-8\n") < 0 || fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0 - || fprintf( aFile, "Title \"%s\"\n", TO_UTF8( m_Title ) ) < 0 - || fprintf( aFile, "Date \"%s\"\n", TO_UTF8( m_Date ) ) < 0 - || fprintf( aFile, "Rev \"%s\"\n", TO_UTF8( m_Revision ) ) < 0 - || fprintf( aFile, "Comp \"%s\"\n", TO_UTF8( m_Company ) ) < 0 - || fprintf( aFile, "Comment1 \"%s\"\n", TO_UTF8( m_Commentaire1 ) ) < 0 - || fprintf( aFile, "Comment2 \"%s\"\n", TO_UTF8( m_Commentaire2 ) ) < 0 - || fprintf( aFile, "Comment3 \"%s\"\n", TO_UTF8( m_Commentaire3 ) ) < 0 - || fprintf( aFile, "Comment4 \"%s\"\n", TO_UTF8( m_Commentaire4 ) ) < 0 + || fprintf( aFile, "Title %s\n", EscapedUTF8( m_Title ).c_str() ) < 0 + || fprintf( aFile, "Date %s\n", EscapedUTF8( m_Date ).c_str() ) < 0 + || fprintf( aFile, "Rev %s\n", EscapedUTF8( m_Revision ).c_str() ) < 0 + || fprintf( aFile, "Comp %s\n", EscapedUTF8( m_Company ).c_str() ) < 0 + || fprintf( aFile, "Comment1 %s\n", EscapedUTF8( m_Commentaire1 ).c_str() ) < 0 + || fprintf( aFile, "Comment2 %s\n", EscapedUTF8( m_Commentaire2 ).c_str() ) < 0 + || fprintf( aFile, "Comment3 %s\n", EscapedUTF8( m_Commentaire3 ).c_str() ) < 0 + || fprintf( aFile, "Comment4 %s\n", EscapedUTF8( m_Commentaire4 ).c_str() ) < 0 || fprintf( aFile, "$EndDescr\n" ) < 0 ) return false; diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 1319143cb2..12c962dfbf 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -26,7 +26,7 @@ #include "sch_sheet.h" #include "sch_sheet_path.h" #include "sch_component.h" - +#include "kicad_string.h" SCH_SHEET::SCH_SHEET( const wxPoint& pos ) : SCH_ITEM( NULL, SCH_SHEET_T ) @@ -131,14 +131,14 @@ bool SCH_SHEET::Save( FILE* aFile ) const /* Save schematic sheetname and filename. */ if( !m_SheetName.IsEmpty() ) { - if( fprintf( aFile, "F0 \"%s\" %d\n", TO_UTF8( m_SheetName ), + if( fprintf( aFile, "F0 %s %d\n", EscapedUTF8( m_SheetName ).c_str(), m_SheetNameSize ) == EOF ) return false; } if( !m_FileName.IsEmpty() ) { - if( fprintf( aFile, "F1 \"%s\" %d\n", TO_UTF8( m_FileName ), + if( fprintf( aFile, "F1 %s %d\n", EscapedUTF8( m_FileName ).c_str(), m_FileNameSize ) == EOF ) return false; } @@ -160,8 +160,7 @@ bool SCH_SHEET::Save( FILE* aFile ) const bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) { - int ii, fieldNdx, size; - char Name1[256]; + int fieldNdx, size; SCH_SHEET_PIN* SheetLabel; char* ptcar; @@ -231,24 +230,15 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) return false; } - for( ptcar++, ii = 0; ; ii++, ptcar++ ) + wxString sheetName; + ptcar += ReadDelimitedText( &sheetName, ptcar ); + + if( *ptcar == 0 ) { - Name1[ii] = *ptcar; - - if( *ptcar == 0 ) - { - aErrorMsg.Printf( wxT( "EESchema file sheet field F at line %d, aborted\n" ), - aLine.LineNumber() ); - aErrorMsg << FROM_UTF8( (char*) aLine ); - return false; - } - - if( *ptcar == '"' ) - { - Name1[ii] = 0; - ptcar++; - break; - } + aErrorMsg.Printf( wxT( "EESchema file sheet field F at line %d, aborted\n" ), + aLine.LineNumber() ); + aErrorMsg << FROM_UTF8( (char*) aLine ); + return false; } if( ( fieldNdx == 0 ) || ( fieldNdx == 1 ) ) @@ -265,14 +255,12 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) if( fieldNdx == 0 ) { - m_SheetName = FROM_UTF8( Name1 ); + m_SheetName = sheetName; m_SheetNameSize = size; } else { - SetFileName( FROM_UTF8( Name1 ) ); - - //printf( "in ReadSheetDescr : m_FileName = %s \n", Name1 ); + SetFileName( sheetName ); m_FileNameSize = size; } } diff --git a/packaging/windows/nsis/install.nsi b/packaging/windows/nsis/install.nsi index 8a23abb633..c9e3d26a66 100644 --- a/packaging/windows/nsis/install.nsi +++ b/packaging/windows/nsis/install.nsi @@ -17,7 +17,7 @@ ; General Product Description Definitions !define PRODUCT_NAME "KiCad" -!define PRODUCT_VERSION "2011.03.23" +!define PRODUCT_VERSION "2011.03.25" !define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/" !define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/" !define COMPANY_NAME "" diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index d226067c4a..f811716c1e 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -362,7 +362,7 @@ bool DIMENSION::Save( FILE* aFile ) const fprintf( aFile, "Va %d\n", m_Value ); if( !m_Text->m_Text.IsEmpty() ) - fprintf( aFile, "Te \"%s\"\n", TO_UTF8( m_Text->m_Text ) ); + fprintf( aFile, "Te %s\n", EscapedUTF8( m_Text->m_Text ).c_str() ); else fprintf( aFile, "Te \"?\"\n" ); diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 65a2ef7686..5fe6e0cf5a 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -370,7 +370,7 @@ int MODULE::Write_3D_Descr( FILE* File ) const { fprintf( File, "$SHAPE3D\n" ); - fprintf( File, "Na \"%s\"\n", TO_UTF8( t3D->m_Shape3DName ) ); + fprintf( File, "Na %s\n", EscapedUTF8( t3D->m_Shape3DName ).c_str() ); sprintf( buf, "Sc %lf %lf %lf\n", t3D->m_MatScale.x, diff --git a/pcbnew/class_netclass.cpp b/pcbnew/class_netclass.cpp index 32d20f5bb9..2958b74f06 100644 --- a/pcbnew/class_netclass.cpp +++ b/pcbnew/class_netclass.cpp @@ -286,8 +286,8 @@ bool NETCLASS::Save( FILE* aFile ) const bool result = true; fprintf( aFile, "$" BRD_NETCLASS "\n" ); - fprintf( aFile, "Name \"%s\"\n", TO_UTF8( m_Name ) ); - fprintf( aFile, "Desc \"%s\"\n", TO_UTF8( GetDescription() ) ); + fprintf( aFile, "Name %s\n", EscapedUTF8( m_Name ).c_str() ); + fprintf( aFile, "Desc %s\n", EscapedUTF8( GetDescription() ).c_str() ); // Write parameters @@ -302,7 +302,7 @@ bool NETCLASS::Save( FILE* aFile ) const // Write members: for( const_iterator i = begin(); i!=end(); ++i ) - fprintf( aFile, "AddNet \"%s\"\n", TO_UTF8( *i ) ); + fprintf( aFile, "AddNet %s\n", EscapedUTF8( *i ).c_str() ); fprintf( aFile, "$End" BRD_NETCLASS "\n" ); diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index 06911d3cc0..b60466f3d5 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -78,11 +78,9 @@ bool NETINFO_ITEM::Save( FILE* aFile ) const bool success = false; fprintf( aFile, "$EQUIPOT\n" ); - fprintf( aFile, "Na %d \"%s\"\n", GetNet(), TO_UTF8( m_Netname ) ); + fprintf( aFile, "Na %d %s\n", GetNet(), EscapedUTF8( m_Netname ).c_str() ); fprintf( aFile, "St %s\n", "~" ); - // fprintf( aFile, "NetClass \"%s\"\n", TO_UTF8(m_NetClassName) ); - if( fprintf( aFile, "$EndEQUIPOT\n" ) != sizeof("$EndEQUIPOT\n") - 1 ) goto out; diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 1317b84a75..edcf0eff28 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -558,18 +558,19 @@ bool D_PAD::Save( FILE* aFile ) const fprintf( aFile, "At %s N %8.8X\n", texttype, m_Masque_Layer ); - fprintf( aFile, "Ne %d \"%s\"\n", GetNet(), TO_UTF8( m_Netname ) ); + fprintf( aFile, "Ne %d %s\n", GetNet(), EscapedUTF8( m_Netname ).c_str() ); fprintf( aFile, "Po %d %d\n", m_Pos0.x, m_Pos0.y ); if( m_LocalSolderMaskMargin != 0 ) fprintf( aFile, ".SolderMask %d\n", m_LocalSolderMaskMargin ); + if( m_LocalSolderPasteMargin != 0 ) fprintf( aFile, ".SolderPaste %d\n", m_LocalSolderPasteMargin ); + if( m_LocalSolderPasteMarginRatio != 0 ) - fprintf( aFile, - ".SolderPasteRatio %g\n", - m_LocalSolderPasteMarginRatio ); + fprintf( aFile, ".SolderPasteRatio %g\n", m_LocalSolderPasteMarginRatio ); + if( m_LocalClearance != 0 ) fprintf( aFile, ".LocalClearance %d\n", m_LocalClearance ); diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 0c9d69ebc6..04fcca1416 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -87,7 +87,8 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const m_Mirror ? 'M' : 'N', m_NoShow ? 'I' : 'V', GetLayer(), m_Italic ? 'I' : 'N', - TO_UTF8( m_Text ) ); + EscapedUTF8( m_Text ).c_str() + ); return ret > 20; } @@ -101,37 +102,41 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const */ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader ) { - int success = true; - int type; - int layer; - char BufCar1[128], BufCar2[128], BufCar3[128], BufLine[256]; - char *aLine; + int success = true; + int type; + char BufCar1[128], BufCar2[128], BufCar3[128]; + char* line = aReader->Line(); - aLine = aReader->Line(); + int layer = SILKSCREEN_N_FRONT; - layer = SILKSCREEN_N_FRONT; BufCar1[0] = 0; BufCar2[0] = 0; BufCar3[0] = 0; - if( sscanf( aLine + 1, "%d %d %d %d %d %d %d %s %s %d %s", + + if( sscanf( line + 1, "%d %d %d %d %d %d %d %s %s %d %s", &type, &m_Pos0.x, &m_Pos0.y, &m_Size.y, &m_Size.x, &m_Orient, &m_Thickness, BufCar1, BufCar2, &layer, BufCar3 ) >= 10 ) + { success = true; + } if( (type != TEXT_is_REFERENCE) && (type != TEXT_is_VALUE) ) type = TEXT_is_DIVERS; + m_Type = type; // Due to the pcbnew history, .m_Orient is saved in screen value // but it is handled as relative to its parent footprint m_Orient -= ( (MODULE*) m_Parent )->m_Orient; + if( BufCar1[0] == 'M' ) m_Mirror = true; else m_Mirror = false; + if( BufCar2[0] == 'I' ) m_NoShow = true; else @@ -154,11 +159,13 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader ) SetLayer( layer ); - /* Calculate the true position. */ + // Calculate the true position. SetDrawCoord(); - /* Read the "text" string. */ - ReadDelimitedText( BufLine, aLine, sizeof(BufLine) ); - m_Text = FROM_UTF8( BufLine ); + + + // Read the "text" string. + // @todo why is line not incremented, what are we reading here? + ReadDelimitedText( &m_Text, line ); // Test for a reasonable size: if( m_Size.x < TEXTS_MIN_SIZE ) diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index cacaec52b9..53c60378d4 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -107,9 +107,9 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const fprintf( aFile, "$CZONE_OUTLINE\n" ); // Save the outline main info - ret = fprintf( aFile, "ZInfo %8.8lX %d \"%s\"\n", + ret = fprintf( aFile, "ZInfo %8.8lX %d %s\n", m_TimeStamp, m_NetCode, - TO_UTF8( m_Netname ) ); + EscapedUTF8( m_Netname ).c_str() ); if( ret < 3 ) return false; diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index ff79499c69..39609ffc2b 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -386,17 +386,14 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event ) Module = (MODULE*) GetBoard()->m_Modules; for( ; Module != NULL; Module = Module->Next() ) { - sprintf( line, "$MODULE \"%s\"\n", - TO_UTF8( Module->m_Reference->m_Text ) ); + sprintf( line, "$MODULE %s\n", EscapedUTF8( Module->m_Reference->m_Text ).c_str() ); fputs( line, rptfile ); - sprintf( line, "reference \"%s\"\n", - TO_UTF8( Module->m_Reference->m_Text ) ); + sprintf( line, "reference %s\n", EscapedUTF8( Module->m_Reference->m_Text ).c_str() ); fputs( line, rptfile ); - sprintf( line, "value \"%s\"\n", - TO_UTF8( Module->m_Value->m_Text ) ); + sprintf( line, "value %s\n", EscapedUTF8( Module->m_Value->m_Text ).c_str() ); fputs( line, rptfile ); - sprintf( line, "footprint \"%s\"\n", TO_UTF8( Module->m_LibRef ) ); + sprintf( line, "footprint %s\n", EscapedUTF8( Module->m_LibRef ).c_str() ); fputs( line, rptfile ); msg = wxT( "attribut" ); diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 0d5b4e699a..5f029b77e3 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -830,14 +830,14 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File ) fprintf( File, "$SHEETDESCR\n" ); fprintf( File, "Sheet %s %d %d\n", TO_UTF8( sheet->m_Name ), sheet->m_Size.x, sheet->m_Size.y ); - fprintf( File, "Title \"%s\"\n", TO_UTF8( screen->m_Title ) ); - fprintf( File, "Date \"%s\"\n", TO_UTF8( screen->m_Date ) ); - fprintf( File, "Rev \"%s\"\n", TO_UTF8( screen->m_Revision ) ); - fprintf( File, "Comp \"%s\"\n", TO_UTF8( screen->m_Company ) ); - fprintf( File, "Comment1 \"%s\"\n", TO_UTF8( screen->m_Commentaire1 ) ); - fprintf( File, "Comment2 \"%s\"\n", TO_UTF8( screen->m_Commentaire2 ) ); - fprintf( File, "Comment3 \"%s\"\n", TO_UTF8( screen->m_Commentaire3 ) ); - fprintf( File, "Comment4 \"%s\"\n", TO_UTF8( screen->m_Commentaire4 ) ); + fprintf( File, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() ); + fprintf( File, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() ); + fprintf( File, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() ); + fprintf( File, "Comp %s\n", EscapedUTF8( screen->m_Company ).c_str() ); + fprintf( File, "Comment1 %s\n", EscapedUTF8( screen->m_Commentaire1 ).c_str() ); + fprintf( File, "Comment2 %s\n", EscapedUTF8( screen->m_Commentaire2 ).c_str() ); + fprintf( File, "Comment3 %s\n", EscapedUTF8( screen->m_Commentaire3 ).c_str() ); + fprintf( File, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() ); fprintf( File, "$EndSHEETDESCR\n\n" ); return TRUE; diff --git a/version.txt b/version.txt index bdbd028719..d5efc6ebfc 100644 --- a/version.txt +++ b/version.txt @@ -1,4 +1,4 @@ release version: 2011 mar 17 files (.zip,.tgz): -kicad-2011-03-23 +kicad-2011-03-25 From e68662c19ea97118516847857cee8389a8789c13 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 25 Mar 2011 21:44:48 +0100 Subject: [PATCH 2/2] Fix bug 741352. --- pcbnew/class_text_mod.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 04fcca1416..93f9253ebd 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -78,7 +78,7 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const if( parent ) orient += parent->m_Orient; - int ret = fprintf( aFile, "T%d %d %d %d %d %d %d %c %c %d %c\"%s\"\n", + int ret = fprintf( aFile, "T%d %d %d %d %d %d %d %c %c %d %c %s\n", m_Type, m_Pos0.x, m_Pos0.y, m_Size.y, m_Size.x, @@ -159,12 +159,11 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader ) SetLayer( layer ); - // Calculate the true position. + // Calculate the actual position. SetDrawCoord(); - // Read the "text" string. - // @todo why is line not incremented, what are we reading here? + // Search and read the "text" string (a quoted text). ReadDelimitedText( &m_Text, line ); // Test for a reasonable size: