* Fix sequence to "static const"
Using "static const" instead of "const static" makes this
declaration use the same sequence as all other "static"
declarations in libexif, and also avoids the occasional
gcc warning about that sequence:
warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
* Fix signed/unsigned comparison: use size_t instead of int
sizeof() returns a size_t, and an array index is a size_t as well,
so we can use a size_t as the for loop variable in the first place.
The gcc warning this fixes is
warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
* Add explicit /* fall through */ comments to avoid warnings
gcc recognizes a /* fall through */ comment (without any
additional words) as a hint that falling through is intended.
Otherwise, gcc generates
warning: this statement may fall through [-Wimplicit-fallthrough=]`
* Pseudo-use unused parameter to avoid warning about unused param
The gcc warning this fixes is
warning: unused parameter ‘ed’ [-Wunused-parameter]
* Cast to (void *) for %p in format to avoid warning
The gcc warning this fixes is
warning: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘ExifContent *’ {aka ‘struct _ExifContent *’} [-Wformat=]
* consistently use *.h #ifndef and #endif macros
Consistently name and use the macros wrapping include files:
/* file foo-bar.h */
#ifndef __FOO_BAR_H__
#define __FOO_BAR_H__
...
#endif /* __FOO_BAR_H__ */
This fixes wrong comments after the #endif, and macro names
which were diverging too much from the include file name.
* configure: pseudo use variables to make checks succeed even with -Werror
Pseudo-using the result variables makes the configure compilations
work even if CFLAGS happens to contain -Werror.
Otherwise, the unused variable will trigger a warning which will be
treated like an error, which is the wrong result when trying to
find out whether compiling/linking works.
When compiling libexif on a Linux build system for a Windows
host using mingw32 or mingw64, the built test programs (run
by Wine) will usually print lines to stdout using Windows
CRLF line endings.
However, several parts of the test fail with the other line
endings, e.g. known good output in a text file will have
different line endings to what the test program produces,
and the comparison will fail based on the line endings
when what really matters is the actual lines.
Anyway, this just removes all CR characters in the few
places which caused "make check" to fail for a mingw
cross compile build using by piping through
| tr -d '\015'
Using tr -d with an octally escaped CR should not be
a portabilty problem: other parts of configure already
use tr -d with an octally escaped character.
I hope this does not cause problems on msys or other
systems where the build system uses CRLF as well. If it
does, we will need to add more complex logic to recognize
the proper line endings to use where.
Just use "exit 77" to skip the check-failmalloc.sh test.
This makes it clear when running "make check" that this
test is being skipped, and does not just hide it for
just those who happen to be in the know.
Before actually running diff, check that diff is actually
available. And when it is possible, even use "diff -u".
And if diff is not available at all, fall back to cmp.
cmp does not produce nice verbose output, but it has
the same exit values as diff.
Oh, and we try to avoid "if ! condition" in the shell script,
as there allegedly are some corner cases where that is
problematic.
This extracts the EXIF tags from an image then compares the parsed value
of the extracted tags with those of the original file. This ensures that
the tags are written properly, without change in tag data. The MakerNote
tag sometimes has a harmless, slight difference in size because of
padding being removed.
However, in developing this test, I found that the Olympus variant 4
MakerNote has a huge size difference. This might be harmless (there
might just be a lot of padding removed) but it's also possible that
these MakerNotes aren't being properly parsed. This discrepancy should
be investigated.
The exif_data_save_data() function is also returning some JPEG markers
at the end of the buffer which I wasn't expecting. This also should be
investigated.
The test is enabled anyway in the meantime to reduce the chance of
regressions in the remaining tags.
This requires Failmalloc, a library that can be used along with glibc to
cause malloc calls to fail in a defined way. Configure will search for
libfailmalloc.so.0 in the usual places by default, or in a
user-specified location. The tests are skipped if it's not available.
Enable Failmalloc on the Travis coverage build.
Do a better job in leaving things in a more consistent state after an
allocation failure. Also, make the tests report and handle OOM
conditions cleanly.
This is accomplished by adding a feature to test-parse.c to switch the
byte order before dumping the EXIF output. Additionally, the MakerNote
values are now logged in the dump as well, in the same way as the
regular tags, to better catch regressions.
This new test uncovered a bug in the decoding of the
MNOTE_NIKON_TAG_FIRMWARE tag whose data should not be treated as being
endian-specific.
This is intended as a fast check that all tags, including MakerNotes, can be
parsed. It is not intended to replace the much more complete tests in
libexif-testsuite, but rather add some basic parsing test coverage without
having to download and configure a separate repository. As more tags are
identified and supported in the library in the future, the golden test files
will need to be updated to match.
The input files cover all four major MakerNote types supported by libexif and a
large proportion of the variants within those types. The test files have had
their JPEG image data stripped out to make them smaller (which also makes them
noncompliant) but it's good enough for libexif to read the tags as well as some
other EXIF tools that don't care about the image.
Patch from Google.
If the buffer size provided forced the result to be truncated, the
truncation was not always properly performed. test-values.c was enhanced
to check proper truncation in a much wider variety of cases.