Mavlink: Don't use a packed struct as input for the convert_limit_safe function

- Addional small cleanup of the iridium driver and the include guards of mavlink module header files
This commit is contained in:
acfloria
2018-04-11 15:15:28 +02:00
committed by Beat Küng
parent 477a4e7ec8
commit 0caa4dc171
4 changed files with 31 additions and 24 deletions
@@ -37,8 +37,7 @@
* @author Achermann Florian <acfloria@ethz.ch>
*/
#ifndef MAVLINK_SIMPLE_ANALYZER_H_
#define MAVLINK_SIMPLE_ANALYZER_H_
#pragma once
#include <limits>
@@ -137,17 +136,15 @@ private:
};
template<typename Tin, typename Tout>
void convert_limit_safe(Tin in, Tout *out)
void convert_limit_safe(Tin in, Tout &out)
{
if (in > std::numeric_limits<Tout>::max()) {
*out = std::numeric_limits<Tout>::max();
out = std::numeric_limits<Tout>::max();
} else if (in < std::numeric_limits<Tout>::min()) {
*out = std::numeric_limits<Tout>::min();
out = std::numeric_limits<Tout>::min();
} else {
*out = static_cast<Tout>(in);
out = static_cast<Tout>(in);
}
}
#endif /* MAVLINK_SIMPLE_ANALYZER_H_ */