nix_api_external: fix missing void* self param

This commit is contained in:
Yorick van Pelt 2023-07-27 13:11:25 +02:00 committed by José Luis Lafuente
parent c3b5b8eb62
commit efcddcdd2f
No known key found for this signature in database
GPG key ID: 8A3455EBE455489A
2 changed files with 8 additions and 5 deletions

View file

@ -139,7 +139,7 @@ public:
} }
nix_string_context ctx{context}; nix_string_context ctx{context};
std::unique_ptr<nix_returned_string> r( std::unique_ptr<nix_returned_string> r(
desc.printValueAsJSON((State *)&state, strict, &ctx, copyToStore)); desc.printValueAsJSON(v, (State *)&state, strict, &ctx, copyToStore));
if (!r) { if (!r) {
return nix::ExternalValueBase::printValueAsJSON(state, strict, context, return nix::ExternalValueBase::printValueAsJSON(state, strict, context,
copyToStore); copyToStore);
@ -160,7 +160,7 @@ public:
state, strict, location, doc, context, drvsSeen, pos); state, strict, location, doc, context, drvsSeen, pos);
} }
nix_string_context ctx{context}; 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<const uint32_t *>(&pos)); &drvsSeen, *reinterpret_cast<const uint32_t *>(&pos));
} }

View file

@ -132,6 +132,7 @@ typedef struct NixCExternalValueDesc {
* @brief Convert the external value to json * @brief Convert the external value to json
* *
* Optional, the default is to throw an error * 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] state The evaluator state
* @param[in] strict boolean Whether to force the value before printing * @param[in] strict boolean Whether to force the value before printing
* @param[out] c writable string context for the resulting string * @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 * @returns string that gets parsed as json. Optional, returning NULL will
* make the conversion throw an error. * 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, nix_string_context *c,
bool copyToStore); bool copyToStore);
/** /**
@ -149,6 +150,7 @@ typedef struct NixCExternalValueDesc {
* Optional, the default is to throw an error * Optional, the default is to throw an error
* @todo The mechanisms for this call are incomplete. There are no C * @todo The mechanisms for this call are incomplete. There are no C
* bindings to work with XML, pathsets and positions. * 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] state The evaluator state
* @param[in] strict boolean Whether to force the value before printing * @param[in] strict boolean Whether to force the value before printing
* @param[in] location boolean Whether to include position information in the * @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,out] drvsSeen a path set to avoid duplicating derivations
* @param[in] pos The position of the call. * @param[in] pos The position of the call.
*/ */
void (*printValueAsXML)(State *, int strict, int location, void *doc, void (*printValueAsXML)(void *self, State *, int strict, int location,
nix_string_context *c, void *drvsSeen, int pos); void *doc, nix_string_context *c, void *drvsSeen,
int pos);
} NixCExternalValueDesc; } NixCExternalValueDesc;
/** /**