]> www.vanbest.org Git - sasc-ng.git/commitdiff
constcw: proper type cast
authorleslie <unknown>
Mon, 11 Aug 2008 12:11:55 +0000 (20:11 +0800)
committerleslie <unknown>
Mon, 11 Aug 2008 12:11:55 +0000 (20:11 +0800)
systems/constcw/constcw.c

index e6c6003366ef1cbba35e2417fabd6ad851d7a014..901c307f3fbe302c3c2c2265fe93932ba820c36a 100644 (file)
@@ -19,9 +19,7 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <malloc.h>
 #include <ctype.h>
-#include <typeinfo>
 
 #include <vdr/channels.h>
 #include <vdr/sources.h>
@@ -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<cPlainKeyConstCw *>(pk); // downcast
+    if(ck && ck->Matches(ecm)) {
       pk->Get(cw);
       ks.OK(pk);
       return true;