TJBench/Java: Fix parsing of quality ranges
This commit is contained in:
@@ -45,6 +45,9 @@ image dimensions.
|
|||||||
(`-DWITH_12BIT=1`) using an alpha-enabled output color space such as
|
(`-DWITH_12BIT=1`) using an alpha-enabled output color space such as
|
||||||
`JCS_EXT_RGBA`, the alpha channel was set to 255 rather than 4095.
|
`JCS_EXT_RGBA`, the alpha channel was set to 255 rather than 4095.
|
||||||
|
|
||||||
|
8. Fixed an issue whereby the Java version of TJBench did not accept a range of
|
||||||
|
quality values.
|
||||||
|
|
||||||
|
|
||||||
2.1.4
|
2.1.4
|
||||||
=====
|
=====
|
||||||
|
|||||||
@@ -782,18 +782,18 @@ final class TJBench {
|
|||||||
minArg = 2;
|
minArg = 2;
|
||||||
if (argv.length < minArg)
|
if (argv.length < minArg)
|
||||||
usage();
|
usage();
|
||||||
|
String[] quals = argv[1].split("-", 2);
|
||||||
try {
|
try {
|
||||||
minQual = Integer.parseInt(argv[1]);
|
minQual = Integer.parseInt(quals[0]);
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {}
|
||||||
if (minQual < 1 || minQual > 100)
|
if (minQual < 1 || minQual > 100)
|
||||||
throw new Exception("Quality must be between 1 and 100.");
|
throw new Exception("Quality must be between 1 and 100.");
|
||||||
int dashIndex = argv[1].indexOf('-');
|
if (quals.length > 1) {
|
||||||
if (dashIndex > 0 && argv[1].length() > dashIndex + 1) {
|
|
||||||
try {
|
try {
|
||||||
maxQual = Integer.parseInt(argv[1].substring(dashIndex + 1));
|
maxQual = Integer.parseInt(quals[1]);
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {}
|
||||||
}
|
}
|
||||||
if (maxQual < 1 || maxQual > 100)
|
if (maxQual < 1 || maxQual > 100 || maxQual < minQual)
|
||||||
maxQual = minQual;
|
maxQual = minQual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user