LIB_ID: fix incorrect detection of illegal chars, when values are not ASCII values.
Fixes: lp:1764055 https://bugs.launchpad.net/kicad/+bug/1764055
This commit is contained in:
parent
b636aaddf6
commit
7395949ae0
|
@ -403,18 +403,19 @@ const unsigned schIllegalChars[] = { BASE_ILLEGAL_CHARS, ' ' };
|
|||
const unsigned pcbIllegalChars[] = { BASE_ILLEGAL_CHARS, 0 };
|
||||
#define ILL_CHAR_SIZE (sizeof(schIllegalChars) / sizeof(int))
|
||||
|
||||
bool LIB_ID::isLegalChar( unsigned aChar, LIB_ID_TYPE aType )
|
||||
bool LIB_ID::isLegalChar( unsigned aUniChar, LIB_ID_TYPE aType )
|
||||
{
|
||||
const unsigned (&illegalChars)[ILL_CHAR_SIZE] =
|
||||
aType == ID_SCH ? schIllegalChars : pcbIllegalChars;
|
||||
|
||||
for( const unsigned ch : illegalChars )
|
||||
{
|
||||
if( ch == aChar )
|
||||
if( ch == aUniChar )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !wxIsascii( aChar ) )
|
||||
// Test for "printable" code (aUniChar is a unicode (32 bits) char, not a ASCII value )
|
||||
if( aUniChar < ' ' )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -137,7 +137,6 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
|||
{
|
||||
typedef std::map<wxString, RESCUE_CASE_CANDIDATE> candidate_map_t;
|
||||
candidate_map_t candidate_map;
|
||||
|
||||
// Remember the list of components is sorted by part name.
|
||||
// So a search in libraries is made only once by group
|
||||
LIB_ALIAS* case_sensitive_match = nullptr;
|
||||
|
@ -380,15 +379,17 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
|
|||
|
||||
// Test whether there is a conflict or if the symbol can only be found in the cache.
|
||||
if( ( ( cache_match && lib_match
|
||||
&& !cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
|
||||
|| (!cache_match && lib_match ) )
|
||||
&& !LIB_ID::HasIllegalChars( part_id.GetLibItemName(), LIB_ID::ID_SCH ) )
|
||||
&& !cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
|
||||
|| (!cache_match && lib_match ) )
|
||||
&& !LIB_ID::HasIllegalChars( part_id.GetLibItemName(), LIB_ID::ID_SCH ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Fix illegal LIB_ID name characters.
|
||||
wxString new_name = LIB_ID::FixIllegalChars( part_id.GetLibItemName(), LIB_ID::ID_SCH );
|
||||
|
||||
// Differentiate symbol name in the resue library by appending the symbol library
|
||||
// Differentiate symbol name in the rescue library by appending the symbol library
|
||||
// table nickname to the symbol name to prevent name clashes in the rescue library.
|
||||
wxString libNickname = GetRescueLibraryFileName().GetName();
|
||||
|
||||
|
|
|
@ -236,8 +236,11 @@ public:
|
|||
#endif
|
||||
|
||||
protected:
|
||||
///> Tests whether a character is a legal LIB_ID character
|
||||
static bool isLegalChar( unsigned aChar, LIB_ID_TYPE aType );
|
||||
/** Tests whether a unicode character is a legal LIB_ID character
|
||||
* note: aUniChar is expected to be a unicode 32 bits char, not a UTF8 char, that use
|
||||
* a variable lenght coding value
|
||||
*/
|
||||
static bool isLegalChar( unsigned aUniChar, LIB_ID_TYPE aType );
|
||||
|
||||
UTF8 nickname; ///< The nickname of the library or empty.
|
||||
UTF8 item_name; ///< The name of the entry in the logical library.
|
||||
|
|
Loading…
Reference in New Issue