From: leslie Date: Mon, 11 Aug 2008 12:11:55 +0000 (+0800) Subject: constcw: proper type cast X-Git-Tag: 0.9.1~39 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=633b483e1b0e63ad7cde149c83865fa409b4fb4a;p=sasc-ng.git constcw: proper type cast --- diff --git a/systems/constcw/constcw.c b/systems/constcw/constcw.c index e6c6003..901c307 100644 --- a/systems/constcw/constcw.c +++ b/systems/constcw/constcw.c @@ -19,9 +19,7 @@ #include #include -#include #include -#include #include #include @@ -120,7 +118,8 @@ bool cSystemConstCw::ProcessECM(const cEcmInfo *ecm, unsigned char *source) cKeySnoop ks(this,'X',ecm->caId,0); cPlainKey *pk=0; while((pk=keys.FindKey('X',ecm->caId,0,16,pk))) { - if(typeid(*pk)==typeid(cPlainKeyConstCw) && ((cPlainKeyConstCw *)pk)->Matches(ecm)) { + cPlainKeyConstCw *ck=dynamic_cast(pk); // downcast + if(ck && ck->Matches(ecm)) { pk->Get(cw); ks.OK(pk); return true;