From efcddcdd2f58c7a83db77cbe102555331db6656e Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Thu, 27 Jul 2023 13:11:25 +0200 Subject: [PATCH] nix_api_external: fix missing void* self param --- src/libexpr/nix_api_external.cc | 4 ++-- src/libexpr/nix_api_external.h | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libexpr/nix_api_external.cc b/src/libexpr/nix_api_external.cc index 971a175fb..5fe0819f4 100644 --- a/src/libexpr/nix_api_external.cc +++ b/src/libexpr/nix_api_external.cc @@ -139,7 +139,7 @@ public: } nix_string_context ctx{context}; std::unique_ptr r( - desc.printValueAsJSON((State *)&state, strict, &ctx, copyToStore)); + desc.printValueAsJSON(v, (State *)&state, strict, &ctx, copyToStore)); if (!r) { return nix::ExternalValueBase::printValueAsJSON(state, strict, context, copyToStore); @@ -160,7 +160,7 @@ public: state, strict, location, doc, context, drvsSeen, pos); } nix_string_context ctx{context}; - desc.printValueAsXML((State *)&state, strict, location, &doc, &ctx, + desc.printValueAsXML(v, (State *)&state, strict, location, &doc, &ctx, &drvsSeen, *reinterpret_cast(&pos)); } diff --git a/src/libexpr/nix_api_external.h b/src/libexpr/nix_api_external.h index 2bb53e349..66d289bac 100644 --- a/src/libexpr/nix_api_external.h +++ b/src/libexpr/nix_api_external.h @@ -132,6 +132,7 @@ typedef struct NixCExternalValueDesc { * @brief Convert the external value to json * * Optional, the default is to throw an error + * @param[in] self the void* passed to nix_create_external_value * @param[in] state The evaluator state * @param[in] strict boolean Whether to force the value before printing * @param[out] c writable string context for the resulting string @@ -140,7 +141,7 @@ typedef struct NixCExternalValueDesc { * @returns string that gets parsed as json. Optional, returning NULL will * make the conversion throw an error. */ - nix_returned_string *(*printValueAsJSON)(State *, int strict, + nix_returned_string *(*printValueAsJSON)(void *self, State *, int strict, nix_string_context *c, bool copyToStore); /** @@ -149,6 +150,7 @@ typedef struct NixCExternalValueDesc { * Optional, the default is to throw an error * @todo The mechanisms for this call are incomplete. There are no C * bindings to work with XML, pathsets and positions. + * @param[in] self the void* passed to nix_create_external_value * @param[in] state The evaluator state * @param[in] strict boolean Whether to force the value before printing * @param[in] location boolean Whether to include position information in the @@ -158,8 +160,9 @@ typedef struct NixCExternalValueDesc { * @param[in,out] drvsSeen a path set to avoid duplicating derivations * @param[in] pos The position of the call. */ - void (*printValueAsXML)(State *, int strict, int location, void *doc, - nix_string_context *c, void *drvsSeen, int pos); + void (*printValueAsXML)(void *self, State *, int strict, int location, + void *doc, nix_string_context *c, void *drvsSeen, + int pos); } NixCExternalValueDesc; /**