From: leslie Date: Mon, 11 Aug 2008 12:06:47 +0000 (+0800) Subject: constcw: fix key compare (2) X-Git-Tag: 0.9.1~40 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=fcc13337c4837b8e7f4e18c330b506b8b433d119;p=sasc-ng.git constcw: fix key compare (2) --- diff --git a/data.c b/data.c index 61a2865..4b6e3ef 100644 --- a/data.c +++ b/data.c @@ -876,13 +876,14 @@ bool cPlainKeys::AddNewKey(cPlainKey *nk, const char *reason) { cPlainKey *k; for(k=0; (k=FindKeyNoTrig(nk->type,nk->id,nk->keynr,-1,k)); ) - if(k->Cmp(nk)) return false; + if(k->CmpExtId(nk) && k->Cmp(nk)) return false; cPlainKey *ref=0; cString ks=nk->ToString(true); PRINTF(L_GEN_INFO,"key update for ID %s",*ks); ums.Queue("%s %s",tr("Key update"),*ks); for(k=0; (k=FindKeyNoTrig(nk->type,nk->id,nk->keynr,nk->Size(),k)); ) { + if(!k->CmpExtId(nk)) continue; if(nk->CanSupersede()) { PRINTF(L_GEN_INFO,"supersedes key: %s",*k->ToString(true)); DelItem(k,ScSetup.SuperKeys==0); diff --git a/data.h b/data.h index 8065f91..1f6c7d3 100644 --- a/data.h +++ b/data.h @@ -263,6 +263,7 @@ protected: virtual int IdSize(void); virtual cString Print(void)=0; virtual cString PrintKeyNr(void); + virtual bool CmpExtId(cPlainKey *k) { return true; } public: int type, id, keynr; // diff --git a/systems/constcw/constcw.c b/systems/constcw/constcw.c index aa95ee1..e6c6003 100644 --- a/systems/constcw/constcw.c +++ b/systems/constcw/constcw.c @@ -44,9 +44,9 @@ private: int freq; char pol; protected: - virtual bool Cmp(cPlainKey *k); virtual int IdSize(void) { return 4; } virtual cString PrintKeyNr(void); + virtual bool CmpExtId(cPlainKey *k); public: cPlainKeyConstCw(bool Super); virtual bool Parse(const char *line); @@ -61,10 +61,10 @@ cPlainKeyConstCw::cPlainKeyConstCw(bool Super) freq=-1; } -bool cPlainKeyConstCw::Cmp(cPlainKey *k) +bool cPlainKeyConstCw::CmpExtId(cPlainKey *k) { cPlainKeyConstCw *ck=dynamic_cast(k); // downcast - return ck && prgId==ck->prgId && source==ck->source && freq==ck->freq && pol==ck->pol && cHexKey::Cmp(k); + return ck && prgId==ck->prgId && source==ck->source && freq==ck->freq && pol==ck->pol; } bool cPlainKeyConstCw::Matches(const cEcmInfo *ecm)