summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jpegli
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jpeg-xl/lib/jpegli')
-rw-r--r--third_party/jpeg-xl/lib/jpegli/color_transform.cc6
-rw-r--r--third_party/jpeg-xl/lib/jpegli/decode.h2
-rw-r--r--third_party/jpeg-xl/lib/jpegli/decode_api_test.cc13
-rw-r--r--third_party/jpeg-xl/lib/jpegli/destination_manager.cc4
-rw-r--r--third_party/jpeg-xl/lib/jpegli/encode.h2
-rw-r--r--third_party/jpeg-xl/lib/jpegli/encode_api_test.cc12
-rw-r--r--third_party/jpeg-xl/lib/jpegli/error_handling_test.cc78
-rw-r--r--third_party/jpeg-xl/lib/jpegli/input_suspension_test.cc3
-rw-r--r--third_party/jpeg-xl/lib/jpegli/libjpeg_wrapper.cc4
-rw-r--r--third_party/jpeg-xl/lib/jpegli/source_manager.cc7
-rw-r--r--third_party/jpeg-xl/lib/jpegli/source_manager_test.cc2
-rw-r--r--third_party/jpeg-xl/lib/jpegli/streaming_test.cc3
-rw-r--r--third_party/jpeg-xl/lib/jpegli/test_utils.cc2
-rw-r--r--third_party/jpeg-xl/lib/jpegli/transcode_api_test.cc2
14 files changed, 75 insertions, 65 deletions
diff --git a/third_party/jpeg-xl/lib/jpegli/color_transform.cc b/third_party/jpeg-xl/lib/jpegli/color_transform.cc
index 020a6fd80c..60a0dc83bb 100644
--- a/third_party/jpeg-xl/lib/jpegli/color_transform.cc
+++ b/third_party/jpeg-xl/lib/jpegli/color_transform.cc
@@ -135,19 +135,25 @@ bool CheckColorSpaceComponents(int num_components, J_COLOR_SPACE colorspace) {
return num_components == 1;
case JCS_RGB:
case JCS_YCbCr:
+#ifdef JCS_EXTENSIONS
case JCS_EXT_RGB:
case JCS_EXT_BGR:
+#endif
return num_components == 3;
case JCS_CMYK:
case JCS_YCCK:
+#ifdef JCS_EXTENSIONS
case JCS_EXT_RGBX:
case JCS_EXT_BGRX:
case JCS_EXT_XBGR:
case JCS_EXT_XRGB:
+#endif
+#ifdef JCS_ALPHA_EXTENSIONS
case JCS_EXT_RGBA:
case JCS_EXT_BGRA:
case JCS_EXT_ABGR:
case JCS_EXT_ARGB:
+#endif
return num_components == 4;
default:
// Unrecognized colorspaces can have any number of channels, since no
diff --git a/third_party/jpeg-xl/lib/jpegli/decode.h b/third_party/jpeg-xl/lib/jpegli/decode.h
index 9800ebf67a..f5b099eda3 100644
--- a/third_party/jpeg-xl/lib/jpegli/decode.h
+++ b/third_party/jpeg-xl/lib/jpegli/decode.h
@@ -36,7 +36,7 @@ void jpegli_CreateDecompress(j_decompress_ptr cinfo, int version,
void jpegli_stdio_src(j_decompress_ptr cinfo, FILE *infile);
void jpegli_mem_src(j_decompress_ptr cinfo, const unsigned char *inbuffer,
- unsigned long insize);
+ unsigned long insize /* NOLINT */);
int jpegli_read_header(j_decompress_ptr cinfo, boolean require_image);
diff --git a/third_party/jpeg-xl/lib/jpegli/decode_api_test.cc b/third_party/jpeg-xl/lib/jpegli/decode_api_test.cc
index 0cc5a194d7..3ecd479951 100644
--- a/third_party/jpeg-xl/lib/jpegli/decode_api_test.cc
+++ b/third_party/jpeg-xl/lib/jpegli/decode_api_test.cc
@@ -3,8 +3,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-#include <cmath>
#include <cstdint>
+#include <cstdio>
#include <vector>
#include "lib/jpegli/decode.h"
@@ -78,7 +78,8 @@ class SourceManager {
return TRUE;
}
- static void skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
+ static void skip_input_data(j_decompress_ptr cinfo,
+ long num_bytes /* NOLINT */) {
auto* src = reinterpret_cast<SourceManager*>(cinfo->src);
if (num_bytes <= 0) {
return;
@@ -447,7 +448,7 @@ std::vector<TestConfig> GenerateBasicConfigs() {
TEST(DecodeAPITest, ReuseCinfoSameMemSource) {
std::vector<TestConfig> all_configs = GenerateBasicConfigs();
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
{
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
@@ -502,7 +503,7 @@ TEST(DecodeAPITest, ReuseCinfoSameStdSource) {
EXPECT_TRUE(try_catch_block());
jpegli_destroy_compress(&cinfo);
}
- rewind(tmpf);
+ fseek(tmpf, 0, SEEK_SET);
std::vector<TestImage> all_outputs(all_configs.size());
{
jpeg_decompress_struct cinfo;
@@ -527,9 +528,9 @@ TEST(DecodeAPITest, ReuseCinfoSameStdSource) {
TEST(DecodeAPITest, AbbreviatedStreams) {
uint8_t* table_stream = nullptr;
- unsigned long table_stream_size = 0;
+ unsigned long table_stream_size = 0; // NOLINT
uint8_t* data_stream = nullptr;
- unsigned long data_stream_size = 0;
+ unsigned long data_stream_size = 0; // NOLINT
{
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
diff --git a/third_party/jpeg-xl/lib/jpegli/destination_manager.cc b/third_party/jpeg-xl/lib/jpegli/destination_manager.cc
index 6548130866..05d35797b8 100644
--- a/third_party/jpeg-xl/lib/jpegli/destination_manager.cc
+++ b/third_party/jpeg-xl/lib/jpegli/destination_manager.cc
@@ -52,7 +52,7 @@ struct MemoryDestinationManager {
jpeg_destination_mgr pub;
// Output buffer supplied by the application
uint8_t** output;
- unsigned long* output_size;
+ unsigned long* output_size; // NOLINT
// Output buffer allocated by us.
uint8_t* temp_buffer;
// Current output buffer (either application supplied or allocated by us).
@@ -113,7 +113,7 @@ void jpegli_stdio_dest(j_compress_ptr cinfo, FILE* outfile) {
}
void jpegli_mem_dest(j_compress_ptr cinfo, unsigned char** outbuffer,
- unsigned long* outsize) {
+ unsigned long* outsize /* NOLINT */) {
if (outbuffer == nullptr || outsize == nullptr) {
JPEGLI_ERROR("jpegli_mem_dest: Invalid destination.");
}
diff --git a/third_party/jpeg-xl/lib/jpegli/encode.h b/third_party/jpeg-xl/lib/jpegli/encode.h
index 320dfaaf8d..ed34838450 100644
--- a/third_party/jpeg-xl/lib/jpegli/encode.h
+++ b/third_party/jpeg-xl/lib/jpegli/encode.h
@@ -35,7 +35,7 @@ void jpegli_CreateCompress(j_compress_ptr cinfo, int version,
void jpegli_stdio_dest(j_compress_ptr cinfo, FILE* outfile);
void jpegli_mem_dest(j_compress_ptr cinfo, unsigned char** outbuffer,
- unsigned long* outsize);
+ unsigned long* outsize /* NOLINT */);
void jpegli_set_defaults(j_compress_ptr cinfo);
diff --git a/third_party/jpeg-xl/lib/jpegli/encode_api_test.cc b/third_party/jpeg-xl/lib/jpegli/encode_api_test.cc
index 1afdcf610d..2978b3f35d 100644
--- a/third_party/jpeg-xl/lib/jpegli/encode_api_test.cc
+++ b/third_party/jpeg-xl/lib/jpegli/encode_api_test.cc
@@ -69,7 +69,7 @@ TEST(EncodeAPITest, ReuseCinfoSameImageTwice) {
CompressParams jparams;
GenerateInput(PIXELS, jparams, &input);
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
std::vector<uint8_t> compressed0;
std::vector<uint8_t> compressed1;
jpeg_compress_struct cinfo;
@@ -117,7 +117,7 @@ std::vector<TestConfig> GenerateBasicConfigs() {
TEST(EncodeAPITest, ReuseCinfoSameMemOutput) {
std::vector<TestConfig> all_configs = GenerateBasicConfigs();
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
{
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
@@ -161,7 +161,7 @@ TEST(EncodeAPITest, ReuseCinfoSameStdOutput) {
jpegli_destroy_compress(&cinfo);
}
size_t total_size = ftell(tmpf);
- rewind(tmpf);
+ fseek(tmpf, 0, SEEK_SET);
std::vector<uint8_t> compressed(total_size);
JXL_CHECK(total_size == fread(compressed.data(), 1, total_size, tmpf));
fclose(tmpf);
@@ -181,7 +181,7 @@ TEST(EncodeAPITest, ReuseCinfoChangeParams) {
CompressParams jparams;
DecompressParams dparams;
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
std::vector<uint8_t> compressed;
jpeg_compress_struct cinfo;
const auto max_rms = [](int q, int hs, int vs) {
@@ -246,9 +246,9 @@ TEST(EncodeAPITest, ReuseCinfoChangeParams) {
TEST(EncodeAPITest, AbbreviatedStreams) {
uint8_t* table_stream = nullptr;
- unsigned long table_stream_size = 0;
+ unsigned long table_stream_size = 0; // NOLINT
uint8_t* data_stream = nullptr;
- unsigned long data_stream_size = 0;
+ unsigned long data_stream_size = 0; // NOLINT
{
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
diff --git a/third_party/jpeg-xl/lib/jpegli/error_handling_test.cc b/third_party/jpeg-xl/lib/jpegli/error_handling_test.cc
index 3eaf6a313b..bcd7355124 100644
--- a/third_party/jpeg-xl/lib/jpegli/error_handling_test.cc
+++ b/third_party/jpeg-xl/lib/jpegli/error_handling_test.cc
@@ -15,7 +15,7 @@ namespace {
TEST(EncoderErrorHandlingTest, MinimalSuccess) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
{
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
@@ -64,7 +64,7 @@ TEST(EncoderErrorHandlingTest, NoDestination) {
TEST(EncoderErrorHandlingTest, NoImageDimensions) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -82,7 +82,7 @@ TEST(EncoderErrorHandlingTest, NoImageDimensions) {
TEST(EncoderErrorHandlingTest, ImageTooBig) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -102,7 +102,7 @@ TEST(EncoderErrorHandlingTest, ImageTooBig) {
TEST(EncoderErrorHandlingTest, NoInputComponents) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -121,7 +121,7 @@ TEST(EncoderErrorHandlingTest, NoInputComponents) {
TEST(EncoderErrorHandlingTest, TooManyInputComponents) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -141,7 +141,7 @@ TEST(EncoderErrorHandlingTest, TooManyInputComponents) {
TEST(EncoderErrorHandlingTest, NoSetDefaults) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -164,7 +164,7 @@ TEST(EncoderErrorHandlingTest, NoSetDefaults) {
TEST(EncoderErrorHandlingTest, NoStartCompress) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -186,7 +186,7 @@ TEST(EncoderErrorHandlingTest, NoStartCompress) {
TEST(EncoderErrorHandlingTest, NoWriteScanlines) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -207,7 +207,7 @@ TEST(EncoderErrorHandlingTest, NoWriteScanlines) {
TEST(EncoderErrorHandlingTest, NoWriteAllScanlines) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -231,7 +231,7 @@ TEST(EncoderErrorHandlingTest, NoWriteAllScanlines) {
TEST(EncoderErrorHandlingTest, InvalidQuantValue) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -260,7 +260,7 @@ TEST(EncoderErrorHandlingTest, InvalidQuantValue) {
TEST(EncoderErrorHandlingTest, InvalidQuantTableIndex) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -285,7 +285,7 @@ TEST(EncoderErrorHandlingTest, InvalidQuantTableIndex) {
TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch1) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -306,7 +306,7 @@ TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch1) {
TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch2) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -327,7 +327,7 @@ TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch2) {
TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch3) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -353,7 +353,7 @@ TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch3) {
TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch4) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -378,7 +378,7 @@ TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch4) {
TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch5) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -403,7 +403,7 @@ TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch5) {
TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch6) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -429,7 +429,7 @@ TEST(EncoderErrorHandlingTest, NumberOfComponentsMismatch6) {
TEST(EncoderErrorHandlingTest, InvalidColorTransform) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -455,7 +455,7 @@ TEST(EncoderErrorHandlingTest, InvalidColorTransform) {
TEST(EncoderErrorHandlingTest, DuplicateComponentIds) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -477,7 +477,7 @@ TEST(EncoderErrorHandlingTest, DuplicateComponentIds) {
TEST(EncoderErrorHandlingTest, InvalidComponentIndex) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -498,7 +498,7 @@ TEST(EncoderErrorHandlingTest, InvalidComponentIndex) {
TEST(EncoderErrorHandlingTest, ArithmeticCoding) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -519,7 +519,7 @@ TEST(EncoderErrorHandlingTest, ArithmeticCoding) {
TEST(EncoderErrorHandlingTest, CCIR601Sampling) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -540,7 +540,7 @@ TEST(EncoderErrorHandlingTest, CCIR601Sampling) {
TEST(EncoderErrorHandlingTest, InvalidScanScript1) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -563,7 +563,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript1) {
TEST(EncoderErrorHandlingTest, InvalidScanScript2) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -586,7 +586,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript2) {
TEST(EncoderErrorHandlingTest, InvalidScanScript3) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -609,7 +609,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript3) {
TEST(EncoderErrorHandlingTest, InvalidScanScript4) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -632,7 +632,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript4) {
TEST(EncoderErrorHandlingTest, InvalidScanScript5) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -655,7 +655,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript5) {
TEST(EncoderErrorHandlingTest, InvalidScanScript6) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -678,7 +678,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript6) {
TEST(EncoderErrorHandlingTest, InvalidScanScript7) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -701,7 +701,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript7) {
TEST(EncoderErrorHandlingTest, InvalidScanScript8) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -726,7 +726,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript8) {
TEST(EncoderErrorHandlingTest, InvalidScanScript9) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -751,7 +751,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript9) {
TEST(EncoderErrorHandlingTest, InvalidScanScript10) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -776,7 +776,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript10) {
TEST(EncoderErrorHandlingTest, InvalidScanScript11) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -801,7 +801,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript11) {
TEST(EncoderErrorHandlingTest, InvalidScanScript12) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -826,7 +826,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript12) {
TEST(EncoderErrorHandlingTest, InvalidScanScript13) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -854,7 +854,7 @@ TEST(EncoderErrorHandlingTest, InvalidScanScript13) {
TEST(EncoderErrorHandlingTest, MCUSizeTooBig) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -877,7 +877,7 @@ TEST(EncoderErrorHandlingTest, MCUSizeTooBig) {
TEST(EncoderErrorHandlingTest, RestartIntervalTooBig) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -898,7 +898,7 @@ TEST(EncoderErrorHandlingTest, RestartIntervalTooBig) {
TEST(EncoderErrorHandlingTest, SamplingFactorTooBig) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
@@ -919,7 +919,7 @@ TEST(EncoderErrorHandlingTest, SamplingFactorTooBig) {
TEST(EncoderErrorHandlingTest, NonIntegralSamplingRatio) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
diff --git a/third_party/jpeg-xl/lib/jpegli/input_suspension_test.cc b/third_party/jpeg-xl/lib/jpegli/input_suspension_test.cc
index eb8b7ebc26..6546b7b087 100644
--- a/third_party/jpeg-xl/lib/jpegli/input_suspension_test.cc
+++ b/third_party/jpeg-xl/lib/jpegli/input_suspension_test.cc
@@ -80,7 +80,8 @@ struct SourceManager {
static boolean fill_input_buffer(j_decompress_ptr cinfo) { return FALSE; }
- static void skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
+ static void skip_input_data(j_decompress_ptr cinfo,
+ long num_bytes /* NOLINT*/) {
auto* src = reinterpret_cast<SourceManager*>(cinfo->src);
if (num_bytes <= 0) {
return;
diff --git a/third_party/jpeg-xl/lib/jpegli/libjpeg_wrapper.cc b/third_party/jpeg-xl/lib/jpegli/libjpeg_wrapper.cc
index 471b7c7192..a2b333afef 100644
--- a/third_party/jpeg-xl/lib/jpegli/libjpeg_wrapper.cc
+++ b/third_party/jpeg-xl/lib/jpegli/libjpeg_wrapper.cc
@@ -38,7 +38,7 @@ void jpeg_stdio_src(j_decompress_ptr cinfo, FILE *infile) {
}
void jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *inbuffer,
- unsigned long insize) {
+ unsigned long insize /* NOLINT */) {
jpegli_mem_src(cinfo, inbuffer, insize);
}
@@ -138,7 +138,7 @@ void jpeg_stdio_dest(j_compress_ptr cinfo, FILE *outfile) {
}
void jpeg_mem_dest(j_compress_ptr cinfo, unsigned char **outbuffer,
- unsigned long *outsize) {
+ unsigned long *outsize /* NOLINT */) {
jpegli_mem_dest(cinfo, outbuffer, outsize);
}
diff --git a/third_party/jpeg-xl/lib/jpegli/source_manager.cc b/third_party/jpeg-xl/lib/jpegli/source_manager.cc
index 58adf803b1..e0f0b4c275 100644
--- a/third_party/jpeg-xl/lib/jpegli/source_manager.cc
+++ b/third_party/jpeg-xl/lib/jpegli/source_manager.cc
@@ -12,9 +12,10 @@ namespace jpegli {
void init_mem_source(j_decompress_ptr cinfo) {}
void init_stdio_source(j_decompress_ptr cinfo) {}
-void skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
+void skip_input_data(j_decompress_ptr cinfo, long num_bytes /* NOLINT */) {
if (num_bytes <= 0) return;
- while (num_bytes > static_cast<long>(cinfo->src->bytes_in_buffer)) {
+ while (num_bytes >
+ static_cast<long>(cinfo->src->bytes_in_buffer)) { // NOLINT
num_bytes -= cinfo->src->bytes_in_buffer;
(*cinfo->src->fill_input_buffer)(cinfo);
}
@@ -53,7 +54,7 @@ struct StdioSourceManager {
} // namespace jpegli
void jpegli_mem_src(j_decompress_ptr cinfo, const unsigned char* inbuffer,
- unsigned long insize) {
+ unsigned long insize /* NOLINT */) {
if (cinfo->src && cinfo->src->init_source != jpegli::init_mem_source) {
JPEGLI_ERROR("jpegli_mem_src: a different source manager was already set");
}
diff --git a/third_party/jpeg-xl/lib/jpegli/source_manager_test.cc b/third_party/jpeg-xl/lib/jpegli/source_manager_test.cc
index 59d12b001b..a513b7063b 100644
--- a/third_party/jpeg-xl/lib/jpegli/source_manager_test.cc
+++ b/third_party/jpeg-xl/lib/jpegli/source_manager_test.cc
@@ -43,7 +43,7 @@ FILE* MemOpen(const std::vector<uint8_t>& data) {
FILE* src = tmpfile();
if (!src) return nullptr;
fwrite(data.data(), 1, data.size(), src);
- rewind(src);
+ fseek(src, 0, SEEK_SET);
return src;
}
} // namespace
diff --git a/third_party/jpeg-xl/lib/jpegli/streaming_test.cc b/third_party/jpeg-xl/lib/jpegli/streaming_test.cc
index 2e6f7029b0..1f19dc2045 100644
--- a/third_party/jpeg-xl/lib/jpegli/streaming_test.cc
+++ b/third_party/jpeg-xl/lib/jpegli/streaming_test.cc
@@ -28,7 +28,8 @@ struct SourceManager {
static void init_source(j_decompress_ptr cinfo) {}
static boolean fill_input_buffer(j_decompress_ptr cinfo) { return FALSE; }
- static void skip_input_data(j_decompress_ptr cinfo, long num_bytes) {}
+ static void skip_input_data(j_decompress_ptr cinfo,
+ long num_bytes /* NOLINT */) {}
static void term_source(j_decompress_ptr cinfo) {}
};
diff --git a/third_party/jpeg-xl/lib/jpegli/test_utils.cc b/third_party/jpeg-xl/lib/jpegli/test_utils.cc
index 4e675070cf..db5a30e8dc 100644
--- a/third_party/jpeg-xl/lib/jpegli/test_utils.cc
+++ b/third_party/jpeg-xl/lib/jpegli/test_utils.cc
@@ -673,7 +673,7 @@ void EncodeWithJpegli(const TestImage& input, const CompressParams& jparams,
bool EncodeWithJpegli(const TestImage& input, const CompressParams& jparams,
std::vector<uint8_t>* compressed) {
uint8_t* buffer = nullptr;
- unsigned long buffer_size = 0;
+ unsigned long buffer_size = 0; // NOLINT
jpeg_compress_struct cinfo;
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
diff --git a/third_party/jpeg-xl/lib/jpegli/transcode_api_test.cc b/third_party/jpeg-xl/lib/jpegli/transcode_api_test.cc
index 1d99ce37fa..13c81a1119 100644
--- a/third_party/jpeg-xl/lib/jpegli/transcode_api_test.cc
+++ b/third_party/jpeg-xl/lib/jpegli/transcode_api_test.cc
@@ -20,7 +20,7 @@ void TranscodeWithJpegli(const std::vector<uint8_t>& jpeg_input,
jpeg_decompress_struct dinfo = {};
jpeg_compress_struct cinfo = {};
uint8_t* transcoded_data = nullptr;
- unsigned long transcoded_size;
+ unsigned long transcoded_size; // NOLINT
const auto try_catch_block = [&]() -> bool {
ERROR_HANDLER_SETUP(jpegli);
dinfo.err = cinfo.err;