diff --git a/reflector/Callsign.cpp b/reflector/Callsign.cpp index 79d3065..328c5e1 100644 --- a/reflector/Callsign.cpp +++ b/reflector/Callsign.cpp @@ -38,15 +38,6 @@ CCallsign::CCallsign() m_coded = 0; } -CCallsign::CCallsign(const CCallsign &cs) -{ - m_Callsign.l = cs.m_Callsign.l; - m_Suffix.u = cs.m_Suffix.u; - m_Module = cs.m_Module; - if (m_Callsign.l) - CSIn(); -} - CCallsign::CCallsign(const std::string &cs, uint32_t dmrid, uint16_t nxdnid) : CCallsign() { // and populate @@ -222,7 +213,7 @@ void CCallsign::SetCallsign(const std::string &s, bool updateids) } } -void CCallsign::SetCallsign(const uint8_t *buffer, int len, bool UpdateDmrid) +void CCallsign::SetCallsign(const uint8_t *buffer, int len, bool updateids) { // set callsign memset(m_Callsign.c, ' ', CALLSIGN_LEN); @@ -240,7 +231,7 @@ void CCallsign::SetCallsign(const uint8_t *buffer, int len, bool UpdateDmrid) m_Module = (char)buffer[CALLSIGN_LEN-1]; } CSIn(); - if ( UpdateDmrid ) + if (updateids) { auto key = GetKey(); g_LDid.Lock(); @@ -344,7 +335,7 @@ void CCallsign::PatchCallsign(int off, const char *patch, int len) //////////////////////////////////////////////////////////////////////////////////////// // get -const UCallsign CCallsign::GetKey() const +UCallsign CCallsign::GetKey() const { UCallsign rval; rval.l = 0; diff --git a/reflector/Callsign.h b/reflector/Callsign.h index c0a6901..49bb6d9 100644 --- a/reflector/Callsign.h +++ b/reflector/Callsign.h @@ -72,7 +72,7 @@ public: void PatchCallsign(int, const char *, int); // get - const UCallsign GetKey() const; + UCallsign GetKey() const; void GetCallsign(uint8_t *) const; void GetCallsignString(char *) const; const std::string GetCS() const; diff --git a/reflector/Lookup.h b/reflector/Lookup.h index bbc86bb..541204e 100644 --- a/reflector/Lookup.h +++ b/reflector/Lookup.h @@ -37,6 +37,14 @@ struct CCallsignHash } }; +struct CCallsignEqual +{ + bool operator() (const UCallsign &ucs1, const UCallsign &ucs2) const + { + return ucs1.l == ucs2.l; + } +}; + //////////////////////////////////////////////////////////////////////////////////////// diff --git a/reflector/LookupDmr.cpp b/reflector/LookupDmr.cpp index e71a7de..e239a62 100644 --- a/reflector/LookupDmr.cpp +++ b/reflector/LookupDmr.cpp @@ -37,7 +37,7 @@ void CLookupDmr::LoadParameters() m_Url.assign(g_Conf.GetString(g_Keys.dmriddb.url)); } -const uint32_t CLookupDmr::FindDmrid(const UCallsign &ucs) const +uint32_t CLookupDmr::FindDmrid(const UCallsign &ucs) const { auto found = m_DmridMap.find(ucs); if ( found != m_DmridMap.end() ) diff --git a/reflector/LookupDmr.h b/reflector/LookupDmr.h index a0f1851..b5a6d09 100644 --- a/reflector/LookupDmr.h +++ b/reflector/LookupDmr.h @@ -24,7 +24,7 @@ class CLookupDmr : public CLookup { public: ~CLookupDmr() {} - const uint32_t FindDmrid(const UCallsign &ucs) const; + uint32_t FindDmrid(const UCallsign &ucs) const; const UCallsign *FindCallsign(uint32_t dmrid) const; protected: @@ -34,5 +34,5 @@ protected: private: std::unordered_map m_CallsignMap; - std::unordered_map m_DmridMap; + std::unordered_map m_DmridMap; }; diff --git a/reflector/LookupNxdn.cpp b/reflector/LookupNxdn.cpp index 7379c8f..a6a3abe 100644 --- a/reflector/LookupNxdn.cpp +++ b/reflector/LookupNxdn.cpp @@ -47,7 +47,7 @@ const UCallsign *CLookupNxdn::FindCallsign(uint16_t nxdnid) const return nullptr; } -const uint16_t CLookupNxdn::FindNXDNid(const UCallsign &ucs) const +uint16_t CLookupNxdn::FindNXDNid(const UCallsign &ucs) const { auto found = m_NxdnidMap.find(ucs); if ( found != m_NxdnidMap.end() ) @@ -64,7 +64,7 @@ void CLookupNxdn::UpdateContent(std::stringstream &ss, Eaction action) { bool failed = true; auto l = atol(line.c_str()); // no throw guarantee - if (0 < l && l < 0x10000UL) + if (0 < l && l < 0x10000) { auto id = uint32_t(l); auto p1 = line.find(','); diff --git a/reflector/LookupNxdn.h b/reflector/LookupNxdn.h index ca503f6..9310f5e 100644 --- a/reflector/LookupNxdn.h +++ b/reflector/LookupNxdn.h @@ -23,7 +23,7 @@ class CLookupNxdn : public CLookup { public: - const uint16_t FindNXDNid(const UCallsign &ucs) const; + uint16_t FindNXDNid(const UCallsign &ucs) const; const UCallsign *FindCallsign(const uint16_t id) const; protected: void ClearContents(); @@ -32,5 +32,5 @@ protected: private: std::unordered_map m_CallsignMap; - std::unordered_map m_NxdnidMap; + std::unordered_map m_NxdnidMap; }; diff --git a/reflector/LookupYsf.h b/reflector/LookupYsf.h index 2efc11f..00d9f53 100644 --- a/reflector/LookupYsf.h +++ b/reflector/LookupYsf.h @@ -21,7 +21,7 @@ #include "YSFNode.h" #include "Lookup.h" -using CsNodeMap = std::unordered_map; +using CsNodeMap = std::unordered_map; class CLookupYsf : public CLookup { diff --git a/reflector/Main.cpp b/reflector/Main.cpp index d1b82b0..ac73d9e 100644 --- a/reflector/Main.cpp +++ b/reflector/Main.cpp @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) // define the action case 'p': - if (Eaction::err_only == action) + if (Eaction::error_only == action) { std::cerr << "You can't specify both -p and -q!\n"; usage(std::cerr, argv[0]); @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } else - action = Eaction::err_only; + action = Eaction::error_only; break; // finally