From: Volker Lendecke Date: Sun, 24 Nov 2024 13:16:06 +0000 (+0100) Subject: libndr: Apply const to the ndr_print_* functions's void * X-Git-Tag: tdb-1.4.13~439 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a4260cb7b6b7dce44178abba9a22412167dbd48;p=thirdparty%2Fsamba.git libndr: Apply const to the ndr_print_* functions's void * ndr_print_fn_t has a const void *, so we can extend this to the callers. Keep ABI at 6.0.0, 4.21 is 5.0.0 and 4.22 is not there yet. Signed-off-by: Volker Lendecke Reviewed-by: Martin Schwenke --- diff --git a/librpc/ABI/ndr-6.0.0.sigs b/librpc/ABI/ndr-6.0.0.sigs index 7c672a1bf51..ed433a50b4c 100644 --- a/librpc/ABI/ndr-6.0.0.sigs +++ b/librpc/ABI/ndr-6.0.0.sigs @@ -42,15 +42,15 @@ ndr_print_array_uint8: void (struct ndr_print *, const char *, const uint8_t *, ndr_print_bad_level: void (struct ndr_print *, const char *, uint16_t) ndr_print_bitmap_flag: void (struct ndr_print *, size_t, const char *, uint32_t, uint32_t) ndr_print_bool: void (struct ndr_print *, const char *, const bool) -ndr_print_debug: bool (int, ndr_print_fn_t, const char *, void *, const char *, const char *) +ndr_print_debug: bool (int, ndr_print_fn_t, const char *, const void *, const char *, const char *) ndr_print_debug_helper: void (struct ndr_print *, const char *, ...) -ndr_print_debugc: void (int, ndr_print_fn_t, const char *, void *) +ndr_print_debugc: void (int, ndr_print_fn_t, const char *, const void *) ndr_print_debugc_helper: void (struct ndr_print *, const char *, ...) ndr_print_dlong: void (struct ndr_print *, const char *, int64_t) ndr_print_double: void (struct ndr_print *, const char *, double) ndr_print_enum: void (struct ndr_print *, const char *, const char *, const char *, uint32_t) -ndr_print_function_debug: void (ndr_print_function_t, const char *, ndr_flags_type, void *) -ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, ndr_flags_type, void *) +ndr_print_function_debug: void (ndr_print_function_t, const char *, ndr_flags_type, const void *) +ndr_print_function_string: char *(TALLOC_CTX *, ndr_print_function_t, const char *, ndr_flags_type, const void *) ndr_print_gid_t: void (struct ndr_print *, const char *, gid_t) ndr_print_hyper: void (struct ndr_print *, const char *, uint64_t) ndr_print_int16: void (struct ndr_print *, const char *, int16_t) @@ -76,7 +76,7 @@ ndr_print_string: void (struct ndr_print *, const char *, const char *) ndr_print_string_array: void (struct ndr_print *, const char *, const char **) ndr_print_string_helper: void (struct ndr_print *, const char *, ...) ndr_print_struct: void (struct ndr_print *, const char *, const char *) -ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, void *) +ndr_print_struct_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, const void *) ndr_print_svcctl_ServerType: void (struct ndr_print *, const char *, uint32_t) ndr_print_time_t: void (struct ndr_print *, const char *, time_t) ndr_print_timespec: void (struct ndr_print *, const char *, const struct timespec *) @@ -90,8 +90,8 @@ ndr_print_uint32: void (struct ndr_print *, const char *, uint32_t) ndr_print_uint3264: void (struct ndr_print *, const char *, uint32_t) ndr_print_uint8: void (struct ndr_print *, const char *, uint8_t) ndr_print_union: void (struct ndr_print *, const char *, int, const char *) -ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, void *) -ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, void *) +ndr_print_union_debug: void (ndr_print_fn_t, const char *, uint32_t, const void *) +ndr_print_union_string: char *(TALLOC_CTX *, ndr_print_fn_t, const char *, uint32_t, const void *) ndr_print_winreg_Data: void (struct ndr_print *, const char *, const union winreg_Data *) ndr_print_winreg_Data_GPO: void (struct ndr_print *, const char *, const union winreg_Data_GPO *) ndr_print_winreg_Type: void (struct ndr_print *, const char *, enum winreg_Type) @@ -271,5 +271,5 @@ ndr_token_peek_cmp_fn: enum ndr_err_code (struct ndr_token_list *, const void *, ndr_token_retrieve: enum ndr_err_code (struct ndr_token_list *, const void *, uint32_t *) ndr_token_store: enum ndr_err_code (TALLOC_CTX *, struct ndr_token_list *, const void *, uint32_t) ndr_transfer_syntax_ndr: uuid = {time_low = 2324192516, time_mid = 7403, time_hi_and_version = 4553, clock_seq = "\237\350", node = "\b\000+\020H`"}, if_version = 2 -ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\3146"}, if_version = 1 +ndr_transfer_syntax_ndr64: uuid = {time_low = 1903232307, time_mid = 48826, time_hi_and_version = 18743, clock_seq = "\203\031", node = "\265\333\357\234\314\066"}, if_version = 1 ndr_zero_memory: void (void *, size_t) diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index c8cf6ee1d45..91d1cdac838 100644 --- a/librpc/ndr/libndr.h +++ b/librpc/ndr/libndr.h @@ -663,15 +663,38 @@ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) PRIN void ndr_print_debugc_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3); void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3); void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3); -bool ndr_print_debug(int level, ndr_print_fn_t fn, const char *name, void *ptr, const char *location, const char *function); -void ndr_print_debugc(int dbgc_class, ndr_print_fn_t fn, const char *name, void *ptr); -void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr); -void ndr_print_function_debug(ndr_print_function_t fn, const char *name, ndr_flags_type flags, void *ptr); -char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, void *ptr); -char *ndr_print_union_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr); +bool ndr_print_debug(int level, + ndr_print_fn_t fn, + const char *name, + const void *ptr, + const char *location, + const char *function); +void ndr_print_debugc(int dbgc_class, + ndr_print_fn_t fn, + const char *name, + const void *ptr); +void ndr_print_union_debug(ndr_print_fn_t fn, + const char *name, + uint32_t level, + const void *ptr); +void ndr_print_function_debug(ndr_print_function_t fn, + const char *name, + ndr_flags_type flags, + const void *ptr); +char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, + ndr_print_fn_t fn, + const char *name, + const void *ptr); +char *ndr_print_union_string(TALLOC_CTX *mem_ctx, + ndr_print_fn_t fn, + const char *name, + uint32_t level, + const void *ptr); char *ndr_print_function_string(TALLOC_CTX *mem_ctx, - ndr_print_function_t fn, const char *name, - ndr_flags_type flags, void *ptr); + ndr_print_function_t fn, + const char *name, + ndr_flags_type flags, + const void *ptr); void ndr_set_flags(libndr_flags *pflags, libndr_flags new_flags); enum ndr_err_code _ndr_pull_error(struct ndr_pull *ndr, enum ndr_err_code ndr_err, diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c index c07bd233a93..ece7f56a1a8 100644 --- a/librpc/ndr/ndr.c +++ b/librpc/ndr/ndr.c @@ -406,7 +406,10 @@ _PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, /* a useful helper function for printing idl structures via DEBUGC() */ -_PUBLIC_ void ndr_print_debugc(int dbgc_class, ndr_print_fn_t fn, const char *name, void *ptr) +_PUBLIC_ void ndr_print_debugc(int dbgc_class, + ndr_print_fn_t fn, + const char *name, + const void *ptr) { struct ndr_print *ndr; @@ -434,7 +437,7 @@ _PUBLIC_ void ndr_print_debugc(int dbgc_class, ndr_print_fn_t fn, const char *na _PUBLIC_ bool ndr_print_debug(int level, ndr_print_fn_t fn, const char *name, - void *ptr, + const void *ptr, const char *location, const char *function) { @@ -468,7 +471,10 @@ fail: /* a useful helper function for printing idl unions via DEBUG() */ -_PUBLIC_ void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr) +_PUBLIC_ void ndr_print_union_debug(ndr_print_fn_t fn, + const char *name, + uint32_t level, + const void *ptr) { struct ndr_print *ndr; @@ -493,7 +499,10 @@ _PUBLIC_ void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_ /* a useful helper function for printing idl function calls via DEBUG() */ -_PUBLIC_ void ndr_print_function_debug(ndr_print_function_t fn, const char *name, ndr_flags_type flags, void *ptr) +_PUBLIC_ void ndr_print_function_debug(ndr_print_function_t fn, + const char *name, + ndr_flags_type flags, + const void *ptr) { struct ndr_print *ndr; @@ -517,7 +526,10 @@ _PUBLIC_ void ndr_print_function_debug(ndr_print_function_t fn, const char *name /* a useful helper function for printing idl structures to a string */ -_PUBLIC_ char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, void *ptr) +_PUBLIC_ char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, + ndr_print_fn_t fn, + const char *name, + const void *ptr) { struct ndr_print *ndr; char *ret = NULL; @@ -542,7 +554,11 @@ failed: /* a useful helper function for printing idl unions to a string */ -_PUBLIC_ char *ndr_print_union_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr) +_PUBLIC_ char *ndr_print_union_string(TALLOC_CTX *mem_ctx, + ndr_print_fn_t fn, + const char *name, + uint32_t level, + const void *ptr) { struct ndr_print *ndr; char *ret = NULL; @@ -568,8 +584,10 @@ failed: a useful helper function for printing idl function calls to a string */ _PUBLIC_ char *ndr_print_function_string(TALLOC_CTX *mem_ctx, - ndr_print_function_t fn, const char *name, - ndr_flags_type flags, void *ptr) + ndr_print_function_t fn, + const char *name, + ndr_flags_type flags, + const void *ptr) { struct ndr_print *ndr; char *ret = NULL;