s3/registry: Fix func cast error (diff in params size_t vs uint32)
authorNoel Power <noel.power@suse.com>
Fri, 3 May 2019 11:21:07 +0000 (12:21 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 10 May 2019 01:15:18 +0000 (01:15 +0000)
reg_parse_callback_key_t alread has size_t for number of elemens in key
but
reg_parse_callback_val_t uses uint32_t for length of value data.

Many internal function seem to take size_t as data len (see reg_format_value
etc.) It seems changing the signature of the callback aligns it more closely
with the existing api.

../../source3/registry/reg_format.c:438:10: error: cast between incompatible function types from ‘int (*)(reg_format *, const char *, uint32_t,  const uint8_t *, size_t)’ {aka ‘int (*)(struct reg_format *, const char *, unsigned int,  const unsigned char *, long unsigned int)’} to ‘int (*)(void *, const char *, uint32_t,  const uint8_t *, uint32_t)’ {aka ‘int (*)(void *, const char *, unsigned int,  const unsigned char *, unsigned int)’} [-Werror=cast-function-type]
   .val = (reg_parse_callback_val_t)&reg_format_value,

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/registry/reg_parse.h

index 0694225ef50ea07d16bda9bc23e2cd274c12327e..3940e3d693631559d7f62c62889e7746302fddd7 100644 (file)
@@ -70,7 +70,7 @@ typedef int (*reg_parse_callback_val_t) (void*  private_data,
                                         const char* name,
                                         uint32_t type,
                                         const uint8_t* data,
-                                        uint32_t len);
+                                        size_t len);
 
 /**
  * Protoype for function called on value delete found.