This fixes warnings from the clang compiler:
../src/bmpio.c:169:37: warning: taking address of packed member 'bmpih' of class or structure 'BMP_HEADER' may result in an unaligned pointer value [-Waddress-of-packed-member]
169 | compression = convertOnBigEnd32(bmpih->biCompression);
| ^~~~~
../src/bmpio.c:147:17: note: expanded from macro 'bmpih'
147 | #define bmpih (&bmph->bmpih)
| ^~~~~~~~~~~
../src/bmpio.c:186:31: warning: taking address of packed member 'bmpih' of class or structure 'BMP_HEADER' may result in an unaligned pointer value [-Waddress-of-packed-member]
186 | width = convertOnBigEnd32(bmpih->biWidth);
| ^~~~~
../src/bmpio.c:147:17: note: expanded from macro 'bmpih'
147 | #define bmpih (&bmph->bmpih)
| ^~~~~~~~~~~
[...]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This fixes a bug reported by the clang compiler on macOS:
CC scale2.lo
src/scale2.c:257:28: warning: floating-point comparison is always false; constant cannot be represented exactly in type 'float' [-Wliteral-range]
257 | } else if (scalefactor == 0.16667) {
| ~~~~~~~~~~~ ^ ~~~~~~~
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This fixes a bug which is reported by the clang compiler on macOS:
CC partition_reg.o
prog/partition_reg.c:75:56: warning: implicit conversion from 'double' to 'l_int32' (aka 'int') changes value from 0.4 to 0 [-Wliteral-conversion]
75 | TestPartition(rp, "test8.jpg", L_SORT_BY_AREA, 20, 0.4, "test2.pdf",
| ~~~~~~~~~~~~~ ^~~
Signed-off-by: Stefan Weil <sw@weilnetz.de>
`gnuplot -e "set terminal png"` does not return an error if the
command fails, but prints an error message.
So instead of checking for an error the test now checks for a
non-empty output.
This fixes `make check` on hosts with a gnuplot which does not
support `set terminal png`.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Some older versions of /bin/sh don't work. This was noticed in a test
on Solaris 11.4 (SPARC) with sh (AT&T Research) 93u+ 2012-08-01.
Instead of using /bin/bash the script now finds bash with /usr/bin/env,
so it will use the latest bash on systems like macOS.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
* When there is an oversized media box, the pdftoppm renderer can get
confused about the image size and generate a larger image that
is embedded in a black background.
* Added a test to misctest2.c for this functionality.
* This implements a function used in several programs, that takes a
set of input pdf files that are assumed to be page images,
and renders every page in a temp directory at a requested resolution.
* Modified prog/cleanpdf to use this function; checked with previous
implementation; used valgrind.
* The new implementation is better because it writes the output files
in a temp directory that is cleaned out with each invocation of
the function. In the previous implementation, it was necessary to
remove previously rendered files by hand.
* The new implementation allows output images to be rendered at
resolutions between 50 and 300 ppi, independent of the actual
resolution of the input images wrapped in the pdf files. This is
done by assuming the input pages are 612 x 792 printer points.
* pdf files generated by applications like cleanpdf, that use this
function, will print normally on 8.5 x 11 inch paper.
* This allows filling to the full width of 8.5 x 11 or A4 paper when
the h/w ratio is too large to do this without extra horizontal stretching.
* This is not needed for displaying the pdf, because the viewers display
the image as it is, without consideration of printing.
* This is from the left and right sides, and is invoked in prog/croppdf
by using a negative input paramater for edgeclean.
* New prog/misctest2.c to have page cropping and cleaning examples,
with two sample music notation images. Existing cropping and cleaning
examples have been removed from prog/misctest1.c.