diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 1399039b06..9cea0c7cd0 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1073,7 +1073,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const return false; // Generate unit number, convert and time stamp - if( fprintf( f, "U %d %d %8.8lX\n", m_unit, m_convert, m_TimeStamp ) == EOF ) + if( fprintf( f, "U %d %d %8.8lX\n", m_unit, m_convert, (unsigned long)m_TimeStamp ) == EOF ) return false; // Save the position @@ -1157,13 +1157,13 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) // Remark: avoid using sscanf to read texts entered by user // which are UTF8 encoded, because sscanf does not work well on Windows // with some UTF8 values. - int ii; - char name1[256], - char1[256], char2[256], char3[256]; - int newfmt = 0; - char* ptcar; - wxString fieldName; - char* line = aLine.Line(); + int ii; + char name1[256], char1[256], char2[256], char3[256]; + int newfmt = 0; + char* ptcar; + wxString fieldName; + char* line = aLine.Line(); + unsigned long timeStamp; m_convert = 1; @@ -1264,7 +1264,8 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) if( line[0] == 'U' ) { - sscanf( line + 1, "%d %d %lX", &m_unit, &m_convert, &m_TimeStamp ); + sscanf( line + 1, "%d %d %lX", &m_unit, &m_convert, &timeStamp ); + m_TimeStamp = (time_t)timeStamp; } else if( line[0] == 'P' ) { diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 1deb48dcf6..d5264280d4 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -142,7 +142,7 @@ bool SCH_SHEET::Save( FILE* aFile ) const return false; //save the unique timestamp, like other schematic parts. - if( fprintf( aFile, "U %8.8lX\n", m_TimeStamp ) == EOF ) + if( fprintf( aFile, "U %8.8lX\n", (unsigned long) m_TimeStamp ) == EOF ) return false; /* Save schematic sheetname and filename. */ @@ -180,6 +180,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) int fieldNdx, size; SCH_SHEET_PIN* sheetPin; char* ptcar; + unsigned long timeStamp = 0UL; SetTimeStamp( GetNewTimeStamp() ); @@ -219,9 +220,13 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg ) if( ((char*)aLine)[0] == 'U' ) { - sscanf( ((char*)aLine) + 1, "%lX", &m_TimeStamp ); + sscanf( ((char*)aLine) + 1, "%lX", &timeStamp ); + + m_TimeStamp = (time_t) timeStamp; + if( m_TimeStamp == 0 ) // zero is not unique! SetTimeStamp( GetNewTimeStamp() ); + continue; } diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index a8faa82804..c621c716b4 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -2300,10 +2300,10 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) } #endif - int makeType; - time_t timeStamp; - LAYER_NUM layer_num; - int type, net_code, flags_int; + int makeType; + unsigned long timeStamp; + LAYER_NUM layer_num; + int type, net_code, flags_int; // parse the 2nd line to determine the type of object // e.g. "De 15 1 7 0 0" for a via @@ -2337,8 +2337,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) break; } - newTrack->SetTimeStamp( timeStamp ); - + newTrack->SetTimeStamp( (time_t)timeStamp ); newTrack->SetPosition( wxPoint( start_x, start_y ) ); newTrack->SetEnd( wxPoint( end_x, end_y ) ); @@ -2783,10 +2782,10 @@ void LEGACY_PLUGIN::loadDIMENSION() else if( TESTLINE( "Ge" ) ) { - LAYER_NUM layer_num; - time_t timestamp; - int shape; - int ilayer; + LAYER_NUM layer_num; + unsigned long timestamp; + int shape; + int ilayer; sscanf( line + SZ( "Ge" ), " %d %d %lX", &shape, &ilayer, ×tamp ); @@ -2798,7 +2797,7 @@ void LEGACY_PLUGIN::loadDIMENSION() layer_num = ilayer; dim->SetLayer( leg_layer2new( m_cu_count, layer_num ) ); - dim->SetTimeStamp( timestamp ); + dim->SetTimeStamp( (time_t) timestamp ); dim->SetShape( shape ); } diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index fa29048136..649e66d882 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -8,7 +8,7 @@ * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2013 Wayne Stambaugh - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -120,15 +120,15 @@ void DIALOG_EXCHANGE_MODULE::init() m_CmpValue->AppendText( m_currentModule->GetValue() ); m_CmpReference->AppendText( m_currentModule->GetReference() ); m_Selection->SetString( 0, wxString::Format( - _("Change footprint of '%s'" ), + _( "Change footprint of '%s'" ), GetChars( m_currentModule->GetReference() ) ) ); - wxString fpname = m_CurrentFootprintFPID->GetValue().AfterLast(':'); + wxString fpname = m_CurrentFootprintFPID->GetValue().AfterLast( ':' ); if( fpname.IsEmpty() ) // Happens for old fp names fpname = m_CurrentFootprintFPID->GetValue(); m_Selection->SetString( 1, wxString::Format( - _("Change footprints '%s'" ), + _( "Change footprints '%s'" ), GetChars( fpname.Left( 12 ) ) ) ); m_Selection->SetSelection( m_selectionMode ); @@ -198,11 +198,6 @@ void DIALOG_EXCHANGE_MODULE::OnSelectionClicked( wxCommandEvent& event ) } -/* - * Rebuild the file name.CMP (if any) after exchanging footprints - * if the footprint are managed by this file - * Return false if error - */ void DIALOG_EXCHANGE_MODULE::RebuildCmpList( wxCommandEvent& event ) { wxFileName fn; @@ -227,12 +222,6 @@ void DIALOG_EXCHANGE_MODULE::RebuildCmpList( wxCommandEvent& event ) } -/* Change the current footprint at the current cursor position. - * Retains the following: - * - position, orientation and side - * - value and ref - * - pads net names - */ bool DIALOG_EXCHANGE_MODULE::changeCurrentFootprint() { wxString newmodulename = m_NewFootprintFPID->GetValue(); @@ -244,17 +233,6 @@ bool DIALOG_EXCHANGE_MODULE::changeCurrentFootprint() } -/* - * Change all footprints having the same fpid by a new one from lib - * Retains: - * - direction, position, side - * - value and ref - * - pads net names - * Note: m_currentModule is no longer the current footprint - * since it has been changed! - * if aUseValue is true, footprints having the same fpid should - * also have the same value - */ bool DIALOG_EXCHANGE_MODULE::changeSameFootprints( bool aUseValue ) { wxString msg; @@ -325,13 +303,6 @@ bool DIALOG_EXCHANGE_MODULE::changeSameFootprints( bool aUseValue ) } -/* - * Change all modules with module of the same name in library. - * Maintains: - * - direction, position, side - * - value and ref - * - pads net names - */ bool DIALOG_EXCHANGE_MODULE::changeAllFootprints() { MODULE* Module, * PtBack; @@ -366,15 +337,6 @@ bool DIALOG_EXCHANGE_MODULE::changeAllFootprints() } -/* - * Change aModule to a new, fresh one from lib - * Retains - * - direction, position, side - * - value and ref - * - pads net names - * Returns: false if no change (if the new module is not found) - * true if OK - */ bool DIALOG_EXCHANGE_MODULE::change_1_Module( MODULE* aModule, const FPID& aNewFootprintFPID, bool aShowError ) @@ -473,7 +435,6 @@ void DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint( wxCommandEvent& event ) } -// Runs the footprint viewer to select a footprint. void DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint( wxCommandEvent& event ) { wxString newname; @@ -542,7 +503,7 @@ bool RecreateCmpFile( BOARD * aBrd, const wxString& aFullCmpFileName ) for( ; module != NULL; module = module->Next() ) { fprintf( cmpFile, "\nBeginCmp\n" ); - fprintf( cmpFile, "TimeStamp = %8.8lX\n", module->GetTimeStamp() ); + fprintf( cmpFile, "TimeStamp = %8.8lX\n", (unsigned long)module->GetTimeStamp() ); fprintf( cmpFile, "Path = %s\n", TO_UTF8( module->GetPath() ) ); fprintf( cmpFile, "Reference = %s;\n", !module->GetReference().IsEmpty() ?