Commit 1656cdc9 authored by Kristof Szabados's avatar Kristof Szabados
Browse files

it looks like passing enums to va_start is unsafe as codechecker reports...


it looks like passing enums to va_start is unsafe as codechecker reports "passing an object that undergoes default argument promotion to 'va_start' has undefined behavior".
Maybe adding a casting to int (forcing the int conversion) will fix it.
Signed-off-by: Kristof Szabados's avatarKristof Szabados <Kristof.Szabados@ericsson.com>
parent e8261030
......@@ -176,7 +176,7 @@ void def_encdec(const char *p_classname,
" TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...)\n"
"{\n"
" va_list pvar;\n"
" va_start(pvar, p_coding);\n"
" va_start(pvar, (int)p_coding);\n"
" switch(p_coding) {\n"
" case TTCN_EncDec::CT_BER: {\n"
" TTCN_EncDec_ErrorContext ec(\"While BER-decoding type"
......
......@@ -56,7 +56,7 @@ void ASN_ANY::decode(const TTCN_Typedescriptor_t& p_td,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -3271,7 +3271,7 @@ void CHARACTER_STRING::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_
void CHARACTER_STRING::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -3375,7 +3375,7 @@ void EMBEDDED_PDV::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
void EMBEDDED_PDV::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -3590,7 +3590,7 @@ void EXTERNAL::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTC
void EXTERNAL::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -166,7 +166,7 @@ void ASN_NULL::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -120,7 +120,7 @@ void Base_Type::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -700,7 +700,7 @@ void BITSTRING::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -267,7 +267,7 @@ void BOOLEAN::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -861,7 +861,7 @@ void CHARSTRING::decode(const TTCN_Typedescriptor_t& p_td,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -403,7 +403,7 @@ void FLOAT::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -704,7 +704,7 @@ void HEXSTRING::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch (p_coding) {
case TTCN_EncDec::CT_RAW: {
TTCN_EncDec_ErrorContext ec("While RAW-decoding type '%s': ", p_td.name);
......
......@@ -817,7 +817,7 @@ void INTEGER::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -327,7 +327,7 @@ void OBJID::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -662,7 +662,7 @@ void OCTETSTRING::decode(const TTCN_Typedescriptor_t& p_td,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -1168,7 +1168,7 @@ void UNIVERSAL_CHARSTRING::decode(const TTCN_Typedescriptor_t& p_td,
TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
case TTCN_EncDec::CT_BER: {
TTCN_EncDec_ErrorContext ec("While BER-decoding type '%s': ", p_td.name);
......
......@@ -208,7 +208,7 @@ void VERDICTTYPE::decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf,
TTCN_EncDec::coding_t p_coding, ...)
{
va_list pvar;
va_start(pvar, p_coding);
va_start(pvar, (int)p_coding);
switch(p_coding) {
#if 0
case TTCN_EncDec::CT_RAW: {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment