X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/f22e1c9370866c330b79728a364c8ab1a9f43335..2196a3a0cdc5384c082febb7f4aa5994cc7d80db:/projects/stargazer/plugins/other/smux/value2os.h diff --git a/projects/stargazer/plugins/other/smux/value2os.h b/projects/stargazer/plugins/other/smux/value2os.h index d17cb357..9084aa72 100644 --- a/projects/stargazer/plugins/other/smux/value2os.h +++ b/projects/stargazer/plugins/other/smux/value2os.h @@ -1,64 +1,61 @@ -#ifndef __VALUE_2_OS_H__ -#define __VALUE_2_OS_H__ +#pragma once +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wold-style-cast" #include "stg/ObjectSyntax.h" +#pragma GCC diagnostic pop + +#include template -bool ValueToOS(const T & value, ObjectSyntax * objectSyntax); +void ValueToOS(const T & value, ObjectSyntax * objectSyntax); template <> inline -bool ValueToOS(const int & value, ObjectSyntax * objectSyntax) +void ValueToOS(const int & value, ObjectSyntax * objectSyntax) { objectSyntax->present = ObjectSyntax_PR_simple; SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple; simpleSyntax->present = SimpleSyntax_PR_number; asn_long2INTEGER(&simpleSyntax->choice.number, value); -return true; } template <> inline -bool ValueToOS(const unsigned int & value, ObjectSyntax * objectSyntax) +void ValueToOS(const unsigned int & value, ObjectSyntax * objectSyntax) { objectSyntax->present = ObjectSyntax_PR_simple; SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple; simpleSyntax->present = SimpleSyntax_PR_number; asn_long2INTEGER(&simpleSyntax->choice.number, value); -return true; } template <> inline -bool ValueToOS(const long & value, ObjectSyntax * objectSyntax) +void ValueToOS(const long & value, ObjectSyntax * objectSyntax) { objectSyntax->present = ObjectSyntax_PR_simple; SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple; simpleSyntax->present = SimpleSyntax_PR_number; asn_long2INTEGER(&simpleSyntax->choice.number, value); -return true; } template <> inline -bool ValueToOS(const unsigned long & value, ObjectSyntax * objectSyntax) +void ValueToOS(const unsigned long & value, ObjectSyntax * objectSyntax) { objectSyntax->present = ObjectSyntax_PR_simple; SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple; simpleSyntax->present = SimpleSyntax_PR_number; asn_long2INTEGER(&simpleSyntax->choice.number, value); -return true; } template <> inline -bool ValueToOS(const std::string & value, ObjectSyntax * objectSyntax) +void ValueToOS(const std::string & value, ObjectSyntax * objectSyntax) { objectSyntax->present = ObjectSyntax_PR_simple; SimpleSyntax_t * simpleSyntax = &objectSyntax->choice.simple; simpleSyntax->present = SimpleSyntax_PR_string; -OCTET_STRING_fromBuf(&simpleSyntax->choice.string, value.c_str(), value.length()); -return true; +OCTET_STRING_fromBuf(&simpleSyntax->choice.string, value.c_str(), static_cast(value.length())); } - -#endif