From ebe7870015b810c0494ef9b15ea37d88a6b6ce60 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 22 Aug 2002 14:39:46 +0000 Subject: [PATCH] avoid comparison between signed and unsigned numbers --- src/cas/generic/casPVIIL.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/cas/generic/casPVIIL.h b/src/cas/generic/casPVIIL.h index 3c8bd451c..3e4a605e9 100644 --- a/src/cas/generic/casPVIIL.h +++ b/src/cas/generic/casPVIIL.h @@ -59,17 +59,18 @@ inline void casPVI::unregisterIO() // // casPVI::bestDBRType() // -inline caStatus casPVI::bestDBRType ( unsigned &dbrType ) // X aCC 361 +inline caStatus casPVI::bestDBRType ( unsigned & dbrType ) // X aCC 361 { aitEnum bestAIT = this->bestExternalType (); - - if ( bestAIT < NELEMENTS ( gddAitToDbr ) && bestAIT != aitEnumInvalid ) { - dbrType = gddAitToDbr[bestAIT]; - return S_cas_success; - } - else { + if ( bestAIT == aitEnumInvalid || bestAIT < 0 ) { return S_cas_badType; - } + } + unsigned aitIndex = static_cast < unsigned > ( bestAIT ); + if ( aitIndex >= NELEMENTS ( gddAitToDbr ) ) { + return S_cas_badType; + } + dbrType = gddAitToDbr[bestAIT]; + return S_cas_success; } #include "casChannelIIL.h" // inline func for casChannelI