Fixed char array getAxisParam function

This commit is contained in:
2025-06-17 09:30:40 +02:00
parent b1fe452ed6
commit c475beee66

View File

@ -571,7 +571,7 @@ template <typename A, typename C, typename T>
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
int (C::*func)(), T *readValue,
const char *callerFunctionName, int lineNumber,
TypeTag<void>) {
size_t msgSize, TypeTag<void>) {
static_assert(
sizeof(T) == 0,
"no specialization of getAxisParam exists for the given type");
@ -582,7 +582,7 @@ template <typename A, typename C>
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
int (C::*func)(), int *readValue,
const char *callerFunctionName, int lineNumber,
TypeTag<int>) {
size_t msgSize, TypeTag<int>) {
int indexValue = (controller->*func)();
asynStatus status =
controller->getIntegerParam(axis->axisNo(), indexValue, readValue);
@ -597,17 +597,17 @@ template <typename A, typename C>
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
int (C::*func)(), bool *readValue,
const char *callerFunctionName, int lineNumber,
TypeTag<bool>) {
size_t msgSize, TypeTag<bool>) {
return getAxisParamImpl(axis, indexName, func,
static_cast<int *>(readValue), callerFunctionName,
lineNumber);
lineNumber, msgSize);
}
template <typename A, typename C>
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
int (C::*func)(), double *readValue,
const char *callerFunctionName, int lineNumber,
TypeTag<double>) {
size_t msgSize, TypeTag<double>) {
int indexValue = (controller->*func)();
asynStatus status =
controller->getDoubleParam(axis->axisNo(), indexValue, readValue);
@ -622,11 +622,11 @@ template <typename A, typename C>
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
int (C::*func)(), char *readValue,
const char *callerFunctionName, int lineNumber,
TypeTag<char>) {
size_t msgSize, TypeTag<char>) {
int indexValue = (controller->*func)();
asynStatus status = controller->getStringParam(
axis->axisNo(), indexValue, controller->msgSize(), readValue);
asynStatus status = controller->getStringParam(axis->axisNo(), indexValue,
msgSize, readValue);
if (status != asynSuccess) {
return controller->paramLibAccessFailed(
status, indexName, axis->axisNo(), callerFunctionName, lineNumber);
@ -638,7 +638,7 @@ template <typename A, typename C>
asynStatus getAxisParamImpl(A *axis, C *controller, const char *indexName,
int (C::*func)(), std::string *readValue,
const char *callerFunctionName, int lineNumber,
TypeTag<std::string>) {
size_t msgSize, TypeTag<std::string>) {
int indexValue = (controller->*func)();
// Convert the pointer to a reference, since getStringParam expects the
@ -679,12 +679,13 @@ asynStatus getAxisParam(A *axis, C *controller, const char *indexName,
int (C::*func)(), T *readValue,
const char *callerFunctionName, int lineNumber) {
return getAxisParamImpl(axis, controller, indexName, func, readValue,
callerFunctionName, lineNumber, TypeTag<T>{});
callerFunctionName, lineNumber,
controller->msgSize(), TypeTag<T>{});
}
/**
* @brief Helper function to get an integer / double / string parameter for an
* axis in the paramLib
* @brief Helper function to get a string parameter for an
* axis in the paramLib into a char array
*
* This function should not be used directly, but rather through its macro
* variant `getAxisParamChecked`. It is a specialized variant of the general
@ -707,7 +708,7 @@ asynStatus getAxisParam(A *axis, C *controller, const char *indexName,
const char *callerFunctionName, int lineNumber) {
return getAxisParamImpl(axis, controller, indexName, func,
static_cast<char *>(readValue), callerFunctionName,
lineNumber, TypeTag<char>{});
lineNumber, sizeof(readValue), TypeTag<char>{});
}
/**