specctra_export: fix an issue with custom pads.
From Master, commit 686254. In some cases a created pad stack name had the same name as an other pad stack having a slightly different shape, thus creating pads with a incorrect shape on board. Fixes #6495 for the 5.1.10 branch.
This commit is contained in:
parent
540fb91d34
commit
a179893d70
|
@ -92,6 +92,34 @@ bool MD5_HASH::operator!=( const MD5_HASH& aOther ) const
|
|||
}
|
||||
|
||||
|
||||
std::string MD5_HASH::Format( bool aCompactForm )
|
||||
{
|
||||
std::string data;
|
||||
|
||||
// Build a hexadecimal string from the 16 bytes of MD5_HASH:
|
||||
for( int ii = 0; ii < 16; ++ii )
|
||||
{
|
||||
char lsb = ( m_hash[ii] & 0x0F ) + '0';
|
||||
|
||||
if( lsb > '9' )
|
||||
lsb += 'A'-'9';
|
||||
|
||||
char msb = ( ( m_hash[ii] >> 4 ) & 0x0F ) + '0';
|
||||
|
||||
if( msb > '9' )
|
||||
msb += 'A'-'9';
|
||||
|
||||
data += msb;
|
||||
data += lsb;
|
||||
|
||||
if( !aCompactForm )
|
||||
data += ' ';
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
void MD5_HASH::md5_transform(MD5_CTX *ctx, uint8_t data[])
|
||||
{
|
||||
uint32_t a,b,c,d,m[16],i,j;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define __MD5_HASH_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class MD5_HASH
|
||||
{
|
||||
|
@ -29,6 +30,13 @@ public:
|
|||
bool operator==( const MD5_HASH& aOther ) const;
|
||||
bool operator!=( const MD5_HASH& aOther ) const;
|
||||
|
||||
/** @return a hexadecimal string from the 16 bytes of MD5_HASH
|
||||
* Mainly for debug purposes.
|
||||
* @param aCompactForm = false to generate a string with spaces between each byte (2 chars)
|
||||
* = true to generate a string filled with 32 hexadecimal chars
|
||||
*/
|
||||
std::string Format( bool aCompactForm = false );
|
||||
|
||||
private:
|
||||
struct MD5_CTX {
|
||||
uint8_t data[64];
|
||||
|
|
|
@ -594,11 +594,12 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
|
|||
}
|
||||
|
||||
// this string _must_ be unique for a given physical shape, so try to make it unique
|
||||
MD5_HASH hash = pad_shape.GetHash();
|
||||
EDA_RECT rect = aPad->GetBoundingBox();
|
||||
snprintf( name, sizeof(name), "Cust%sPad_%.6gx%.6g_%.6gx_%.6g_%d_um",
|
||||
snprintf( name, sizeof(name), "Cust%sPad_%.6gx%.6g_%.6gx_%.6g_%d_um_%s",
|
||||
uniqifier.c_str(), IU2um( aPad->GetSize().x ), IU2um( aPad->GetSize().y ),
|
||||
IU2um( rect.GetWidth() ), IU2um( rect.GetHeight() ),
|
||||
(int)polygonal_shape.size() );
|
||||
(int)polygonal_shape.size(), hash.Format( true ).c_str() );
|
||||
name[ sizeof(name)-1 ] = 0;
|
||||
|
||||
padstack->SetPadstackId( name );
|
||||
|
|
Loading…
Reference in New Issue