Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 1 | Upstream-Status: Backport |
| 2 | Signed-off-by: Ross Burton <ross.burton@arm.com> |
| 3 | |
| 4 | From bad48e90b410df32172006c7876da449ba62cdba Mon Sep 17 00:00:00 2001 |
| 5 | From: Su_Laus <sulau@freenet.de> |
| 6 | Date: Sat, 20 Aug 2022 23:35:26 +0200 |
| 7 | Subject: [PATCH] tiffcrop -S option: Make decision simpler. |
| 8 | |
| 9 | --- |
| 10 | tools/tiffcrop.c | 10 +++++----- |
| 11 | 1 file changed, 5 insertions(+), 5 deletions(-) |
| 12 | |
| 13 | diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c |
| 14 | index c3b758ec..8fd856dc 100644 |
| 15 | --- a/tools/tiffcrop.c |
| 16 | +++ b/tools/tiffcrop.c |
| 17 | @@ -2133,11 +2133,11 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32 |
| 18 | } |
| 19 | /*-- Check for not allowed combinations (e.g. -X, -Y and -Z, -z and -S are mutually exclusive) --*/ |
| 20 | char XY, Z, R, S; |
| 21 | - XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH)); |
| 22 | - Z = (crop_data->crop_mode & CROP_ZONES); |
| 23 | - R = (crop_data->crop_mode & CROP_REGIONS); |
| 24 | - S = (page->mode & PAGE_MODE_ROWSCOLS); |
| 25 | - if ((XY && Z) || (XY && R) || (XY && S) || (Z && R) || (Z && S) || (R && S)) { |
| 26 | + XY = ((crop_data->crop_mode & CROP_WIDTH) || (crop_data->crop_mode & CROP_LENGTH)) ? 1 : 0; |
| 27 | + Z = (crop_data->crop_mode & CROP_ZONES) ? 1 : 0; |
| 28 | + R = (crop_data->crop_mode & CROP_REGIONS) ? 1 : 0; |
| 29 | + S = (page->mode & PAGE_MODE_ROWSCOLS) ? 1 : 0; |
| 30 | + if (XY + Z + R + S > 1) { |
| 31 | TIFFError("tiffcrop input error", "The crop options(-X|-Y), -Z, -z and -S are mutually exclusive.->Exit"); |
| 32 | exit(EXIT_FAILURE); |
| 33 | } |
| 34 | -- |
| 35 | 2.34.1 |
| 36 | |