Um pequeno programa de teste para obter alguns campos de uma declaração.
Fix other warnings. When using -Wextra, there were some signedness related warnings, as well as size warnings, like using %li for pointer diff on 32-bit systems. This was build-tested on both a 32-bit ARM and 64-bit x86_64.
Update copyright headers
Fix compiler warnings on %i format for long int. On 64-bit platforms, we get the following warning: decfile.c:213:3: warning: format ‘%i’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat] Using %li works on both 32-bit ARM and 64-bit x86.
Check len macros during parsing. Move header start and end macros to decfile.h as head and tail. Add sanity checking code during parsing. Adjust the encoder. Update the format docs.
Use macros for the header size. For each year, use a macro for the header size we expect.
Grow message by just the needed amount Do not allocate more space than required for the message to grow. We used to nearly double the amount of space every time, which is nice to avoid quadratic complexity, but files are small enough that it probably doesn't matter much, and it just makes things confusing.
Distinguish between 2013 and 2014. The file format changes throughout the years, with added fields in the header. Verify the size of the header and the year indicated, and add support for year 2014.
Use errno to indicate error in parsing file.
Add the missing field in the first message. It's composed of part of the header register. It's more simple to build it as a substring of the register itself, than composing it field by field.
Calculate message hash and use it. Use gcrypt to calculate stripped file MD5 hash and add it to the key/value message.
Strip the DEC file from control numbers. In order to send the second part of the message, we need to strip the declaration registers from their control numbers.
Parse DEC file header. Include fields from the header in a pmhash and introduce a function to retrieve them. Some of those fields are needed to send the first message to the server.
Start parsing a DEC file. Read lines from a DEC file and store them in an array for later parsing.