Workaroudn cppcheck (correct) warning about same code in then and else branches
authorEven Rouault <even.rouault@spatialys.com>
Tue, 19 Sep 2017 16:35:31 +0000 (18:35 +0200)
committerEven Rouault <even.rouault@spatialys.com>
Tue, 19 Sep 2017 16:35:31 +0000 (18:35 +0200)
src/lib/openjp2/sparse_array.c

index e7efdc96c7e7a7606ce08eb2bf7e6bf037b2071e..73192924eddcef37e24e6138faef09f4b62bd73a 100644 (file)
@@ -170,6 +170,7 @@ static OPJ_BOOL opj_sparse_array_int32_read_or_write(
                         if (x_incr == 4) {
                             /* Same code as general branch, but the compiler */
                             /* can have an efficient memcpy() */
+                            (void)(x_incr); /* trick to silent cppcheck duplicateBranch warning */
                             for (j = 0; j < y_incr; j++) {
                                 memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
                                 dest_ptr += buf_line_stride;
@@ -249,6 +250,7 @@ static OPJ_BOOL opj_sparse_array_int32_read_or_write(
                     if (x_incr == 4) {
                         /* Same code as general branch, but the compiler */
                         /* can have an efficient memcpy() */
+                        (void)(x_incr); /* trick to silent cppcheck duplicateBranch warning */
                         for (j = 0; j < y_incr; j++) {
                             memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
                             dest_ptr += block_width;