diff --git a/Src/SerialPortList.cpp b/Src/SerialPortList.cpp index 8dddd4d9..abe380a0 100644 --- a/Src/SerialPortList.cpp +++ b/Src/SerialPortList.cpp @@ -35,12 +35,6 @@ SerialPortList::SerialPortList() //------------------------------------------------------------------------------ -SerialPortList::~SerialPortList() -{ -} - -//------------------------------------------------------------------------------ - void SerialPortList::Clear() { m_PortArray.clear(); @@ -111,26 +105,6 @@ const SerialPortInfo& SerialPortList::GetPortInfo(int Index) const //------------------------------------------------------------------------------ -// Returns the index of a serial port, given the port name. - -int SerialPortList::Find(const std::string& strPortName) const -{ - int Index = -1; - - auto it = std::find_if(m_PortArray.begin(), m_PortArray.end(), [strPortName](const SerialPortInfo& Info) { - return _stricmp(strPortName.c_str(), Info.strPortName.c_str()) == 0; - }); - - if (it != m_PortArray.end()) - { - Index = std::distance(m_PortArray.begin(), it); - } - - return Index; -} - -//------------------------------------------------------------------------------ - // Determines whether the supplied string is a valid serial port name, i.e., // has a name of the form COMx. @@ -300,7 +274,7 @@ static BOOL GetDeviceProperty( bSuccess = FALSE; } - delete[] pData; + delete [] pData; } else { @@ -345,7 +319,7 @@ bool SerialPortList::BuildPortList() if (bSuccess) { - pGUIDArray = new GUID[RequiredSize]; + pGUIDArray = new(std::nothrow) GUID[RequiredSize]; if (pGUIDArray != nullptr) { @@ -463,7 +437,7 @@ bool SerialPortList::BuildPortList() if (pGUIDArray != nullptr) { - delete[] pGUIDArray; + delete [] pGUIDArray; } // Sort the list by ascending COM port name. diff --git a/Src/SerialPortList.h b/Src/SerialPortList.h index 747bd9f1..4b29e3fc 100644 --- a/Src/SerialPortList.h +++ b/Src/SerialPortList.h @@ -34,8 +34,6 @@ class SerialPortList { public: SerialPortList(); - ~SerialPortList(); - SerialPortList(const SerialPortList&) = delete; SerialPortList& operator=(const SerialPortList&) = delete; @@ -43,7 +41,6 @@ class SerialPortList bool BuildPortList(); int GetPortCount() const; const SerialPortInfo& GetPortInfo(int Index) const; - int Find(const std::string& strPortName) const; private: void Clear();