From 394222ac72fbbd9e13157d9bbd5c9016e4e201f9 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 4 Oct 2006 18:49:29 +0000 Subject: [PATCH] fixed wrong app type used when client is acknowledging an alarm (slightly revised to use primitive type of request if writing to other than gddAppType_value) --- src/cas/generic/casStrmClient.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cas/generic/casStrmClient.cc b/src/cas/generic/casStrmClient.cc index b0540d3d7..4dc33a872 100644 --- a/src/cas/generic/casStrmClient.cc +++ b/src/cas/generic/casStrmClient.cc @@ -2043,13 +2043,24 @@ caStatus casStrmClient::writeScalarData () if ( pHdr->m_dataType >= NELEMENTS(gddDbrToAit) ) { return S_cas_badType; } + + // a primitive type matching the atomic DBR_XXX type aitEnum type = gddDbrToAit[pHdr->m_dataType].type; if ( type == aitEnumInvalid ) { return S_cas_badType; } - aitEnum bestExternalType = this->ctx.getPV()->bestExternalType (); + + // the application type best maching this DBR_XXX type aitUint16 app = gddDbrToAit[pHdr->m_dataType].app; - gdd * pDD = new gddScalar ( app, bestExternalType ); + + // When possible, preconvert to best external type in order + // to reduce problems in the services + aitEnum bestWritePrimType = + app == gddAppType_value ? + this->ctx.getPV()->bestExternalType () : + type; + + gdd * pDD = new gddScalar ( app, bestWritePrimType ); if ( ! pDD ) { return S_cas_noMemory; }