stdlib checks do not allow dereferencing the first element of a vector
when there are no elements in the vector (regardless of whether we have
allocated memory for them). This whole function is rather
over-engineered, setting up multiple allocations and branches depending
of the string size. This commit reduces the function to the actions
needed (get the string size, print it into the output)
Trying to squeeze out some kind of gain by informing the OS we will read a file sequentially.
In particular our FILE_LINE_READER just uses fgetc until the end
STRING_LINE_READER::ReadLine contains the code for expanding the buffer
for the current line. But it modifies length before expanding.
Therefore expandCapacity function tries to read the memory outside
the buffer.
This patch postpones m_length modification, until buffer resizing
is finished.
Unused variables in function calls can be commented out. Unused
return variables get a new routine `ignore_unused()` that silences the
warnings with zero overhead.
in most of files, including wx.h is not necessary, when only 2 or 3 wx files must be included.
Moreover, on windows, including wx.h sometimes create compil warnings about
shadowed vars defined in some specific windows headers.
Currently, kicad_pcb files have a (version ...) tag, but it is ignored. This
commit does the following:
1. Parse the version. If it's later than the last supported version, present an
alternative error message suggesting an upgrade if the file does not load
correctly. The version will be interpreted as an integer YYYYMMDD to suggest
a KiCad release date.
2. Accept a (version ...) tag also in kicad_mod files, but do not write them
yet. If no version tag is present in these files, assume the version to be that
of the current format version at the time of this commit.
This is meant to be merged to the 4.x stable series, and preps for KiCad 5
which will start emitting version tags also in footprints - users with what
will then be 'old stable' will not get a parse error when we introduce this for
footprints, and we can safely increment the format version later.
* Add footprint methods to PCB_IO.
* Add FP_CACHE and FP_CACHE_ITEM for handling new footprint library design.
* Add code to save legacy libraries in new format.
* Change behavior of BOARD_ITEM::GetLayerName() to return the default layer
name when the item does not have a BOARD as a parent.
* Minor changes to the module output formatter when writing to module library
files (no BOARD as parent).
* Add new (and some that I forgot along the way) CMake flags to
EDA_BASE_FRAME::CopyVersionInfoToClipboard().
* Add -Wno-narrowing to GCC flags to stop GCC 4.7 from complaining about
a conversion from int to unsigned in the Boost polygon library.
* Add INPUT_STREAM_READER to richio.cpp to allow using any object derived
from wxInputStream as a LINE_READER (needs to be validated).