Fix skcms build with Clang 22

Add explicit void pointer casts in C tests and return no-op values
directly to avoid implicit-void-ptr-cast and nrvo warnings.

Fixed: 545322470
Change-Id: Ibe5fd5038683e6a9d3517804d65af0edb63294b2
Reviewed-on: https://skia-review.googlesource.com/c/skcms/+/1374676
Auto-Submit: Aaron Teo <hocheung@chromium.org>
Reviewed-by: Christopher Cameron <ccameron@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
diff --git a/skcms.cc b/skcms.cc
index c23dbc1..79dbecf 100644
--- a/skcms.cc
+++ b/skcms.cc
@@ -2525,7 +2525,7 @@
 
 struct OpAndArg {
     Op          op;
-    const void* arg;
+    const void* arg;  // nullptr represents a no-op; op is ignored.
 };
 
 static OpAndArg select_curve_op(const skcms_Curve* curve, int channel) {
@@ -2541,22 +2541,22 @@
     const auto& op = kOps[channel];
 
     if (curve->table_entries == 0) {
-        const OpAndArg noop = { Op::load_a8/*doesn't matter*/, nullptr };
-
         const skcms_TransferFunction& tf = curve->parametric;
 
         if (tf_is_gamma(tf)) {
-            return tf.g != 1 ? OpAndArg{op.sGamma, &tf}
-                             : noop;
+            return tf.g != 1 ? OpAndArg{op.sGamma, &tf} : OpAndArg{};
         }
 
         switch (classify(tf)) {
-            case skcms_TFType_Invalid:    return noop;
+            case skcms_TFType_Invalid:
+                return {};
             // TODO(https://issues.skia.org/issues/420956739): Consider adding
             // support for PQ and HLG. Generally any code that goes through this
             // path would also want tone mapping too.
-            case skcms_TFType_PQ:         return noop;
-            case skcms_TFType_HLG:        return noop;
+            case skcms_TFType_PQ:
+                return {};
+            case skcms_TFType_HLG:
+                return {};
             case skcms_TFType_sRGBish:    return OpAndArg{op.sRGBish,   &tf};
             case skcms_TFType_PQish:      return OpAndArg{op.PQish,     &tf};
             case skcms_TFType_HLGish:     return OpAndArg{op.HLGish,    &tf};
diff --git a/tests.c b/tests.c
index 42c63b6..35175a7 100644
--- a/tests.c
+++ b/tests.c
@@ -219,7 +219,7 @@
 
 static void test_FormatConversions_16161616LE(void) {
     // We want to hit each 16-bit value, 4 per each of 16384 pixels.
-    uint64_t* src = malloc(8 * 16384);
+    uint64_t* src = (uint64_t*)malloc(8 * 16384);
     for (int i = 0; i < 16384; i++) {
         src[i] = (uint64_t)(4*i + 0) <<  0
                | (uint64_t)(4*i + 1) << 16
@@ -230,7 +230,7 @@
     expect(src[   32] == 0x0083008200810080);  // just on the cusp of rounding to 0x00 or 0x01
     expect(src[16383] == 0xfffffffefffdfffc);
 
-    uint32_t* dst = malloc(4 * 16384);
+    uint32_t* dst = (uint32_t*)malloc(4 * 16384);
     expect(skcms_Transform(src, skcms_PixelFormat_RGBA_16161616LE, skcms_AlphaFormat_Unpremul, NULL,
                            dst, skcms_PixelFormat_RGBA_8888      , skcms_AlphaFormat_Unpremul, NULL,
                            16384));
@@ -243,7 +243,7 @@
 
     // We've lost precision when transforming to 8-bit, so these won't quite round-trip.
     // Instead we should see the 8-bit dst value byte-doubled, as 65535/255 = 257 = 0x0101.
-    uint64_t* back = malloc(8 * 16384);
+    uint64_t* back = (uint64_t*)malloc(8 * 16384);
     expect(skcms_Transform(dst , skcms_PixelFormat_RGBA_8888      ,skcms_AlphaFormat_Unpremul, NULL,
                            back, skcms_PixelFormat_RGBA_16161616LE,skcms_AlphaFormat_Unpremul, NULL,
                            16384));
@@ -298,7 +298,7 @@
 
 static void test_FormatConversions_16161616BE(void) {
     // We want to hit each 16-bit value, 4 per each of 16384 pixels.
-    uint64_t* src = malloc(8 * 16384);
+    uint64_t* src = (uint64_t*)malloc(8 * 16384);
     for (int i = 0; i < 16384; i++) {
         src[i] = (uint64_t)(4*i + 0) <<  0
                | (uint64_t)(4*i + 1) << 16
@@ -309,7 +309,7 @@
     expect(src[ 8127] == 0x7eff7efe7efd7efc);  // This should demonstrate interesting rounding.
     expect(src[16383] == 0xfffffffefffdfffc);
 
-    uint32_t* dst = malloc(4 * 16384);
+    uint32_t* dst = (uint32_t*)malloc(4 * 16384);
     expect(skcms_Transform(src, skcms_PixelFormat_RGBA_16161616BE, skcms_AlphaFormat_Unpremul, NULL,
                            dst, skcms_PixelFormat_RGBA_8888      , skcms_AlphaFormat_Unpremul, NULL,
                            16384));
@@ -323,7 +323,7 @@
 
     // We've lost precision when transforming to 8-bit, so these won't quite round-trip.
     // Instead we should see the 8-bit dst value byte-doubled, as 65535/255 = 257 = 0x0101.
-    uint64_t* back = malloc(8 * 16384);
+    uint64_t* back = (uint64_t*)malloc(8 * 16384);
     expect(skcms_Transform(dst , skcms_PixelFormat_RGBA_8888      ,skcms_AlphaFormat_Unpremul, NULL,
                            back, skcms_PixelFormat_RGBA_16161616BE,skcms_AlphaFormat_Unpremul, NULL,
                            16384));
@@ -896,8 +896,8 @@
             expect(load_file(ref_filename, &ref_buf, &ref_len));
 
             if (dump_len != ref_len || memcmp(dump_buf, ref_buf, dump_len) != 0) {
-                const char* cur = dump_buf;
-                const char* ref =  ref_buf;
+                const char* cur = (const char*)dump_buf;
+                const char* ref = (const char*)ref_buf;
                 while (*cur == *ref) { cur++; ref++; }
                 size_t off = (size_t)(cur - (const char*)dump_buf);
                 // Write out the new data on a mismatch