From ea25ea0ad9712c7210fa72d19591d47c203c9a5d Mon Sep 17 00:00:00 2001 From: Eric CHASSEUR Date: Tue, 19 Apr 2022 10:46:21 +0200 Subject: [PATCH] WARNINGS: fix against set of -W options (#38) * make __attribute__((fallthrough)) more portable for GCC (>= 7) and CLANG (>= 10) --- source/lib/common/private/gpr_buffer.c | 3 +- source/lib/common/private/log.c | 4 +-- source/lib/common/private/log.h | 4 +-- source/lib/dng_sdk/dng_lossless_jpeg.cpp | 2 +- source/lib/dng_sdk/dng_misc_opcodes.h | 8 ++--- source/lib/dng_sdk/dng_negative.cpp | 2 +- source/lib/dng_sdk/dng_resample.h | 2 +- source/lib/expat_lib/internal.h | 6 ++++ source/lib/expat_lib/xmlparse.c | 12 ++++++-- source/lib/expat_lib/xmltok.c | 37 ++++++++++++++++-------- source/lib/expat_lib/xmltok_impl.c | 18 ++++++++++-- source/lib/tiny_jpeg/tiny_jpeg.h | 7 +++++ source/lib/vc5_common/companding.h | 2 +- source/lib/vc5_common/logcurve.c | 4 +-- source/lib/vc5_common/logcurve.h | 4 +-- source/lib/vc5_common/stream.c | 4 +-- source/lib/vc5_encoder/component.c | 1 - source/lib/vc5_encoder/encoder.c | 16 +++++----- source/lib/vc5_encoder/vlc.c | 2 +- 19 files changed, 91 insertions(+), 47 deletions(-) diff --git a/source/lib/common/private/gpr_buffer.c b/source/lib/common/private/gpr_buffer.c index 35badba..083bc0d 100755 --- a/source/lib/common/private/gpr_buffer.c +++ b/source/lib/common/private/gpr_buffer.c @@ -46,8 +46,7 @@ int read_from_file(gpr_buffer* buffer, const char* file_path, gpr_malloc malloc_ return -1; } - long result = fread(buffer->buffer, 1, buffer->size, fIN); - if (result != buffer->size) + if (fread(buffer->buffer, 1, buffer->size, fIN) != buffer->size) { free_function(buffer->buffer); fputs ("Reading error", stderr); diff --git a/source/lib/common/private/log.c b/source/lib/common/private/log.c index 99dcd18..751ff6d 100755 --- a/source/lib/common/private/log.c +++ b/source/lib/common/private/log.c @@ -23,7 +23,7 @@ TIMER LogTimer; -bool LogInit() +bool LogInit(void) { InitTimer(&LogTimer); @@ -54,7 +54,7 @@ int LogPrint(const char* format, ... ) } #endif // LogPrint -bool LogUninit() +bool LogUninit(void) { return true; } diff --git a/source/lib/common/private/log.h b/source/lib/common/private/log.h index 51c882d..76e8879 100755 --- a/source/lib/common/private/log.h +++ b/source/lib/common/private/log.h @@ -25,13 +25,13 @@ extern "C" { #endif - bool LogInit(); + bool LogInit(void); #ifndef LogPrint int LogPrint(const char* format, ... ); #endif - bool LogUninit(); + bool LogUninit(void); #define TIMESTAMP(x, y) TIMESTAMP_##y(x) diff --git a/source/lib/dng_sdk/dng_lossless_jpeg.cpp b/source/lib/dng_sdk/dng_lossless_jpeg.cpp index 2b52983..b841352 100644 --- a/source/lib/dng_sdk/dng_lossless_jpeg.cpp +++ b/source/lib/dng_sdk/dng_lossless_jpeg.cpp @@ -1670,7 +1670,7 @@ inline void dng_lossless_decoder::HuffExtend (int32 &x, int32 s) if (x < (0x08000 >> (16 - s))) { - x += (-1 << s) + 1; + x += -(1 << s) + 1; } } diff --git a/source/lib/dng_sdk/dng_misc_opcodes.h b/source/lib/dng_sdk/dng_misc_opcodes.h index a211a9a..7a1268a 100644 --- a/source/lib/dng_sdk/dng_misc_opcodes.h +++ b/source/lib/dng_sdk/dng_misc_opcodes.h @@ -106,28 +106,28 @@ class dng_area_spec /// The first plane. - const uint32 Plane () const + uint32 Plane () const { return fPlane; } /// The total number of planes. - const uint32 Planes () const + uint32 Planes () const { return fPlanes; } /// The row pitch (i.e., stride). A pitch of 1 means all rows. - const uint32 RowPitch () const + uint32 RowPitch () const { return fRowPitch; } /// The column pitch (i.e., stride). A pitch of 1 means all columns. - const uint32 ColPitch () const + uint32 ColPitch () const { return fColPitch; } diff --git a/source/lib/dng_sdk/dng_negative.cpp b/source/lib/dng_sdk/dng_negative.cpp index 9c3fa7d..9430287 100644 --- a/source/lib/dng_sdk/dng_negative.cpp +++ b/source/lib/dng_sdk/dng_negative.cpp @@ -2716,7 +2716,7 @@ void dng_negative::SetFujiMosaic6x6 (uint32 phase) info.fCFAPattern [5] [4] = color2; info.fCFAPattern [5] [5] = color1; - DNG_REQUIRE (phase >= 0 && phase < patSize * patSize, + DNG_REQUIRE (phase < patSize * patSize, "Bad phase in SetFujiMosaic6x6."); if (phase > 0) diff --git a/source/lib/dng_sdk/dng_resample.h b/source/lib/dng_sdk/dng_resample.h index 07f42ef..c6bc6f9 100644 --- a/source/lib/dng_sdk/dng_resample.h +++ b/source/lib/dng_sdk/dng_resample.h @@ -95,7 +95,7 @@ class dng_resample_coords return fCoords->Buffer_int32 () + (index - fOrigin); } - const int32 Pixel (int32 index) const + int32 Pixel (int32 index) const { return Coords (index) [0] >> kResampleSubsampleBits; } diff --git a/source/lib/expat_lib/internal.h b/source/lib/expat_lib/internal.h index dd54548..9ee06af 100644 --- a/source/lib/expat_lib/internal.h +++ b/source/lib/expat_lib/internal.h @@ -34,6 +34,12 @@ #define PTRFASTCALL __attribute__((regparm(3))) #endif +#if defined(__GNUC__) && __GNUC__ >= 7 || defined(__clang__) && __clang_major__ >= 10 +#define FALL_THROUGH __attribute__ ((fallthrough)) +#else +#define FALL_THROUGH ((void)0) +#endif + /* Using __fastcall seems to have an unexpected negative effect under MS VC++, especially for function pointers, so we won't use it for now on that platform. It may be reconsidered for a future release diff --git a/source/lib/expat_lib/xmlparse.c b/source/lib/expat_lib/xmlparse.c index 760d17d..22a33a8 100644 --- a/source/lib/expat_lib/xmlparse.c +++ b/source/lib/expat_lib/xmlparse.c @@ -1502,6 +1502,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) errorCode = XML_ERROR_NO_MEMORY; return XML_STATUS_ERROR; } + FALL_THROUGH; default: ps_parsing = XML_PARSING; } @@ -1528,6 +1529,7 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) case XML_INITIALIZED: case XML_PARSING: ps_parsing = XML_FINISHED; + FALL_THROUGH; /* fall through */ default: return XML_STATUS_OK; @@ -1564,7 +1566,8 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) ps_parsing = XML_FINISHED; return XML_STATUS_OK; } - /* fall through */ + FALL_THROUGH; + /* fall through */ default: result = XML_STATUS_OK; } @@ -1628,6 +1631,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal) errorCode = XML_ERROR_NO_MEMORY; return XML_STATUS_ERROR; } + FALL_THROUGH; default: ps_parsing = XML_PARSING; } @@ -2370,7 +2374,6 @@ doContent(XML_Parser parser, break; } case XML_TOK_START_TAG_NO_ATTS: - /* fall through */ case XML_TOK_START_TAG_WITH_ATTS: { TAG *tag; @@ -2439,7 +2442,6 @@ doContent(XML_Parser parser, break; } case XML_TOK_EMPTY_ELEMENT_NO_ATTS: - /* fall through */ case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: { const char *rawName = s + enc->minBytesPerChar; @@ -3895,6 +3897,7 @@ doProlog(XML_Parser parser, handleDefault = XML_FALSE; goto alreadyChecked; } + FALL_THROUGH; /* fall through */ case XML_ROLE_ENTITY_PUBLIC_ID: if (!XmlIsPublicId(enc, s, next, eventPP)) @@ -4197,6 +4200,7 @@ doProlog(XML_Parser parser, return XML_ERROR_NO_MEMORY; declEntity->publicId = NULL; } + FALL_THROUGH; /* fall through */ #endif /* XML_DTD */ case XML_ROLE_ENTITY_SYSTEM_ID: @@ -4977,6 +4981,7 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, break; case XML_TOK_TRAILING_CR: next = ptr + enc->minBytesPerChar; + FALL_THROUGH; /* fall through */ case XML_TOK_ATTRIBUTE_VALUE_S: case XML_TOK_DATA_NEWLINE: @@ -5181,6 +5186,7 @@ storeEntityValue(XML_Parser parser, break; case XML_TOK_TRAILING_CR: next = entityTextPtr + enc->minBytesPerChar; + FALL_THROUGH; /* fall through */ case XML_TOK_DATA_NEWLINE: if (pool->end == pool->ptr && !poolGrow(pool)) { diff --git a/source/lib/expat_lib/xmltok.c b/source/lib/expat_lib/xmltok.c index bf09dfc..c2e5e8c 100644 --- a/source/lib/expat_lib/xmltok.c +++ b/source/lib/expat_lib/xmltok.c @@ -222,6 +222,17 @@ struct normal_encoding { E ## isInvalid3, \ E ## isInvalid4 +#define EMPTY_VTABLE \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL, \ + NULL + static int FASTCALL checkCharRefNumber(int); #include "xmltok_impl.h" @@ -467,7 +478,7 @@ static const struct normal_encoding latin1_encoding_ns = { #include "asciitab.h" #include "latin1tab.h" }, - STANDARD_VTABLE(sb_) + STANDARD_VTABLE(sb_) EMPTY_VTABLE }; #endif @@ -480,7 +491,7 @@ static const struct normal_encoding latin1_encoding = { #undef BT_COLON #include "latin1tab.h" }, - STANDARD_VTABLE(sb_) + STANDARD_VTABLE(sb_) EMPTY_VTABLE }; static void PTRCALL @@ -500,7 +511,7 @@ static const struct normal_encoding ascii_encoding_ns = { #include "asciitab.h" /* BT_NONXML == 0 */ }, - STANDARD_VTABLE(sb_) + STANDARD_VTABLE(sb_) EMPTY_VTABLE }; #endif @@ -513,7 +524,7 @@ static const struct normal_encoding ascii_encoding = { #undef BT_COLON /* BT_NONXML == 0 */ }, - STANDARD_VTABLE(sb_) + STANDARD_VTABLE(sb_) EMPTY_VTABLE }; static int PTRFASTCALL @@ -557,6 +568,7 @@ E ## toUtf8(const ENCODING *enc, \ *(*toP)++ = lo; \ break; \ } \ + __attribute((fallthrough)); \ /* fall through */ \ case 0x1: case 0x2: case 0x3: \ case 0x4: case 0x5: case 0x6: case 0x7: \ @@ -726,7 +738,7 @@ static const struct normal_encoding little2_encoding_ns = { #include "asciitab.h" #include "latin1tab.h" }, - STANDARD_VTABLE(little2_) + STANDARD_VTABLE(little2_) EMPTY_VTABLE }; #endif @@ -745,7 +757,7 @@ static const struct normal_encoding little2_encoding = { #undef BT_COLON #include "latin1tab.h" }, - STANDARD_VTABLE(little2_) + STANDARD_VTABLE(little2_) EMPTY_VTABLE }; #if BYTEORDER != 4321 @@ -758,7 +770,7 @@ static const struct normal_encoding internal_little2_encoding_ns = { #include "iasciitab.h" #include "latin1tab.h" }, - STANDARD_VTABLE(little2_) + STANDARD_VTABLE(little2_) EMPTY_VTABLE }; #endif @@ -771,7 +783,7 @@ static const struct normal_encoding internal_little2_encoding = { #undef BT_COLON #include "latin1tab.h" }, - STANDARD_VTABLE(little2_) + STANDARD_VTABLE(little2_) EMPTY_VTABLE }; #endif @@ -867,7 +879,7 @@ static const struct normal_encoding big2_encoding_ns = { #include "asciitab.h" #include "latin1tab.h" }, - STANDARD_VTABLE(big2_) + STANDARD_VTABLE(big2_) EMPTY_VTABLE }; #endif @@ -886,7 +898,7 @@ static const struct normal_encoding big2_encoding = { #undef BT_COLON #include "latin1tab.h" }, - STANDARD_VTABLE(big2_) + STANDARD_VTABLE(big2_) EMPTY_VTABLE }; #if BYTEORDER != 1234 @@ -899,7 +911,7 @@ static const struct normal_encoding internal_big2_encoding_ns = { #include "iasciitab.h" #include "latin1tab.h" }, - STANDARD_VTABLE(big2_) + STANDARD_VTABLE(big2_) EMPTY_VTABLE }; #endif @@ -912,7 +924,7 @@ static const struct normal_encoding internal_big2_encoding = { #undef BT_COLON #include "latin1tab.h" }, - STANDARD_VTABLE(big2_) + STANDARD_VTABLE(big2_) EMPTY_VTABLE }; #endif @@ -1528,6 +1540,7 @@ initScan(const ENCODING * const *encodingTable, if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE) break; + __attribute((fallthrough)); /* fall through */ case 0x00: case 0x3C: diff --git a/source/lib/expat_lib/xmltok_impl.c b/source/lib/expat_lib/xmltok_impl.c index 9c2895b..41679ea 100644 --- a/source/lib/expat_lib/xmltok_impl.c +++ b/source/lib/expat_lib/xmltok_impl.c @@ -47,6 +47,7 @@ *nextTokPtr = ptr; \ return XML_TOK_INVALID; \ } \ + __attribute((fallthrough)); \ case BT_NMSTRT: \ case BT_HEX: \ case BT_DIGIT: \ @@ -75,6 +76,7 @@ *nextTokPtr = ptr; \ return XML_TOK_INVALID; \ } \ + __attribute((fallthrough)); \ case BT_NMSTRT: \ case BT_HEX: \ ptr += MINBPC(enc); \ @@ -158,6 +160,7 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, *nextTokPtr = ptr; return XML_TOK_INVALID; } + FALL_THROUGH; /* fall through */ case BT_S: case BT_CR: case BT_LF: *nextTokPtr = ptr; @@ -272,6 +275,7 @@ PREFIX(scanPi)(const ENCODING *enc, const char *ptr, *nextTokPtr = ptr + MINBPC(enc); return tok; } + FALL_THROUGH; /* fall through */ default: *nextTokPtr = ptr; @@ -570,7 +574,8 @@ PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end, return XML_TOK_INVALID; } } - /* fall through */ + FALL_THROUGH; + /* fall through */ case BT_EQUALS: { int open; @@ -859,6 +864,7 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, return XML_TOK_INVALID; } } + FALL_THROUGH; /* fall through */ case BT_AMP: case BT_LT: @@ -1017,6 +1023,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, /* indicate that this might be part of a CR/LF pair */ return -XML_TOK_PROLOG_S; } + FALL_THROUGH; /* fall through */ case BT_S: case BT_LF: for (;;) { @@ -1030,6 +1037,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, /* don't split CR/LF pair */ if (ptr + MINBPC(enc) != end) break; + FALL_THROUGH; /* fall through */ default: *nextTokPtr = ptr; @@ -1136,6 +1144,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, tok = XML_TOK_NMTOKEN; break; } + FALL_THROUGH; /* fall through */ default: *nextTokPtr = ptr; @@ -1407,6 +1416,7 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, case BT_NMSTRT: if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) break; + FALL_THROUGH; default: switch (BYTE_TO_ASCII(enc, ptr)) { case 0x24: /* $ */ @@ -1627,7 +1637,11 @@ PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) case BT_LEAD ## n: \ if (*ptr1++ != *ptr2++) \ return 0; - LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) + LEAD_CASE(4) + FALL_THROUGH; + LEAD_CASE(3) + FALL_THROUGH; + LEAD_CASE(2) #undef LEAD_CASE /* fall through */ if (*ptr1++ != *ptr2++) diff --git a/source/lib/tiny_jpeg/tiny_jpeg.h b/source/lib/tiny_jpeg/tiny_jpeg.h index 1ea51cc..e9ab0f7 100644 --- a/source/lib/tiny_jpeg/tiny_jpeg.h +++ b/source/lib/tiny_jpeg/tiny_jpeg.h @@ -90,6 +90,12 @@ extern "C" #pragma GCC diagnostic ignored "-Wpadded" #endif +#if defined(__GNUC__) && __GNUC__ >= 7 || defined(__clang__) && __clang_major__ >= 10 +#define FALL_THROUGH __attribute__ ((fallthrough)) +#else +#define FALL_THROUGH ((void)0) +#endif + // ============================================================ // Public interface: // ============================================================ @@ -1254,6 +1260,7 @@ int tje_encode_with_func(tje_write_func* func, break; case 2: qt_factor = 10; + FALL_THROUGH; // don't break. fall through. case 1: for ( i = 0; i < 64; ++i ) { diff --git a/source/lib/vc5_common/companding.h b/source/lib/vc5_common/companding.h index f4c00e1..5931e73 100755 --- a/source/lib/vc5_common/companding.h +++ b/source/lib/vc5_common/companding.h @@ -28,7 +28,7 @@ extern "C" { int32_t CompandedValue(int32_t value); - uint32_t CompandingParameter(); + uint32_t CompandingParameter(void); CODEC_ERROR ComputeCubicTable(int16_t cubic_table[], int cubic_table_length, int16_t maximum_value); diff --git a/source/lib/vc5_common/logcurve.c b/source/lib/vc5_common/logcurve.c index 695aa5a..45aecbf 100755 --- a/source/lib/vc5_common/logcurve.c +++ b/source/lib/vc5_common/logcurve.c @@ -24,7 +24,7 @@ uint16_t EncoderLogCurve[LOG_CURVE_TABLE_LENGTH]; uint16_t DecoderLogCurve[LOG_CURVE_TABLE_LENGTH]; -void SetupDecoderLogCurve() +void SetupDecoderLogCurve(void) { int i; const int log_table_size = sizeof(DecoderLogCurve) / sizeof(DecoderLogCurve[0]); @@ -41,7 +41,7 @@ void SetupDecoderLogCurve() } } -void SetupEncoderLogCurve() +void SetupEncoderLogCurve(void) { int i; const int max_input_val = LOG_CURVE_TABLE_LENGTH - 1; diff --git a/source/lib/vc5_common/logcurve.h b/source/lib/vc5_common/logcurve.h index ac03425..3e6a269 100755 --- a/source/lib/vc5_common/logcurve.h +++ b/source/lib/vc5_common/logcurve.h @@ -31,9 +31,9 @@ extern "C" { extern uint16_t DecoderLogCurve[]; - void SetupDecoderLogCurve(); + void SetupDecoderLogCurve(void); - void SetupEncoderLogCurve(); + void SetupEncoderLogCurve(void); #ifdef __cplusplus } diff --git a/source/lib/vc5_common/stream.c b/source/lib/vc5_common/stream.c index 573b673..59ecc7d 100755 --- a/source/lib/vc5_common/stream.c +++ b/source/lib/vc5_common/stream.c @@ -423,7 +423,7 @@ CODEC_ERROR GetBlockFile(STREAM *stream, void *buffer, size_t size, size_t offse } // Seek to the specified offset - assert(0 <= offset && offset <= LONG_MAX); + assert(offset <= LONG_MAX); if (fseek(file, (long)offset, SEEK_SET) != 0) { return CODEC_ERROR_FILE_SEEK; } @@ -492,7 +492,7 @@ CODEC_ERROR PutBlockFile(STREAM *stream, void *buffer, size_t size, size_t offse } // Seek to the specified offset and write to the file - assert(0 <= offset && offset <= LONG_MAX); + assert(offset <= LONG_MAX); if (fseek(file, (long)offset, SEEK_SET) != 0) { return CODEC_ERROR_FILE_SEEK; } diff --git a/source/lib/vc5_encoder/component.c b/source/lib/vc5_encoder/component.c index da7d95b..72c33ed 100755 --- a/source/lib/vc5_encoder/component.c +++ b/source/lib/vc5_encoder/component.c @@ -382,7 +382,6 @@ CODEC_ERROR WriteComponentPermutation(COMPONENT_PERMUTATION *permutation, BITSTR for (i = 0; i < component_count; i++) { uint8_t value = (uint8_t)permutation->permutation_array[i]; - assert(0 <= value && value <= UINT8_MAX); PutBits(stream, value, 8); } diff --git a/source/lib/vc5_encoder/encoder.c b/source/lib/vc5_encoder/encoder.c index 7495374..0701a4d 100755 --- a/source/lib/vc5_encoder/encoder.c +++ b/source/lib/vc5_encoder/encoder.c @@ -1153,9 +1153,9 @@ static void ForwardWaveletTransformRecursive(RECURSIVE_TRANSFORM_DATA *transform int32_t prescale = transform_data[wavelet_stage].prescale; - int bottom_input_row = ((input_height % 2) == 0) ? input_height - 2 : input_height - 1; + uint32_t bottom_input_row = ((input_height % 2) == 0) ? input_height - 2 : input_height - 1; - uint32_t last_middle_row = bottom_input_row - 2; + uint32_t last_middle_row = bottom_input_row - 2; end_row = minimum( last_middle_row, end_row); @@ -2346,14 +2346,13 @@ CODEC_ERROR EncodeHighpassBandRowRuns(BITSTREAM *stream, ENCODER_CODESET *codese // The encoder uses the codebooks for magnitudes and runs of zeros const MAGS_TABLE *mags_table = codeset->mags_table; const RUNS_TABLE *runs_table = codeset->runs_table; - int runs_table_length = runs_table->length; + uint32_t runs_table_length = runs_table->length; RLC *rlc = (RLC *)((uint8_t *)runs_table + sizeof(RUNS_TABLE)); // The band is terminated by the band end codeword in the codebook const CODEBOOK *codebook = codeset->codebook; PIXEL *rowptr = data; - int count = 0; // Convert the pitch to units of pixels assert((pitch % sizeof(PIXEL)) == 0); @@ -2379,15 +2378,16 @@ CODEC_ERROR EncodeHighpassBandRowRuns(BITSTREAM *stream, ENCODER_CODESET *codese uint8_t* stream_buffer = (uint8_t *)bit_stream->location.memory.buffer + bit_stream->byte_count; uint8_t* stream_buffer_orig = stream_buffer; + uint32_t count = 0; for (row = 0; row < height; row++) { - int index = 0; // Start at the beginning of the row + uint32_t index = 0; // Start at the beginning of the row // Search the row for runs of zeros and nonzero values while (1) { // Loop invariant - assert(0 <= index && index < width); + assert(index < width); { PIXEL* start = rowptr + index; @@ -2398,7 +2398,7 @@ CODEC_ERROR EncodeHighpassBandRowRuns(BITSTREAM *stream, ENCODER_CODESET *codese } - int x = start - (rowptr + index); + uint32_t x = start - (rowptr + index); index += x; count += x; @@ -2416,7 +2416,7 @@ CODEC_ERROR EncodeHighpassBandRowRuns(BITSTREAM *stream, ENCODER_CODESET *codese } else { - int count_index = minimum(count, runs_table_length - 1); + uint32_t count_index = minimum(count, runs_table_length - 1); assert(count_index < runs_table->length); RLC rlc_val = rlc[count_index]; diff --git a/source/lib/vc5_encoder/vlc.c b/source/lib/vc5_encoder/vlc.c index b89bbd0..38a0ecb 100755 --- a/source/lib/vc5_encoder/vlc.c +++ b/source/lib/vc5_encoder/vlc.c @@ -78,7 +78,7 @@ CODEC_ERROR PutSpecial(BITSTREAM *stream, const CODEBOOK *codebook, SPECIAL_MARK } // Is this entry the special code for the marker? - if (codebook_entry[index].value == marker) { + if (codebook_entry[index].value == (int32_t)marker) { break; } }