← Back to team overview

kicad-developers team mailing list archive

Re: StrNumCmp

 

Hi,

On 04.12.2016 13:33, jp charras wrote:

>> when doing other stuff I ran into one of a gazillion cases that can make StrNumCmp starting in
>> common/string.cpp:214 crash. There are quite a few unchecked iterator dereferences, the aLength
>> parameter is not correctly taken into account, etc.. The comment on the function's declaration is
>> not enough specification for me to rewrite it properly. If somebody would come up with a spec for me
>> I would happily rewrite the function.

> It is similar to a string comparison (for string sorting) but unlike the usual strncmp() or
> strncasecmp() functions, when digits are encountered in a string, they are converted to a number and
> this is the number value which is taken in account for comparison.

I've written my own back then for the pin table, factored out into
eeschema/pin_number.cpp. This should be merged with the other
implementations then in the same process, and possibly generalized
(there is special treatment of "V" as a decimal point if it is placed
between numbers, for example, that may not always be appropriate).

   Simon

Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References