kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #24406
FOOTPRINT_LIBRARY_HEADER_CNT
I have a pretty specific question about some relatively old code that
intersects with what I'm working on now. Dick was the original author, not sure
if he'd remember... -
pcbnew/legacy_plugin.h:
33 #define FOOTPRINT_LIBRARY_HEADER "PCBNEW-LibModule-V1"
34 #define FOOTPRINT_LIBRARY_HEADER_CNT 18
FOOTPRINT_LIBRARY_HEADER_CNT is being used as a length in comparisons using
strncmp(). The length does not match, however, as "PCBNEW-LibModule-V1" is 19
characters long, not 18. At first I thought this was a simple mistake, and
replaced FOOTPRINT_LIBRARY_HEADER_CNT with strlen(FOOTPRINT_LIBRARY_HEADER),
which eliminates the possibility of a miscount (and for the micro-optimizers
out there, all the compilers I've used optimize strlen(literal) ;).
But then it occurs to me that it *might* have been intentional, as comparing
with a length of 18 will compare everything but the version number, which may
have been desired.
Anyone willing to have a look at the code that uses this, and see what they
think the intended use was? Has there ever been a V2?
--
Chris
Follow ups