Browse Source

Convert strings to wide when using wxString routines

WxString does not allocate space for wide strings needed during
conversion unless the string is explicitly wide.  This can cause buffer
over/underflow

Fixes https://gitlab.com/kicad/code/kicad/issues/10605

(cherry picked from commit 7601a3385f)
7.0
Seth Hillbrand 4 years ago
parent
commit
168ad58eef
  1. 9
      common/project/project_file.cpp
  2. 4
      common/settings/color_settings.cpp
  3. 8
      common/settings/common_settings.cpp
  4. 62
      common/settings/json_settings.cpp
  5. 15
      common/settings/nested_settings.cpp
  6. 66
      common/settings/settings_manager.cpp
  7. 4
      pcbnew/footprint_editor_settings.cpp

9
common/project/project_file.cpp

@ -462,7 +462,7 @@ bool PROJECT_FILE::MigrateFromLegacy( wxConfigBase* aCfg )
wxString entry;
nlohmann::json arr = nlohmann::json::array();
wxLogTrace( traceSettings, "Migrating sheet names" );
wxLogTrace( traceSettings, wxT( "Migrating sheet names" ) );
aCfg->SetPath( wxT( "/sheetnames" ) );
@ -472,7 +472,8 @@ bool PROJECT_FILE::MigrateFromLegacy( wxConfigBase* aCfg )
if( tokens.size() == 2 )
{
wxLogTrace( traceSettings, "%d: %s = %s", sheet, tokens[0], tokens[1] );
wxLogTrace( traceSettings, wxT( "%d: %s = %s" ), sheet, tokens[0],
tokens[1] );
arr.push_back( nlohmann::json::array( { tokens[0], tokens[1] } ) );
}
}
@ -492,7 +493,7 @@ bool PROJECT_FILE::MigrateFromLegacy( wxConfigBase* aCfg )
auto loadLegacyPairs =
[&]( const std::string& aGroup ) -> bool
{
wxLogTrace( traceSettings, "Migrating group %s", aGroup );
wxLogTrace( traceSettings, wxT( "Migrating group %s" ), aGroup );
bool success = true;
wxString keyStr;
wxString val;
@ -506,7 +507,7 @@ bool PROJECT_FILE::MigrateFromLegacy( wxConfigBase* aCfg )
std::string key( keyStr.ToUTF8() );
wxLogTrace( traceSettings, " %s = %s", key, val );
wxLogTrace( traceSettings, wxT( " %s = %s" ), key, val );
try
{

4
common/settings/color_settings.cpp

@ -311,13 +311,13 @@ bool COLOR_SETTINGS::migrateSchema0to1()
if( !m_manager )
{
wxLogTrace( traceSettings, "Error: COLOR_SETTINGS migration cannot run unmanaged!" );
wxLogTrace( traceSettings, wxT( "Error: COLOR_SETTINGS migration cannot run unmanaged!" ) );
return false;
}
if( !Contains( "fpedit" ) )
{
wxLogTrace( traceSettings, "migrateSchema0to1: %s doesn't have fpedit settings; skipping.",
wxLogTrace( traceSettings, wxT( "migrateSchema0to1: %s doesn't have fpedit settings; skipping." ),
m_filename );
return true;
}

8
common/settings/common_settings.cpp

@ -351,7 +351,7 @@ bool COMMON_SETTINGS::migrateSchema0to1()
}
catch( ... )
{
wxLogTrace( traceSettings, "COMMON_SETTINGS::Migrate 0->1: mousewheel_pan not found" );
wxLogTrace( traceSettings, wxT( "COMMON_SETTINGS::Migrate 0->1: mousewheel_pan not found" ) );
}
if( mwp )
@ -388,7 +388,7 @@ bool COMMON_SETTINGS::migrateSchema1to2()
}
catch( ... )
{
wxLogTrace( traceSettings, "COMMON_SETTINGS::Migrate 1->2: prefer_select_to_drag not found" );
wxLogTrace( traceSettings, wxT( "COMMON_SETTINGS::Migrate 1->2: prefer_select_to_drag not found" ) );
}
if( prefer_selection )
@ -423,7 +423,7 @@ bool COMMON_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
{
if( envVarBlacklist.count( key ) )
{
wxLogTrace( traceSettings, "Migrate Env: %s is blacklisted; skipping.", key );
wxLogTrace( traceSettings, wxT( "Migrate Env: %s is blacklisted; skipping." ), key );
continue;
}
@ -433,7 +433,7 @@ bool COMMON_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
{
ptr.push_back( key.ToStdString() );
wxLogTrace( traceSettings, "Migrate Env: %s=%s", ptr.to_string(), value );
wxLogTrace( traceSettings, wxT( "Migrate Env: %s=%s" ), ptr.to_string(), value );
( *m_internals )[ptr] = value.ToUTF8();
ptr.pop_back();

62
common/settings/json_settings.cpp

@ -83,7 +83,7 @@ JSON_SETTINGS::JSON_SETTINGS( const wxString& aFilename, SETTINGS_LOC aLocation,
}
catch( ... )
{
wxLogTrace( traceSettings, "Error: Could not create filename field for %s",
wxLogTrace( traceSettings, wxT( "Error: Could not create filename field for %s" ),
GetFullFilename() );
}
@ -143,7 +143,7 @@ void JSON_SETTINGS::Load()
catch( ... )
{
// Skip unreadable parameters in file
wxLogTrace( traceSettings, "param '%s' load err", param->GetJsonPath().c_str() );
wxLogTrace( traceSettings, wxT( "param '%s' load err" ), param->GetJsonPath().c_str() );
}
}
}
@ -172,7 +172,7 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory )
if( !wxCopyFile( aPath.GetFullPath(), temp.GetFullPath() ) )
{
wxLogTrace( traceSettings, "%s: could not create temp file for migration",
wxLogTrace( traceSettings, wxT( "%s: could not create temp file for migration" ),
GetFullFilename() );
}
else
@ -190,12 +190,12 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory )
if( !MigrateFromLegacy( cfg.get() ) )
{
wxLogTrace( traceSettings,
"%s: migrated; not all settings were found in legacy file",
wxT( "%s: migrated; not all settings were found in legacy file" ),
GetFullFilename() );
}
else
{
wxLogTrace( traceSettings, "%s: migrated from legacy format", GetFullFilename() );
wxLogTrace( traceSettings, wxT( "%s: migrated from legacy format" ), GetFullFilename() );
}
if( backed_up )
@ -205,14 +205,14 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory )
if( !wxCopyFile( temp.GetFullPath(), aPath.GetFullPath() ) )
{
wxLogTrace( traceSettings,
"migrate; copy temp file %s to %s failed",
wxT( "migrate; copy temp file %s to %s failed" ),
temp.GetFullPath(), aPath.GetFullPath() );
}
if( !wxRemoveFile( temp.GetFullPath() ) )
{
wxLogTrace( traceSettings,
"migrate; failed to remove temp file %s",
wxT( "migrate; failed to remove temp file %s" ),
temp.GetFullPath() );
}
}
@ -282,14 +282,14 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory )
}
catch( ... )
{
wxLogTrace( traceSettings, "%s: file version could not be read!",
wxLogTrace( traceSettings, wxT( "%s: file version could not be read!" ),
GetFullFilename() );
success = false;
}
if( filever >= 0 && filever < m_schemaVersion )
{
wxLogTrace( traceSettings, "%s: attempting migration from version %d to %d",
wxLogTrace( traceSettings, wxT( "%s: attempting migration from version %d to %d" ),
GetFullFilename(), filever, m_schemaVersion );
if( Migrate() )
@ -298,27 +298,27 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory )
}
else
{
wxLogTrace( traceSettings, "%s: migration failed!", GetFullFilename() );
wxLogTrace( traceSettings, wxT( "%s: migration failed!" ), GetFullFilename() );
}
}
else if( filever > m_schemaVersion )
{
wxLogTrace( traceSettings,
"%s: warning: file version %d is newer than latest (%d)",
wxT( "%s: warning: file version %d is newer than latest (%d)" ),
GetFullFilename(), filever, m_schemaVersion );
}
}
else
{
wxLogTrace( traceSettings, "%s exists but can't be opened for read",
wxLogTrace( traceSettings, wxT( "%s exists but can't be opened for read" ),
GetFullFilename() );
}
}
catch( nlohmann::json::parse_error& error )
{
wxLogTrace( traceSettings, "Json parse error reading %s: %s",
wxLogTrace( traceSettings, wxT( "Json parse error reading %s: %s" ),
path.GetFullPath(), error.what() );
wxLogTrace( traceSettings, "Attempting migration in case file is in legacy format" );
wxLogTrace( traceSettings, wxT( "Attempting migration in case file is in legacy format" ) );
migrateFromLegacy( path );
}
}
@ -330,14 +330,14 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory )
for( auto settings : m_nested_settings )
settings->LoadFromFile();
wxLogTrace( traceSettings, "Loaded <%s> with schema %d", GetFullFilename(), m_schemaVersion );
wxLogTrace( traceSettings, wxT( "Loaded <%s> with schema %d" ), GetFullFilename(), m_schemaVersion );
// If we migrated, clean up the legacy file (with no extension)
if( legacy_migrated || migrated )
{
if( legacy_migrated && m_deleteLegacyAfterMigration && !wxRemoveFile( path.GetFullPath() ) )
{
wxLogTrace( traceSettings, "Warning: could not remove legacy file %s",
wxLogTrace( traceSettings, wxT( "Warning: could not remove legacy file %s" ),
path.GetFullPath() );
}
@ -396,7 +396,7 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
if( !m_createIfMissing && !path.FileExists() )
{
wxLogTrace( traceSettings,
"File for %s doesn't exist and m_createIfMissing == false; not saving",
wxT( "File for %s doesn't exist and m_createIfMissing == false; not saving" ),
GetFullFilename() );
return false;
}
@ -404,7 +404,7 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
// Ensure the path exists, and create it if not.
if( !path.DirExists() && !path.Mkdir() )
{
wxLogTrace( traceSettings, "Warning: could not create path %s, can't save %s",
wxLogTrace( traceSettings, wxT( "Warning: could not create path %s, can't save %s" ),
path.GetPath(), GetFullFilename() );
return false;
}
@ -412,7 +412,7 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
if( ( path.FileExists() && !path.IsFileWritable() ) ||
( !path.FileExists() && !path.IsDirWritable() ) )
{
wxLogTrace( traceSettings, "File for %s is read-only; not saving", GetFullFilename() );
wxLogTrace( traceSettings, wxT( "File for %s is read-only; not saving" ), GetFullFilename() );
return false;
}
@ -425,18 +425,18 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
if( !modified && !aForce && path.FileExists() )
{
wxLogTrace( traceSettings, "%s contents not modified, skipping save", GetFullFilename() );
wxLogTrace( traceSettings, wxT( "%s contents not modified, skipping save" ), GetFullFilename() );
return false;
}
else if( !modified && !aForce && !m_createIfDefault )
{
wxLogTrace( traceSettings,
"%s contents still default and m_createIfDefault == false; not saving",
wxT( "%s contents still default and m_createIfDefault == false; not saving" ),
GetFullFilename() );
return false;
}
wxLogTrace( traceSettings, "Saving %s", GetFullFilename() );
wxLogTrace( traceSettings, wxT( "Saving %s" ), GetFullFilename() );
LOCALE_IO dummy;
bool success = true;
@ -451,19 +451,19 @@ bool JSON_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
if( !fileStream.IsOk()
|| !fileStream.WriteAll( buffer.str().c_str(), buffer.str().size() ) )
{
wxLogTrace( traceSettings, "Warning: could not save %s", GetFullFilename() );
wxLogTrace( traceSettings, wxT( "Warning: could not save %s" ), GetFullFilename() );
success = false;
}
}
catch( nlohmann::json::exception& error )
{
wxLogTrace( traceSettings, "Catch error: could not save %s. Json error %s",
wxLogTrace( traceSettings, wxT( "Catch error: could not save %s. Json error %s" ),
GetFullFilename(), error.what() );
success = false;
}
catch( ... )
{
wxLogTrace( traceSettings, "Error: could not save %s." );
wxLogTrace( traceSettings, wxT( "Error: could not save %s." ) );
success = false;
}
@ -557,7 +557,7 @@ bool JSON_SETTINGS::Migrate()
{
if( !m_migrators.count( filever ) )
{
wxLogTrace( traceSettings, "Migrator missing for %s version %d!",
wxLogTrace( traceSettings, wxT( "Migrator missing for %s version %d!" ),
typeid( *this ).name(), filever );
return false;
}
@ -566,14 +566,14 @@ bool JSON_SETTINGS::Migrate()
if( pair.second() )
{
wxLogTrace( traceSettings, "Migrated %s from %d to %d", typeid( *this ).name(),
wxLogTrace( traceSettings, wxT( "Migrated %s from %d to %d" ), typeid( *this ).name(),
filever, pair.first );
filever = pair.first;
m_internals->At( "meta.version" ) = filever;
}
else
{
wxLogTrace( traceSettings, "Migration failed for %s from %d to %d",
wxLogTrace( traceSettings, wxT( "Migration failed for %s from %d to %d" ),
typeid( *this ).name(), filever, pair.first );
return false;
}
@ -586,7 +586,7 @@ bool JSON_SETTINGS::Migrate()
bool JSON_SETTINGS::MigrateFromLegacy( wxConfigBase* aLegacyConfig )
{
wxLogTrace( traceSettings,
"MigrateFromLegacy() not implemented for %s", typeid( *this ).name() );
wxT( "MigrateFromLegacy() not implemented for %s" ), typeid( *this ).name() );
return false;
}
@ -742,7 +742,7 @@ bool JSON_SETTINGS::fromLegacyColor( wxConfigBase* aConfig, const std::string& a
void JSON_SETTINGS::AddNestedSettings( NESTED_SETTINGS* aSettings )
{
wxLogTrace( traceSettings, "AddNestedSettings %s", aSettings->GetFilename() );
wxLogTrace( traceSettings, wxT( "AddNestedSettings %s" ), aSettings->GetFilename() );
m_nested_settings.push_back( aSettings );
}
@ -759,7 +759,7 @@ void JSON_SETTINGS::ReleaseNestedSettings( NESTED_SETTINGS* aSettings )
if( it != m_nested_settings.end() )
{
wxLogTrace( traceSettings, "Flush and release %s", ( *it )->GetFilename() );
wxLogTrace( traceSettings, wxT( "Flush and release %s" ), ( *it )->GetFilename() );
( *it )->SaveToFile();
m_nested_settings.erase( it );
}

15
common/settings/nested_settings.cpp

@ -54,13 +54,13 @@ bool NESTED_SETTINGS::LoadFromFile( const wxString& aDirectory )
{
m_internals->update( m_parent->m_internals->at( ptr ) );
wxLogTrace( traceSettings, "Loaded NESTED_SETTINGS %s", GetFilename() );
wxLogTrace( traceSettings, wxT( "Loaded NESTED_SETTINGS %s" ), GetFilename() );
success = true;
}
catch( ... )
{
wxLogTrace( traceSettings, "NESTED_SETTINGS %s: Could not load from %s at %s",
wxLogTrace( traceSettings, wxT( "NESTED_SETTINGS %s: Could not load from %s at %s" ),
m_filename, m_parent->GetFilename(), m_path );
}
}
@ -76,31 +76,32 @@ bool NESTED_SETTINGS::LoadFromFile( const wxString& aDirectory )
}
catch( ... )
{
wxLogTrace( traceSettings, "%s: nested settings version could not be read!",
wxLogTrace( traceSettings, wxT( "%s: nested settings version could not be read!" ),
m_filename );
success = false;
}
if( filever >= 0 && filever < m_schemaVersion )
{
wxLogTrace( traceSettings, "%s: attempting migration from version %d to %d",
wxLogTrace( traceSettings, wxT( "%s: attempting migration from version %d to %d" ),
m_filename, filever, m_schemaVersion );
if( !Migrate() )
{
wxLogTrace( traceSettings, "%s: migration failed!", GetFullFilename() );
wxLogTrace( traceSettings, wxT( "%s: migration failed!" ), GetFullFilename() );
success = false;
}
}
else if( filever > m_schemaVersion )
{
wxLogTrace( traceSettings,
"%s: warning: nested settings version %d is newer than latest (%d)",
wxT( "%s: warning: nested settings version %d is newer than latest (%d)" ),
m_filename, filever, m_schemaVersion );
}
else if( filever >= 0 )
{
wxLogTrace( traceSettings, "%s: schema version %d is current", m_filename, filever );
wxLogTrace( traceSettings, wxT( "%s: schema version %d is current" ),
m_filename, filever );
}
}

66
common/settings/settings_manager.cpp

@ -84,7 +84,7 @@ JSON_SETTINGS* SETTINGS_MANAGER::registerSettings( JSON_SETTINGS* aSettings, boo
ptr->SetManager( this );
wxLogTrace( traceSettings, "Registered new settings object <%s>", ptr->GetFullFilename() );
wxLogTrace( traceSettings, wxT( "Registered new settings object <%s>" ), ptr->GetFullFilename() );
if( aLoadNow )
ptr->LoadFromFile( GetPathForSettingsFile( ptr.get() ) );
@ -140,7 +140,7 @@ void SETTINGS_MANAGER::Save( JSON_SETTINGS* aSettings )
if( it != m_settings.end() )
{
wxLogTrace( traceSettings, "Saving %s", ( *it )->GetFullFilename() );
wxLogTrace( traceSettings, wxT( "Saving %s" ), ( *it )->GetFullFilename() );
( *it )->SaveToFile( GetPathForSettingsFile( it->get() ) );
}
}
@ -156,7 +156,7 @@ void SETTINGS_MANAGER::FlushAndRelease( JSON_SETTINGS* aSettings, bool aSave )
if( it != m_settings.end() )
{
wxLogTrace( traceSettings, "Flush and release %s", ( *it )->GetFullFilename() );
wxLogTrace( traceSettings, wxT( "Flush and release %s" ), ( *it )->GetFullFilename() );
if( aSave )
( *it )->SaveToFile( GetPathForSettingsFile( it->get() ) );
@ -198,13 +198,13 @@ COLOR_SETTINGS* SETTINGS_MANAGER::GetColorSettings( const wxString& aName )
COLOR_SETTINGS* SETTINGS_MANAGER::loadColorSettingsByName( const wxString& aName )
{
wxLogTrace( traceSettings, "Attempting to load color theme %s", aName );
wxLogTrace( traceSettings, wxT( "Attempting to load color theme %s" ), aName );
wxFileName fn( GetColorSettingsPath(), aName, "json" );
if( !fn.IsOk() || !fn.Exists() )
{
wxLogTrace( traceSettings, "Theme file %s.json not found, falling back to user", aName );
wxLogTrace( traceSettings, wxT( "Theme file %s.json not found, falling back to user" ), aName );
return nullptr;
}
@ -212,7 +212,7 @@ COLOR_SETTINGS* SETTINGS_MANAGER::loadColorSettingsByName( const wxString& aName
if( settings->GetFilename() != aName.ToStdString() )
{
wxLogTrace( traceSettings, "Warning: stored filename is actually %s, ",
wxLogTrace( traceSettings, wxT( "Warning: stored filename is actually %s, " ),
settings->GetFilename() );
}
@ -352,14 +352,14 @@ void SETTINGS_MANAGER::SaveColorSettings( COLOR_SETTINGS* aSettings, const std::
if( !aSettings->Store() )
{
wxLogTrace( traceSettings, "Color scheme %s not modified; skipping save",
wxLogTrace( traceSettings, wxT( "Color scheme %s not modified; skipping save" ),
aNamespace );
return;
}
wxASSERT( aSettings->Contains( aNamespace ) );
wxLogTrace( traceSettings, "Saving color scheme %s, preserving %s",
wxLogTrace( traceSettings, wxT( "Saving color scheme %s, preserving %s" ),
aSettings->GetFilename(),
aNamespace );
@ -396,7 +396,7 @@ wxString SETTINGS_MANAGER::GetPathForSettingsFile( JSON_SETTINGS* aSettings )
return "";
default:
wxASSERT_MSG( false, "Unknown settings location!" );
wxASSERT_MSG( false, wxT( "Unknown settings location!" ) );
}
return "";
@ -445,7 +445,7 @@ public:
path.Replace( m_src, m_dest, false );
file.SetPath( path );
wxLogTrace( traceSettings, "Copying %s to %s", aSrcFilePath, file.GetFullPath() );
wxLogTrace( traceSettings, wxT( "Copying %s to %s" ), aSrcFilePath, file.GetFullPath() );
// For now, just copy everything
KiCopyFile( aSrcFilePath, file.GetFullPath(), m_errors );
@ -483,12 +483,12 @@ bool SETTINGS_MANAGER::MigrateIfNeeded()
{
if( m_headless )
{
wxLogTrace( traceSettings, "Settings migration not checked; running headless" );
wxLogTrace( traceSettings, wxT( "Settings migration not checked; running headless" ) );
return false;
}
wxFileName path( GetUserSettingsPath(), "" );
wxLogTrace( traceSettings, "Using settings path %s", path.GetFullPath() );
wxLogTrace( traceSettings, wxT( "Using settings path %s" ), path.GetFullPath() );
if( path.DirExists() )
{
@ -498,7 +498,7 @@ bool SETTINGS_MANAGER::MigrateIfNeeded()
if( common.Exists() )
{
wxLogTrace( traceSettings, "Path exists and has a kicad_common, continuing!" );
wxLogTrace( traceSettings, wxT( "Path exists and has a kicad_common, continuing!" ) );
return true;
}
}
@ -508,23 +508,23 @@ bool SETTINGS_MANAGER::MigrateIfNeeded()
if( dlg.ShowModal() != wxID_OK )
{
wxLogTrace( traceSettings, "Migration dialog canceled; exiting" );
wxLogTrace( traceSettings, wxT( "Migration dialog canceled; exiting" ) );
return false;
}
if( !path.DirExists() )
{
wxLogTrace( traceSettings, "Path didn't exist; creating it" );
wxLogTrace( traceSettings, wxT( "Path didn't exist; creating it" ) );
path.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
}
if( m_migration_source.IsEmpty() )
{
wxLogTrace( traceSettings, "No migration source given; starting with defaults" );
wxLogTrace( traceSettings, wxT( "No migration source given; starting with defaults" ) );
return true;
}
wxLogTrace( traceSettings, "Migrating from path %s", m_migration_source );
wxLogTrace( traceSettings, wxT( "Migrating from path %s" ), m_migration_source );
MIGRATION_TRAVERSER traverser( m_migration_source, path.GetFullPath(), m_migrateLibraryTables );
wxDir source_dir( m_migration_source );
@ -611,7 +611,7 @@ bool SETTINGS_MANAGER::GetPreviousVersionPaths( std::vector<wxString>* aPaths )
if( IsSettingsPathValid( sub_path ) )
{
aPaths->push_back( sub_path );
wxLogTrace( traceSettings, "GetPreviousVersionName: %s is valid", sub_path );
wxLogTrace( traceSettings, wxT( "GetPreviousVersionName: %s is valid" ), sub_path );
}
}
};
@ -627,12 +627,12 @@ bool SETTINGS_MANAGER::GetPreviousVersionPaths( std::vector<wxString>* aPaths )
if( !dir.Open( base_path.GetFullPath() ) )
{
wxLogTrace( traceSettings, "GetPreviousVersionName: could not open base path %s",
wxLogTrace( traceSettings, wxT( "GetPreviousVersionName: could not open base path %s" ),
base_path.GetFullPath() );
continue;
}
wxLogTrace( traceSettings, "GetPreviousVersionName: checking base path %s",
wxLogTrace( traceSettings, wxT( "GetPreviousVersionName: checking base path %s" ),
base_path.GetFullPath() );
if( dir.GetFirst( &subdir, wxEmptyString, wxDIR_DIRS ) )
@ -651,7 +651,7 @@ bool SETTINGS_MANAGER::GetPreviousVersionPaths( std::vector<wxString>* aPaths )
if( IsSettingsPathValid( dir.GetNameWithSep() ) )
{
wxLogTrace( traceSettings,
"GetPreviousVersionName: root path %s is valid", dir.GetName() );
wxT( "GetPreviousVersionName: root path %s is valid" ), dir.GetName() );
aPaths->push_back( dir.GetName() );
}
}
@ -685,7 +685,7 @@ wxString SETTINGS_MANAGER::GetColorSettingsPath()
if( !wxMkdir( path.GetPath() ) )
{
wxLogTrace( traceSettings,
"GetColorSettingsPath(): Path %s missing and could not be created!",
wxT( "GetColorSettingsPath(): Path %s missing and could not be created!" ),
path.GetPath() );
}
}
@ -747,7 +747,7 @@ int SETTINGS_MANAGER::compareVersions( const std::string& aFirst, const std::str
if( !extractVersion( aFirst, &a_maj, &a_min ) || !extractVersion( aSecond, &b_maj, &b_min ) )
{
wxLogTrace( traceSettings, "compareSettingsVersions: bad input (%s, %s)", aFirst, aSecond );
wxLogTrace( traceSettings, wxT( "compareSettingsVersions: bad input (%s, %s)" ), aFirst, aSecond );
return -1;
}
@ -822,7 +822,7 @@ bool SETTINGS_MANAGER::LoadProject( const wxString& aFullPath, bool aSetActive )
if( !lockFile )
{
wxLogTrace( traceSettings, "Project %s is locked; opening read-only", fullPath );
wxLogTrace( traceSettings, wxT( "Project %s is locked; opening read-only" ), fullPath );
readOnly = true;
}
@ -843,7 +843,7 @@ bool SETTINGS_MANAGER::LoadProject( const wxString& aFullPath, bool aSetActive )
m_projects_list.erase( it );
}
wxLogTrace( traceSettings, "Load project %s", fullPath );
wxLogTrace( traceSettings, wxT( "Load project %s" ), fullPath );
std::unique_ptr<PROJECT> project = std::make_unique<PROJECT>();
project->setProjectFullName( fullPath );
@ -888,7 +888,7 @@ bool SETTINGS_MANAGER::UnloadProject( PROJECT* aProject, bool aSave )
return false;
wxString projectPath = aProject->GetProjectFullName();
wxLogTrace( traceSettings, "Unload project %s", projectPath );
wxLogTrace( traceSettings, wxT( "Unload project %s" ), projectPath );
PROJECT* toRemove = m_projects.at( projectPath );
auto it = std::find_if( m_projects_list.begin(), m_projects_list.end(),
@ -923,7 +923,7 @@ bool SETTINGS_MANAGER::UnloadProject( PROJECT* aProject, bool aSave )
PROJECT& SETTINGS_MANAGER::Prj() const
{
// No MDI yet: First project in the list is the active project
wxASSERT_MSG( m_projects_list.size(), "no project in list" );
wxASSERT_MSG( m_projects_list.size(), wxT( "no project in list" ) );
return *m_projects_list.begin()->get();
}
@ -1114,17 +1114,17 @@ bool SETTINGS_MANAGER::BackupProject( REPORTER& aReporter ) const
if( !target.DirExists() && !wxMkdir( target.GetPath() ) )
{
wxLogTrace( traceSettings, "Could not create project backup path %s", target.GetPath() );
wxLogTrace( traceSettings, wxT( "Could not create project backup path %s" ), target.GetPath() );
return false;
}
if( !target.IsDirWritable() )
{
wxLogTrace( traceSettings, "Backup directory %s is not writable", target.GetPath() );
wxLogTrace( traceSettings, wxT( "Backup directory %s is not writable" ), target.GetPath() );
return false;
}
wxLogTrace( traceSettings, "Backing up project to %s", target.GetPath() );
wxLogTrace( traceSettings, wxT( "Backing up project to %s" ), target.GetPath() );
PROJECT_ARCHIVER archiver;
@ -1191,11 +1191,11 @@ bool SETTINGS_MANAGER::TriggerBackupIfNeeded( REPORTER& aReporter ) const
if( !wxDirExists( backupPath ) )
{
wxLogTrace( traceSettings, "Backup path %s doesn't exist, creating it", backupPath );
wxLogTrace( traceSettings, wxT( "Backup path %s doesn't exist, creating it" ), backupPath );
if( !wxMkdir( backupPath ) )
{
wxLogTrace( traceSettings, "Could not create backups path! Skipping backup" );
wxLogTrace( traceSettings, wxT( "Could not create backups path! Skipping backup" ) );
return false;
}
}
@ -1204,7 +1204,7 @@ bool SETTINGS_MANAGER::TriggerBackupIfNeeded( REPORTER& aReporter ) const
if( !dir.IsOpened() )
{
wxLogTrace( traceSettings, "Could not open project backups path %s", dir.GetName() );
wxLogTrace( traceSettings, wxT( "Could not open project backups path %s" ), dir.GetName() );
return false;
}

4
pcbnew/footprint_editor_settings.cpp

@ -423,7 +423,7 @@ bool FOOTPRINT_EDITOR_SETTINGS::migrateSchema0to1()
if( !m_manager )
{
wxLogTrace( traceSettings,
"Error: FOOTPRINT_EDITOR_SETTINGS migration cannot run unmanaged!" );
wxT( "Error: FOOTPRINT_EDITOR_SETTINGS migration cannot run unmanaged!" ) );
return false;
}
@ -439,7 +439,7 @@ bool FOOTPRINT_EDITOR_SETTINGS::migrateSchema0to1()
{
if( settings->GetFilename() == search )
{
wxLogTrace( traceSettings, "Updating footprint editor theme from %s to %s",
wxLogTrace( traceSettings, wxT( "Updating footprint editor theme from %s to %s" ),
selected, search );
Set( theme_ptr, search );
return true;

Loading…
Cancel
Save