kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #31760
Re: [PATCH] fix MANDATORY_FIELDS comparisons
-
To:
<kicad-developers@xxxxxxxxxxxxxxxxxxx>
-
From:
Maciej Sumiński <maciej.suminski@xxxxxxx>
-
Date:
Mon, 20 Nov 2017 09:13:25 +0100
-
Authentication-results:
spf=pass (sender IP is 188.184.36.50) smtp.mailfrom=cern.ch; lists.launchpad.net; dkim=none (message not signed) header.d=none;lists.launchpad.net; dmarc=bestguesspass action=none header.from=cern.ch;
-
In-reply-to:
<alpine.LNX.2.00.1711181331470.9667@phi>
-
Spamdiagnosticmetadata:
NSPM
-
Spamdiagnosticoutput:
1:99
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0
Thank you Julius, I have just merged your patch.
Regards,
Orson
On 11/18/2017 01:32 PM, Julius Schmidt wrote:
> Apologies for the delay, but here's the patch as an attachment.
>
> On Thu, 9 Nov 2017, Wayne Stambaugh wrote:
>
>> Julius,
>>
>> I cannot git am this patch. Apparently, the extra info added by
>> launchpad is causing an issue. Please resend this patch as an
>> attachment so I can get it merged.
>>
>> Thanks,
>>
>> Wayne
>>
>> On 11/7/2017 4:31 AM, Julius Schmidt wrote:
>>> I found a few places where SCH_FIELD::GetId() is incorrectly (signed)
>>> compared to MANDATORY_FIELDS.
>>> I'm not sure all of these are bugs but at least the sch_component.cpp
>>> one triggers an assertion here when creating components with
>>> non-mandatory fields defined.
>>>
>>> ---
>>> eeschema/class_libentry.cpp | 2 +-
>>> eeschema/lib_field.cpp | 2 +-
>>> eeschema/sch_component.cpp | 2 +-
>>> eeschema/sch_legacy_plugin.cpp | 2 +-
>>> 4 files changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp
>>> index cfe3d99..fe6f8e1 100644
>>> --- a/eeschema/class_libentry.cpp
>>> +++ b/eeschema/class_libentry.cpp
>>> @@ -1096,7 +1096,7 @@ bool LIB_PART::LoadField( LINE_READER&
>>> aLineReader, wxString& aErrorMsg )
>>> return false;
>>> }
>>>
>>> - if( field->GetId() < MANDATORY_FIELDS )
>>> + if( (unsigned) field->GetId() < MANDATORY_FIELDS )
>>> {
>>> LIB_FIELD* fixedField = GetField( field->GetId() );
>>>
>>> diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp
>>> index 26237bd..35f74a1 100644
>>> --- a/eeschema/lib_field.cpp
>>> +++ b/eeschema/lib_field.cpp
>>> @@ -264,7 +264,7 @@ bool LIB_FIELD::Load( LINE_READER& aLineReader,
>>> wxString& errorMsg )
>>> }
>>>
>>> // fields in RAM must always have names.
>>> - if( m_id < MANDATORY_FIELDS )
>>> + if( (unsigned) m_id < MANDATORY_FIELDS )
>>> {
>>> // Fields in RAM must always have names, because we are trying
>>> to get
>>> // less dependent on field ids and more dependent on names.
>>> diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
>>> index e03b077..d36cb55 100644
>>> --- a/eeschema/sch_component.cpp
>>> +++ b/eeschema/sch_component.cpp
>>> @@ -874,7 +874,7 @@ void SCH_COMPONENT::UpdateFields( bool aResetStyle,
>>> bool aResetRef )
>>>
>>> if( idx == REFERENCE && !aResetRef )
>>> continue;
>>> - if( idx < MANDATORY_FIELDS )
>>> + if( (unsigned) idx < MANDATORY_FIELDS )
>>> schField = GetField( idx );
>>> else
>>> schField = FindField( field.GetName() );
>>> diff --git a/eeschema/sch_legacy_plugin.cpp
>>> b/eeschema/sch_legacy_plugin.cpp
>>> index b7daee5..f70fdce 100644
>>> --- a/eeschema/sch_legacy_plugin.cpp
>>> +++ b/eeschema/sch_legacy_plugin.cpp
>>> @@ -2657,7 +2657,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadField(
>>> std::unique_ptr< LIB_PART >& aPart,
>>> }
>>>
>>> // Fields in RAM must always have names.
>>> - if( id < MANDATORY_FIELDS )
>>> + if( (unsigned) id < MANDATORY_FIELDS )
>>> {
>>> // Fields in RAM must always have names, because we are trying
>>> to get
>>> // less dependent on field ids and more dependent on names.
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help : https://help.launchpad.net/ListHelp
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
Attachment:
signature.asc
Description: OpenPGP digital signature
References