Disabling strip-chopping causes compiler errors
Summary
Disabling CMake option strip-chopping
causes a compile issue.
Version
4.5.1
Steps to reproduce
- Download archive of 4.5.1 and run CMake with disabled
strip-chopping
(I had everything disabled in the ungrouped category of CMake) - Try to compile =>
tif_dirread.c(7348,43): error C2059: syntax error: ')'
Reason for this issue:
tif_config.h.cmake.in
contains #define STRIP_SIZE_DEFAULT @STRIP_SIZE_DEFAULT@
. Due to the code for strip-chopping
in LibraryFeatures.cmake
, @STRIP_SIZE_DEFAULT@
will be replaced by nothing in case strip-chopping
is OFF
. Therefore if (rowblockbytes > STRIP_SIZE_DEFAULT)
(in tif_dirread.c
) is basically if (rowblockbytes > )
(as the macro will be replaced by nothing).
Possible solution:
- Use
#cmakedefine STRIP_SIZE_DEFAULT @STRIP_SIZE_DEFAULT@
, so the default value will be defined intiffiop.h
(as the#ifndef STRIP_SIZE_DEFAULT
is then working) - Remove the default value
STRIP_SIZE_DEFAULT
completely and adjustChopUpSingleUncompressedStrip
to:/* * Make the rows hold at least one scanline, but fill specified amount * of data if possible. */ #ifdef STRIP_SIZE_DEFAULT if (rowblockbytes > STRIP_SIZE_DEFAULT) { stripbytes = rowblockbytes; rowsperstrip = rowblock; } else if (rowblockbytes > 0) { uint32_t rowblocksperstrip; rowblocksperstrip = (uint32_t)(STRIP_SIZE_DEFAULT / rowblockbytes); rowsperstrip = rowblocksperstrip * rowblock; stripbytes = rowblocksperstrip * rowblockbytes; } else return; #else if (rowblockbytes == 0) { return } stripbytes = rowblockbytes; rowsperstrip = rowblock; #endif
I think both should be implemented, so STRIP_SIZE_DEFAULT
will not be defined in case strip-chopping
is off and as the option suggest I would be expect that no chopping happens in case this option is disabled (or remove this option).
Platform
Win11, x64, VS 17.6.5 (MSVC 2022)