[cairo-commit] 5 commits - perf/cairo-perf-chart.c src/cairo-pdf-surface.c src/cairo-quartz-image-surface.c test/pattern-getters.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 8 09:47:44 UTC 2023


 perf/cairo-perf-chart.c          |    2 +-
 src/cairo-pdf-surface.c          |    2 +-
 src/cairo-quartz-image-surface.c |    2 +-
 test/pattern-getters.c           |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit fe7f1d8cb4908baf89d2cb6a10864494bc41469d
Merge: f706ad5aa 59c195dc8
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed Feb 8 09:47:42 2023 +0000

    Merge branch 'warnings' into 'master'
    
    Fix some compiler warnings
    
    See merge request cairo/cairo!427

commit 59c195dc8211b9ec1ef3947d502131c74db2831d
Author: Khaled Hosny <khaled at aliftype.com>
Date:   Fri Feb 3 18:04:01 2023 +0200

    Fix -Wlogical-not-parentheses
    
    The code is doing "if (!double_buf_equal () != 0)" which seems to be a
    convoluted way to do "if (!double_buf_equal ())". Fixes:
    
    ../test/pattern-getters.c:153:6: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
            if (!double_buf_equal (ctx, new_buf, expected_values,
                ^
    ../test/pattern-getters.c:153:6: note: add parentheses after the '!' to evaluate the comparison first
            if (!double_buf_equal (ctx, new_buf, expected_values,
                ^
                 (
    ../test/pattern-getters.c:153:6: note: add parentheses around left hand side expression to silence this warning
            if (!double_buf_equal (ctx, new_buf, expected_values,
                ^
                (

diff --git a/test/pattern-getters.c b/test/pattern-getters.c
index e0ece398f..49027e913 100644
--- a/test/pattern-getters.c
+++ b/test/pattern-getters.c
@@ -151,7 +151,7 @@ draw (cairo_t *cr, int width, int height)
 	}
 
 	if (!double_buf_equal (ctx, new_buf, expected_values,
-			       ARRAY_LENGTH (expected_values)) != 0)
+			       ARRAY_LENGTH (expected_values)))
 	{
 	    cairo_pattern_destroy (pat);
 	    return CAIRO_TEST_FAILURE;
commit c6a27dc28b2fac589322eb18d448e1eca335d8c6
Author: Khaled Hosny <khaled at aliftype.com>
Date:   Fri Feb 3 17:58:12 2023 +0200

    Fix -Wuninitialized
    
    ../perf/cairo-perf-chart.c:232:4: warning: variable 'sum' is uninitialized when used here [-Wuninitialized]
                            sum += v/100;
                            ^~~
    ../perf/cairo-perf-chart.c:142:43: note: initialize the variable 'sum' to silence this warning
        double slow_sum = 0, fast_sum = 0, sum;
                                              ^
                                               = 0.0

diff --git a/perf/cairo-perf-chart.c b/perf/cairo-perf-chart.c
index 738fe5c7b..9ccb9b42e 100644
--- a/perf/cairo-perf-chart.c
+++ b/perf/cairo-perf-chart.c
@@ -139,7 +139,7 @@ find_ranges (struct chart *chart)
     double test_time;
     int seen_non_null;
     int num_tests = 0;
-    double slow_sum = 0, fast_sum = 0, sum;
+    double slow_sum = 0, fast_sum = 0, sum = 0;
     int slow_count = 0, fast_count = 0;
     int *count;
     int i;
commit b588a43fcd608d6ace9a84097ab5cf99e9ad3b38
Author: Khaled Hosny <khaled at aliftype.com>
Date:   Fri Feb 3 17:52:54 2023 +0200

    Fix -Wunused-variable
    
     ../src/cairo-quartz-image-surface.c:149:24: warning: unused variable 'size' [-Wunused-variable]
        const unsigned int size = surface->imageSurface->height * surface->imageSurface->stride;

diff --git a/src/cairo-quartz-image-surface.c b/src/cairo-quartz-image-surface.c
index 30d92d6be..2c82ef1a3 100644
--- a/src/cairo-quartz-image-surface.c
+++ b/src/cairo-quartz-image-surface.c
@@ -146,7 +146,7 @@ _cairo_quartz_image_surface_flush (void *asurface,
     CGImageRef oldImage = surface->image;
     CGImageRef newImage = NULL;
     void *image_data;
-    const unsigned int size = surface->imageSurface->height * surface->imageSurface->stride;
+
     if (flags)
 	return CAIRO_STATUS_SUCCESS;
 
commit 288843ef5d2338ccf863119e70a4ce239e3d450b
Author: Khaled Hosny <khaled at aliftype.com>
Date:   Thu Jan 26 13:26:54 2023 +0200

    Fix -Wsometimes-uninitialized warning
    
    ../src/cairo-pdf-surface.c:2505:9: warning: variable 'status' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (surface->base.status != CAIRO_STATUS_SUCCESS)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../src/cairo-pdf-surface.c:2573:9: note: uninitialized use occurs here
        if (status == CAIRO_STATUS_SUCCESS)
            ^~~~~~
    ../src/cairo-pdf-surface.c:2505:5: note: remove the 'if' if its condition is always false
        if (surface->base.status != CAIRO_STATUS_SUCCESS)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../src/cairo-pdf-surface.c:2497:5: note: variable 'status' is declared here
        cairo_status_t status, status2;
        ^

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 772828eb8..2b1bf72e4 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -2556,7 +2556,7 @@ _cairo_pdf_surface_finish (void *abstract_surface)
     cairo_pdf_surface_t *surface = abstract_surface;
     long long offset;
     cairo_pdf_resource_t catalog;
-    cairo_status_t status, status2;
+    cairo_status_t status = CAIRO_STATUS_SUCCESS, status2;
     int size, i;
     cairo_pdf_jbig2_global_t *global;
     char *label;


More information about the cairo-commit mailing list