Reverse commit 4011ed4e31.

This commit was too broad and not cognizant of the purpose of the class
UTF8.

Add MAYBE_VERIFY_UTF8() macro, which can trap non-UTF8 encoded strings in
debug builds.

Use that macro conditionally in class UTF8 to trap non-UTF8 encoded strings
being put into UTF8 instances.
This commit is contained in:
Dick Hollenbeck
2017-07-26 08:26:56 -04:00
committed by Wayne Stambaugh
parent 161045f17d
commit 4e7de8a761
36 changed files with 207 additions and 143 deletions
+5 -6
View File
@@ -26,7 +26,6 @@
#include <fctsys.h>
#include <common.h>
#include <macros.h>
#include <kiface_i.h>
#include <footprint_info.h>
#include <lib_id.h>
@@ -287,12 +286,12 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString&
LIB_ID& fpid = (LIB_ID&) ret->GetFPID();
// Catch any misbehaving plugin, which should be setting internal footprint name properly:
wxASSERT( aFootprintName == FROM_UTF8( fpid.GetLibItemName() ) );
wxASSERT( aFootprintName == (wxString) fpid.GetLibItemName() );
// and clearing nickname
wxASSERT( !fpid.GetLibNickname().size() );
fpid.SetLibNickname( TO_UTF8( row->GetNickName() ) );
fpid.SetLibNickname( row->GetNickName() );
}
return ret;
@@ -310,7 +309,7 @@ FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname,
// Try loading the footprint to see if it already exists, caller wants overwrite
// protection, which is atypical, not the default.
wxString fpname = FROM_UTF8( aFootprint->GetFPID().GetLibItemName() );
wxString fpname = aFootprint->GetFPID().GetLibItemName();
std::unique_ptr<MODULE> footprint( row->plugin->FootprintLoad( row->GetFullURI( true ),
fpname, row->GetProperties() ) );
@@ -360,8 +359,8 @@ void FP_LIB_TABLE::FootprintLibCreate( const wxString& aNickname )
MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const LIB_ID& aFootprintId )
{
wxString nickname = FROM_UTF8( aFootprintId.GetLibNickname() );
wxString fpname = FROM_UTF8( aFootprintId.GetLibItemName() );
wxString nickname = aFootprintId.GetLibNickname();
wxString fpname = aFootprintId.GetLibItemName();
if( nickname.size() )
{