Code clean-up

This commit is contained in:
Simon Rozman 2016-10-03 14:49:17 +02:00
parent 10c03ccedb
commit c53ed21d55
17 changed files with 75 additions and 76 deletions

View File

@ -92,7 +92,7 @@ wxEventTraceProcessorThread::wxEventTraceProcessorThread(wxEvtHandler *parent, c
wxEventTraceProcessorThread::~wxEventTraceProcessorThread() wxEventTraceProcessorThread::~wxEventTraceProcessorThread()
{ {
for (vector<TRACEHANDLE>::iterator trace = m_traces.begin(), trace_end = m_traces.end(); trace != trace_end; ++trace) { for (auto trace = m_traces.begin(), trace_end = m_traces.end(); trace != trace_end; ++trace) {
TRACEHANDLE &h = *trace; TRACEHANDLE &h = *trace;
if (h) { if (h) {
// Close trace. // Close trace.
@ -104,7 +104,7 @@ wxEventTraceProcessorThread::~wxEventTraceProcessorThread()
void wxEventTraceProcessorThread::Abort() void wxEventTraceProcessorThread::Abort()
{ {
for (vector<TRACEHANDLE>::iterator trace = m_traces.begin(), trace_end = m_traces.end(); trace != trace_end; ++trace) { for (auto trace = m_traces.begin(), trace_end = m_traces.end(); trace != trace_end; ++trace) {
TRACEHANDLE &h = *trace; TRACEHANDLE &h = *trace;
if (h) { if (h) {
// Close trace. // Close trace.
@ -415,7 +415,7 @@ void wxETWListCtrl::RebuildItems()
// Rebuild the index. // Rebuild the index.
m_rec_idx.clear(); m_rec_idx.clear();
set<size_t>::const_iterator selection_end = selection.end(), focus_end = focus.end(); auto selection_end = selection.cend(), focus_end = focus.cend();
vector<long> selection_out, focus_out; vector<long> selection_out, focus_out;
long center_out = -1; long center_out = -1;
for (size_t i = 0, n = m_rec_db.size(); i < n; i++) { for (size_t i = 0, n = m_rec_db.size(); i < n; i++) {
@ -709,7 +709,7 @@ void wxPersistentETWListCtrl::Save() const
SaveValue(wxT("ScrollAuto"), wnd->m_scroll_auto); SaveValue(wxT("ScrollAuto"), wnd->m_scroll_auto);
wxString data_str; wxString data_str;
for (wxETWListCtrl::guidset::const_iterator src = wnd->m_sources.cbegin(), src_end = wnd->m_sources.cend(); src != src_end; ++src) for (auto src = wnd->m_sources.cbegin(), src_end = wnd->m_sources.cend(); src != src_end; ++src)
data_str += tstring_guid(*src); data_str += tstring_guid(*src);
SaveValue(wxT("Sources"), data_str); SaveValue(wxT("Sources"), data_str);

View File

@ -161,7 +161,7 @@ public:
inline void EnableSource(const GUID &guid, bool enable = true) inline void EnableSource(const GUID &guid, bool enable = true)
{ {
guidset::iterator s = m_sources.find(guid); auto s = m_sources.find(guid);
if (enable) { if (enable) {
if (s == m_sources.end()) { if (s == m_sources.end()) {
m_sources.insert(guid); m_sources.insert(guid);

View File

@ -720,7 +720,7 @@ namespace eap
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const bool &val) inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const bool &val)
{ {
eap::cursor_out::ptr_type ptr_end = cursor.ptr + 1; auto ptr_end = cursor.ptr + 1;
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
*cursor.ptr = val ? 1 : 0; *cursor.ptr = val ? 1 : 0;
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -736,7 +736,7 @@ inline size_t pksizeof(_In_ const bool &val)
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ bool &val) inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ bool &val)
{ {
eap::cursor_in::ptr_type ptr_end = cursor.ptr + 1; auto ptr_end = cursor.ptr + 1;
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
val = *cursor.ptr ? true : false; val = *cursor.ptr ? true : false;
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -745,7 +745,7 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ bool &val)
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned char &val) inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned char &val)
{ {
eap::cursor_out::ptr_type ptr_end = cursor.ptr + 1; auto ptr_end = cursor.ptr + 1;
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
*cursor.ptr = val; *cursor.ptr = val;
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -761,7 +761,7 @@ inline size_t pksizeof(_In_ const unsigned char &val)
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned char &val) inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned char &val)
{ {
eap::cursor_in::ptr_type ptr_end = cursor.ptr + 1; auto ptr_end = cursor.ptr + 1;
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
val = *cursor.ptr; val = *cursor.ptr;
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -770,7 +770,7 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned char &val)
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned int &val) inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned int &val)
{ {
eap::cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(unsigned int); auto ptr_end = cursor.ptr + sizeof(unsigned int);
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
*reinterpret_cast<unsigned int*>(cursor.ptr) = val; *reinterpret_cast<unsigned int*>(cursor.ptr) = val;
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -786,7 +786,7 @@ inline size_t pksizeof(_In_ const unsigned int &val)
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned int &val) inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned int &val)
{ {
eap::cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(unsigned int); auto ptr_end = cursor.ptr + sizeof(unsigned int);
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
val = *reinterpret_cast<const unsigned int*>(cursor.ptr); val = *reinterpret_cast<const unsigned int*>(cursor.ptr);
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -796,7 +796,7 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned int &val)
#ifdef _WIN64 #ifdef _WIN64
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const size_t &val) inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const size_t &val)
{ {
eap::cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(size_t); auto ptr_end = cursor.ptr + sizeof(size_t);
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
*(size_t*)cursor.ptr = val; *(size_t*)cursor.ptr = val;
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -812,7 +812,7 @@ inline size_t pksizeof(_In_ const size_t &val)
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ size_t &val) inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ size_t &val)
{ {
eap::cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(size_t); auto ptr_end = cursor.ptr + sizeof(size_t);
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
val = *(size_t*)cursor.ptr; val = *(size_t*)cursor.ptr;
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -823,10 +823,10 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ size_t &val)
template<class _Elem, class _Traits, class _Ax> template<class _Elem, class _Traits, class _Ax>
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val) inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val)
{ {
std::basic_string<_Elem, _Traits, _Ax>::size_type count = val.length(); size_t count = val.length();
assert(strlen(val.c_str()) == count); // String should not contain zero terminators. assert(strlen(val.c_str()) == count); // String should not contain zero terminators.
size_t size = sizeof(_Elem)*(count + 1); size_t size = sizeof(_Elem)*(count + 1);
eap::cursor_out::ptr_type ptr_end = cursor.ptr + size; auto ptr_end = cursor.ptr + size;
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
memcpy(cursor.ptr, (const _Elem*)val.c_str(), size); memcpy(cursor.ptr, (const _Elem*)val.c_str(), size);
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -844,7 +844,7 @@ template<class _Elem, class _Traits, class _Ax>
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val) inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val)
{ {
size_t count_max = cursor.ptr_end - cursor.ptr; size_t count_max = cursor.ptr_end - cursor.ptr;
std::basic_string<_Elem, _Traits, _Ax>::size_type count = strnlen((const _Elem*&)cursor.ptr, count_max); size_t count = strnlen((const _Elem*&)cursor.ptr, count_max);
assert(count < count_max); // String should be zero terminated. assert(count < count_max); // String should be zero terminated.
val.assign((const _Elem*&)cursor.ptr, count); val.assign((const _Elem*&)cursor.ptr, count);
cursor.ptr += sizeof(_Elem)*(count + 1); cursor.ptr += sizeof(_Elem)*(count + 1);
@ -879,13 +879,13 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string<w
template<class _Ty, class _Ax> template<class _Ty, class _Ax>
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::vector<_Ty, _Ax> &val) inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::vector<_Ty, _Ax> &val)
{ {
std::vector<_Ty, _Ax>::size_type count = val.size(); auto count = val.size();
cursor << count; cursor << count;
// Since we do not know wheter vector elements are primitives or objects, iterate instead of memcpy. // Since we do not know wheter vector elements are primitives or objects, iterate instead of memcpy.
// For performance critical vectors of flat opaque data types write specialized template instantiation. // For performance critical vectors of flat opaque data types write specialized template instantiation.
for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) for (auto i = val.cbegin(), i_end = val.cend(); i != i_end; ++i)
cursor << val[i]; cursor << *i;
} }
@ -894,10 +894,10 @@ inline size_t pksizeof(const std::vector<_Ty, _Ax> &val)
{ {
// Since we do not know wheter vector elements are primitives or objects, iterate instead of sizeof(). // Since we do not know wheter vector elements are primitives or objects, iterate instead of sizeof().
// For performance critical vectors of flat opaque data types write specialized template instantiation. // For performance critical vectors of flat opaque data types write specialized template instantiation.
std::vector<_Ty, _Ax>::size_type count = val.size(); auto count = val.size();
size_t size = pksizeof(count); size_t size = pksizeof(count);
for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) for (auto i = val.cbegin(), i_end = val.cend(); i != i_end; ++i)
size += pksizeof(val[i]); size += pksizeof(*i);
return size; return size;
} }
@ -905,14 +905,14 @@ inline size_t pksizeof(const std::vector<_Ty, _Ax> &val)
template<class _Ty, class _Ax> template<class _Ty, class _Ax>
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::vector<_Ty, _Ax> &val) inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::vector<_Ty, _Ax> &val)
{ {
std::vector<_Ty, _Ax>::size_type count; std::vector<_Ty, _Ax>::size_type i, count;
cursor >> count; cursor >> count;
// Since we do not know wheter vector elements are primitives or objects, iterate instead of assign(). // Since we do not know wheter vector elements are primitives or objects, iterate instead of assign().
// For performance critical vectors of flat opaque data types write specialized template instantiation. // For performance critical vectors of flat opaque data types write specialized template instantiation.
val.clear(); val.clear();
val.reserve(count); val.reserve(count);
for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) { for (i = 0; i < count; i++) {
_Ty el; _Ty el;
cursor >> el; cursor >> el;
val.push_back(el); val.push_back(el);
@ -923,12 +923,12 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::vector<_Ty, _A
template<class _Ty, class _Ax> template<class _Ty, class _Ax>
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::list<_Ty, _Ax> &val) inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::list<_Ty, _Ax> &val)
{ {
std::list<_Ty, _Ax>::size_type count = val.size(); auto count = val.size();
cursor << count; cursor << count;
// Since we do not know wheter list elements are primitives or objects, iterate instead of memcpy. // Since we do not know wheter list elements are primitives or objects, iterate instead of memcpy.
// For performance critical vectors of flat opaque data types write specialized template instantiation. // For performance critical vectors of flat opaque data types write specialized template instantiation.
for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i) for (auto i = val.cbegin(), i_end = val.cend(); i != i_end; ++i)
cursor << *i; cursor << *i;
} }
@ -938,9 +938,9 @@ inline size_t pksizeof(const std::list<_Ty, _Ax> &val)
{ {
// Since we do not know wheter list elements are primitives or objects, iterate instead of sizeof(). // Since we do not know wheter list elements are primitives or objects, iterate instead of sizeof().
// For performance critical vectors of flat opaque data types write specialized template instantiation. // For performance critical vectors of flat opaque data types write specialized template instantiation.
std::list<_Ty, _Ax>::size_type count = val.size(); auto count = val.size();
size_t size = pksizeof(count); size_t size = pksizeof(count);
for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i) for (auto i = val.cbegin(), i_end = val.cend(); i != i_end; ++i)
size += pksizeof(*i); size += pksizeof(*i);
return size; return size;
} }
@ -949,13 +949,11 @@ inline size_t pksizeof(const std::list<_Ty, _Ax> &val)
template<class _Ty, class _Ax> template<class _Ty, class _Ax>
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::list<_Ty, _Ax> &val) inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::list<_Ty, _Ax> &val)
{ {
std::list<_Ty, _Ax>::size_type count; std::list<_Ty, _Ax>::size_type i, count;
cursor >> count; cursor >> count;
// Since we do not know wheter list elements are primitives or objects, iterate instead of assign().
// For performance critical vectors of flat opaque data types write specialized template instantiation.
val.clear(); val.clear();
for (std::list<_Ty, _Ax>::size_type i = 0; i < count; i++) { for (i = 0; i < count; i++) {
_Ty el; _Ty el;
cursor >> el; cursor >> el;
val.push_back(el); val.push_back(el);
@ -990,7 +988,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::cert_
if (val) { if (val) {
cursor << (unsigned int)val->dwCertEncodingType; cursor << (unsigned int)val->dwCertEncodingType;
cursor << (unsigned int)val->cbCertEncoded ; cursor << (unsigned int)val->cbCertEncoded ;
eap::cursor_out::ptr_type ptr_end = cursor.ptr + val->cbCertEncoded; auto ptr_end = cursor.ptr + val->cbCertEncoded;
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
memcpy(cursor.ptr, val->pbCertEncoded, val->cbCertEncoded); memcpy(cursor.ptr, val->pbCertEncoded, val->cbCertEncoded);
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -1022,7 +1020,7 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::cert_contex
cursor >> (unsigned int&)dwCertEncodedSize; cursor >> (unsigned int&)dwCertEncodedSize;
if (dwCertEncodedSize) { if (dwCertEncodedSize) {
eap::cursor_in::ptr_type ptr_end = cursor.ptr + dwCertEncodedSize; auto ptr_end = cursor.ptr + dwCertEncodedSize;
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
val.create(dwCertEncodingType, (BYTE*)cursor.ptr, dwCertEncodedSize); val.create(dwCertEncodingType, (BYTE*)cursor.ptr, dwCertEncodedSize);
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -1052,7 +1050,7 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::eap_type_t
template<size_t N> template<size_t N>
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::sanitizing_blob_f<N> &val) inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::sanitizing_blob_f<N> &val)
{ {
eap::cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(eap::sanitizing_blob_f<N>); auto ptr_end = cursor.ptr + sizeof(eap::sanitizing_blob_f<N>);
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
memcpy(cursor.ptr, val.data, sizeof(eap::sanitizing_blob_f<N>)); memcpy(cursor.ptr, val.data, sizeof(eap::sanitizing_blob_f<N>));
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -1070,7 +1068,7 @@ inline size_t pksizeof(_In_ const eap::sanitizing_blob_f<N> &val)
template<size_t N> template<size_t N>
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::sanitizing_blob_f<N> &val) inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::sanitizing_blob_f<N> &val)
{ {
eap::cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(eap::sanitizing_blob_f<N>); auto ptr_end = cursor.ptr + sizeof(eap::sanitizing_blob_f<N>);
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
memcpy(val.data, cursor.ptr, sizeof(eap::sanitizing_blob_f<N>)); memcpy(val.data, cursor.ptr, sizeof(eap::sanitizing_blob_f<N>));
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -1079,7 +1077,7 @@ inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::sanitizing_blo
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const GUID &val) inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const GUID &val)
{ {
eap::cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(GUID); auto ptr_end = cursor.ptr + sizeof(GUID);
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
memcpy(cursor.ptr, &val, sizeof(GUID)); memcpy(cursor.ptr, &val, sizeof(GUID));
cursor.ptr = ptr_end; cursor.ptr = ptr_end;
@ -1095,7 +1093,7 @@ inline size_t pksizeof(_In_ const GUID &val)
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ GUID &val) inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ GUID &val)
{ {
eap::cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(GUID); auto ptr_end = cursor.ptr + sizeof(GUID);
assert(ptr_end <= cursor.ptr_end); assert(ptr_end <= cursor.ptr_end);
memcpy(&val, cursor.ptr, sizeof(GUID)); memcpy(&val, cursor.ptr, sizeof(GUID));
cursor.ptr = ptr_end; cursor.ptr = ptr_end;

View File

@ -162,7 +162,7 @@ namespace eap
desc.reserve(count + 2); desc.reserve(count + 2);
desc.push_back(winstd::event_data( name )); desc.push_back(winstd::event_data( name ));
desc.push_back(winstd::event_data((unsigned int)count)); desc.push_back(winstd::event_data((unsigned int)count));
for (std::list<std::basic_string<char, _Traits, _Ax>, _Ax_list>::const_iterator v = value.cbegin(), v_end = value.cend(); v != v_end; ++v) for (auto v = value.cbegin(), v_end = value.cend(); v != v_end; ++v)
desc.push_back(winstd::event_data(*v)); desc.push_back(winstd::event_data(*v));
m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_ANSI_STRING_ARRAY, (ULONG)desc.size(), desc.data()); m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_ANSI_STRING_ARRAY, (ULONG)desc.size(), desc.data());
@ -180,7 +180,7 @@ namespace eap
desc.reserve(count + 2); desc.reserve(count + 2);
desc.push_back(winstd::event_data( name )); desc.push_back(winstd::event_data( name ));
desc.push_back(winstd::event_data((unsigned int)count)); desc.push_back(winstd::event_data((unsigned int)count));
for (std::list<std::basic_string<wchar_t, _Traits, _Ax>, _Ax_list>::const_iterator v = value.cbegin(), v_end = value.cend(); v != v_end; ++v) for (auto v = value.cbegin(), v_end = value.cend(); v != v_end; ++v)
desc.push_back(winstd::event_data(*v)); desc.push_back(winstd::event_data(*v));
m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_UNICODE_STRING_ARRAY, (ULONG)desc.size(), desc.data()); m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_UNICODE_STRING_ARRAY, (ULONG)desc.size(), desc.data());

View File

@ -375,7 +375,7 @@ eap::config_provider::config_provider(_In_ const config_provider &other) :
config (other ) config (other )
{ {
m_methods.reserve(other.m_methods.size()); m_methods.reserve(other.m_methods.size());
for (vector<unique_ptr<config_method> >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method) for (auto method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method)
m_methods.push_back(std::move(unique_ptr<config_method>(*method ? dynamic_cast<config_method*>(method->get()->clone()) : nullptr))); m_methods.push_back(std::move(unique_ptr<config_method>(*method ? dynamic_cast<config_method*>(method->get()->clone()) : nullptr)));
} }
@ -414,7 +414,7 @@ eap::config_provider& eap::config_provider::operator=(_In_ const config_provider
m_methods.clear(); m_methods.clear();
m_methods.reserve(other.m_methods.size()); m_methods.reserve(other.m_methods.size());
for (vector<unique_ptr<config_method> >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method) for (auto method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method)
m_methods.push_back(std::move(unique_ptr<config_method>(*method ? dynamic_cast<config_method*>(method->get()->clone()) : nullptr))); m_methods.push_back(std::move(unique_ptr<config_method>(*method ? dynamic_cast<config_method*>(method->get()->clone()) : nullptr)));
} }
@ -519,7 +519,7 @@ void eap::config_provider::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pC
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:AuthenticationMethods"), bstr(L"AuthenticationMethods"), namespace_eapmetadata, pXmlElAuthenticationMethods))) if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:AuthenticationMethods"), bstr(L"AuthenticationMethods"), namespace_eapmetadata, pXmlElAuthenticationMethods)))
throw com_runtime_error(hr, __FUNCTION__ " Error creating <AuthenticationMethods> element."); throw com_runtime_error(hr, __FUNCTION__ " Error creating <AuthenticationMethods> element.");
for (vector<unique_ptr<config_method> >::const_iterator method = m_methods.cbegin(), method_end = m_methods.cend(); method != method_end; ++method) { for (auto method = m_methods.cbegin(), method_end = m_methods.cend(); method != method_end; ++method) {
// <AuthenticationMethod> // <AuthenticationMethod>
com_obj<IXMLDOMElement> pXmlElAuthenticationMethod; com_obj<IXMLDOMElement> pXmlElAuthenticationMethod;
if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"AuthenticationMethod"), namespace_eapmetadata, pXmlElAuthenticationMethod))) if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"AuthenticationMethod"), namespace_eapmetadata, pXmlElAuthenticationMethod)))
@ -685,11 +685,12 @@ void eap::config_provider::operator>>(_Inout_ cursor_in &cursor)
cursor >> m_lbl_alt_identity ; cursor >> m_lbl_alt_identity ;
cursor >> m_lbl_alt_password ; cursor >> m_lbl_alt_password ;
list<config_method>::size_type count; list<config_method>::size_type i, count;
bool is_nonnull;
cursor >> count; cursor >> count;
m_methods.clear(); m_methods.clear();
for (list<config_method>::size_type i = 0; i < count; i++) { m_methods.reserve(count);
for (i = 0; i < count; i++) {
bool is_nonnull;
cursor >> is_nonnull; cursor >> is_nonnull;
if (is_nonnull) { if (is_nonnull) {
unique_ptr<config_method> el(m_module.make_config_method()); unique_ptr<config_method> el(m_module.make_config_method());
@ -763,7 +764,7 @@ void eap::config_connection::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList"), bstr(L"EAPIdentityProviderList"), namespace_eapmetadata, pXmlElIdentityProviderList))) if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList"), bstr(L"EAPIdentityProviderList"), namespace_eapmetadata, pXmlElIdentityProviderList)))
throw com_runtime_error(hr, __FUNCTION__ " Error creating <EAPIdentityProviderList> element."); throw com_runtime_error(hr, __FUNCTION__ " Error creating <EAPIdentityProviderList> element.");
for (provider_list::const_iterator provider = m_providers.cbegin(), provider_end = m_providers.cend(); provider != provider_end; ++provider) { for (auto provider = m_providers.cbegin(), provider_end = m_providers.cend(); provider != provider_end; ++provider) {
// <EAPIdentityProvider> // <EAPIdentityProvider>
com_obj<IXMLDOMElement> pXmlElIdentityProvider; com_obj<IXMLDOMElement> pXmlElIdentityProvider;
if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"EAPIdentityProvider"), namespace_eapmetadata, pXmlElIdentityProvider))) if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"EAPIdentityProvider"), namespace_eapmetadata, pXmlElIdentityProvider)))
@ -825,10 +826,10 @@ void eap::config_connection::operator>>(_Inout_ cursor_in &cursor)
{ {
config::operator>>(cursor); config::operator>>(cursor);
provider_list::size_type count; provider_list::size_type i, count;
cursor >> count; cursor >> count;
m_providers.clear(); m_providers.clear();
for (provider_list::size_type i = 0; i < count; i++) { for (i = 0; i < count; i++) {
config_provider el(m_module); config_provider el(m_module);
cursor >> el; cursor >> el;
m_providers.push_back(std::move(el)); m_providers.push_back(std::move(el));

View File

@ -657,7 +657,7 @@ void eap::credentials_connection::load(_In_ IXMLDOMNode *pConfigRoot)
m_module.log_config((xpath + L" ID").c_str(), m_id.c_str()); m_module.log_config((xpath + L" ID").c_str(), m_id.c_str());
// Look-up the provider. // Look-up the provider.
for (config_connection::provider_list::const_iterator cfg_prov = m_cfg.m_providers.cbegin(), cfg_prov_end = m_cfg.m_providers.cend(); ; ++cfg_prov) { for (auto cfg_prov = m_cfg.m_providers.cbegin(), cfg_prov_end = m_cfg.m_providers.cend(); ; ++cfg_prov) {
if (cfg_prov != cfg_prov_end) { if (cfg_prov != cfg_prov_end) {
if (match(*cfg_prov)) { if (match(*cfg_prov)) {
// Matching provider found. Create matching blank credential set, then load. // Matching provider found. Create matching blank credential set, then load.
@ -700,7 +700,7 @@ void eap::credentials_connection::operator>>(_Inout_ cursor_in &cursor)
cursor >> m_id ; cursor >> m_id ;
// Look-up the provider. // Look-up the provider.
for (config_connection::provider_list::const_iterator cfg_prov = m_cfg.m_providers.cbegin(), cfg_prov_end = m_cfg.m_providers.cend(); ; ++cfg_prov) { for (auto cfg_prov = m_cfg.m_providers.cbegin(), cfg_prov_end = m_cfg.m_providers.cend(); ; ++cfg_prov) {
if (cfg_prov != cfg_prov_end) { if (cfg_prov != cfg_prov_end) {
if (match(*cfg_prov)) { if (match(*cfg_prov)) {
// Matching provider found. Create matching blank credential set, then read. // Matching provider found. Create matching blank credential set, then read.

View File

@ -203,10 +203,10 @@ public:
std::unique_ptr<eap::config_method> cfg_dummy(cfg.m_module.make_config_method()); std::unique_ptr<eap::config_method> cfg_dummy(cfg.m_module.make_config_method());
m_banner->m_title->SetLabel(wxString::Format("%s %s", wxT(PRODUCT_NAME_STR), cfg_dummy->get_method_str())); m_banner->m_title->SetLabel(wxString::Format("%s %s", wxT(PRODUCT_NAME_STR), cfg_dummy->get_method_str()));
for (eap::config_connection::provider_list::iterator provider = m_cfg.m_providers.begin(), provider_end = m_cfg.m_providers.end(); provider != provider_end; ++provider) { for (auto provider = m_cfg.m_providers.begin(), provider_end = m_cfg.m_providers.end(); provider != provider_end; ++provider) {
bool is_single = provider->m_methods.size() == 1; bool is_single = provider->m_methods.size() == 1;
std::vector<std::unique_ptr<eap::config_method> >::size_type count = 0; std::vector<std::unique_ptr<eap::config_method> >::size_type count = 0;
std::vector<std::unique_ptr<eap::config_method> >::iterator method = provider->m_methods.begin(), method_end = provider->m_methods.end(); auto method = provider->m_methods.begin(), method_end = provider->m_methods.end();
for (; method != method_end; ++method, count++) { for (; method != method_end; ++method, count++) {
m_providers->AddPage( m_providers->AddPage(
new _wxT( new _wxT(
@ -299,7 +299,7 @@ protected:
if (wxMessageBox(tstring_printf(_("Are you sure you want to permanently remove %ls provider from configuration?"), wxEAPGetProviderName(cfg_provider.m_name).c_str()), _("Warning"), wxYES_NO, this) == wxYES) { if (wxMessageBox(tstring_printf(_("Are you sure you want to permanently remove %ls provider from configuration?"), wxEAPGetProviderName(cfg_provider.m_name).c_str()), _("Warning"), wxYES_NO, this) == wxYES) {
// Delete provider. // Delete provider.
eap::config_connection::provider_list::iterator it(m_cfg.m_providers.begin()); auto it = m_cfg.m_providers.begin();
for (int i = 0; i < idx; i++, ++it); for (int i = 0; i < idx; i++, ++it);
m_cfg.m_providers.erase(it); m_cfg.m_providers.erase(it);
m_providers->DeletePage(idx); m_providers->DeletePage(idx);

View File

@ -528,7 +528,7 @@ void eap::monitor_ui::release_slaves(_In_bytecount_(size) const void *data, _In_
{ {
assert(!size || data); assert(!size || data);
for (list<HWND>::const_iterator slave = m_slaves.begin(), slave_end = m_slaves.end(); slave != slave_end; ++slave) { for (auto slave = m_slaves.cbegin(), slave_end = m_slaves.cend(); slave != slave_end; ++slave) {
// Get slave's PID. // Get slave's PID.
DWORD pid_slave; DWORD pid_slave;
GetWindowThreadProcessId(*slave, &pid_slave); GetWindowThreadProcessId(*slave, &pid_slave);

View File

@ -198,7 +198,7 @@ void eap::method_mschapv2::process_success(_In_ const list<string> &argv)
{ {
m_success = false; m_success = false;
for (list<string>::const_iterator arg = argv.cbegin(), arg_end = argv.cend(); arg != arg_end; ++arg) { for (auto arg = argv.cbegin(), arg_end = argv.cend(); arg != arg_end; ++arg) {
const string &val = *arg; const string &val = *arg;
if ((val[0] == 'S' || val[0] == 's') && val[1] == '=') { if ((val[0] == 'S' || val[0] == 's') && val[1] == '=') {
// "S=" // "S="
@ -227,7 +227,7 @@ void eap::method_mschapv2::process_success(_In_ const list<string> &argv)
void eap::method_mschapv2::process_error(_In_ const list<string> &argv) void eap::method_mschapv2::process_error(_In_ const list<string> &argv)
{ {
for (list<string>::const_iterator arg = argv.cbegin(), arg_end = argv.cend(); arg != arg_end; ++arg) { for (auto arg = argv.cbegin(), arg_end = argv.cend(); arg != arg_end; ++arg) {
const string &val = *arg; const string &val = *arg;
if ((val[0] == 'E' || val[0] == 'e') && val[1] == '=') { if ((val[0] == 'E' || val[0] == 'e') && val[1] == '=') {
DWORD dwResult = strtoul(val.data() + 2, NULL, 10); DWORD dwResult = strtoul(val.data() + 2, NULL, 10);

View File

@ -148,7 +148,7 @@ void eap::config_method_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ServerSideCredential"), bstr(L"ServerSideCredential"), namespace_eapmetadata, pXmlElServerSideCredential))) if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ServerSideCredential"), bstr(L"ServerSideCredential"), namespace_eapmetadata, pXmlElServerSideCredential)))
throw com_runtime_error(hr, __FUNCTION__ " Error creating <ServerSideCredential> element."); throw com_runtime_error(hr, __FUNCTION__ " Error creating <ServerSideCredential> element.");
for (list<cert_context>::const_iterator i = m_trusted_root_ca.begin(), i_end = m_trusted_root_ca.end(); i != i_end; ++i) { for (auto i = m_trusted_root_ca.cbegin(), i_end = m_trusted_root_ca.cend(); i != i_end; ++i) {
// <CA> // <CA>
com_obj<IXMLDOMElement> pXmlElCA; com_obj<IXMLDOMElement> pXmlElCA;
if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"CA"), namespace_eapmetadata, pXmlElCA))) if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"CA"), namespace_eapmetadata, pXmlElCA)))
@ -168,7 +168,7 @@ void eap::config_method_tls::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *
} }
// <ServerName> // <ServerName>
for (list<wstring>::const_iterator i = m_server_names.begin(), i_end = m_server_names.end(); i != i_end; ++i) { for (auto i = m_server_names.cbegin(), i_end = m_server_names.cend(); i != i_end; ++i) {
if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElServerSideCredential, bstr(L"ServerName"), namespace_eapmetadata, bstr(*i)))) if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElServerSideCredential, bstr(L"ServerName"), namespace_eapmetadata, bstr(*i))))
throw com_runtime_error(hr, __FUNCTION__ " Error creating <ServerName> element."); throw com_runtime_error(hr, __FUNCTION__ " Error creating <ServerName> element.");
} }
@ -221,7 +221,7 @@ void eap::config_method_tls::load(_In_ IXMLDOMNode *pConfigRoot)
// Log loaded CA certificates. // Log loaded CA certificates.
list<tstring> cert_names; list<tstring> cert_names;
for (std::list<winstd::cert_context>::const_iterator cert = m_trusted_root_ca.cbegin(), cert_end = m_trusted_root_ca.cend(); cert != cert_end; ++cert) for (auto cert = m_trusted_root_ca.cbegin(), cert_end = m_trusted_root_ca.cend(); cert != cert_end; ++cert)
cert_names.push_back(std::move(get_cert_title(*cert))); cert_names.push_back(std::move(get_cert_title(*cert)));
m_module.log_config((xpathServerSideCredential + L"/CA").c_str(), cert_names); m_module.log_config((xpathServerSideCredential + L"/CA").c_str(), cert_names);
} }
@ -311,7 +311,7 @@ bool eap::config_method_tls::add_trusted_ca(_In_ DWORD dwCertEncodingType, _In_
return false; return false;
} }
for (list<cert_context>::const_iterator i = m_trusted_root_ca.cbegin(), i_end = m_trusted_root_ca.cend();; ++i) { for (auto i = m_trusted_root_ca.cbegin(), i_end = m_trusted_root_ca.cend();; ++i) {
if (i != i_end) { if (i != i_end) {
if (*i == cert) { if (*i == cert) {
// This certificate is already on the list. // This certificate is already on the list.

View File

@ -199,7 +199,7 @@ void eap::method_tls::begin_session(
#else #else
// Build (expected) server name(s) for Schannel. // Build (expected) server name(s) for Schannel.
m_sc_target_name.clear(); m_sc_target_name.clear();
for (list<wstring>::const_iterator name = m_cfg.m_server_names.cbegin(), name_end = m_cfg.m_server_names.cend(); name != name_end; ++name) { for (auto name = m_cfg.m_server_names.cbegin(), name_end = m_cfg.m_server_names.cend(); name != name_end; ++name) {
if (name != m_cfg.m_server_names.cbegin()) if (name != m_cfg.m_server_names.cbegin())
m_sc_target_name += _T(';'); m_sc_target_name += _T(';');
#ifdef _UNICODE #ifdef _UNICODE
@ -1294,7 +1294,7 @@ void eap::method_tls::verify_server_trust() const
throw sec_runtime_error(status, __FUNCTION__ " Error retrieving server certificate from Schannel."); throw sec_runtime_error(status, __FUNCTION__ " Error retrieving server certificate from Schannel.");
#endif #endif
for (list<cert_context>::const_iterator c = m_cfg.m_trusted_root_ca.cbegin(), c_end = m_cfg.m_trusted_root_ca.cend(); c != c_end; ++c) { for (auto c = m_cfg.m_trusted_root_ca.cbegin(), c_end = m_cfg.m_trusted_root_ca.cend(); c != c_end; ++c) {
if (cert->cbCertEncoded == (*c)->cbCertEncoded && if (cert->cbCertEncoded == (*c)->cbCertEncoded &&
memcmp(cert->pbCertEncoded, (*c)->pbCertEncoded, cert->cbCertEncoded) == 0) memcmp(cert->pbCertEncoded, (*c)->pbCertEncoded, cert->cbCertEncoded) == 0)
{ {
@ -1343,7 +1343,7 @@ void eap::method_tls::verify_server_trust() const
} }
has_san = true; has_san = true;
for (list<wstring>::const_iterator s = m_cfg.m_server_names.cbegin(), s_end = m_cfg.m_server_names.cend(); !found && s != s_end; ++s) { for (auto s = m_cfg.m_server_names.cbegin(), s_end = m_cfg.m_server_names.cend(); !found && s != s_end; ++s) {
for (DWORD idx_entry = 0; !found && idx_entry < san_info->cAltEntry; idx_entry++) { for (DWORD idx_entry = 0; !found && idx_entry < san_info->cAltEntry; idx_entry++) {
if (san_info->rgAltEntry[idx_entry].dwAltNameChoice == CERT_ALT_NAME_DNS_NAME && if (san_info->rgAltEntry[idx_entry].dwAltNameChoice == CERT_ALT_NAME_DNS_NAME &&
_wcsicmp(s->c_str(), san_info->rgAltEntry[idx_entry].pwszDNSName) == 0) _wcsicmp(s->c_str(), san_info->rgAltEntry[idx_entry].pwszDNSName) == 0)
@ -1361,7 +1361,7 @@ void eap::method_tls::verify_server_trust() const
if (!CertGetNameStringW(cert, CERT_NAME_DNS_TYPE, CERT_NAME_STR_ENABLE_PUNYCODE_FLAG, NULL, subj)) if (!CertGetNameStringW(cert, CERT_NAME_DNS_TYPE, CERT_NAME_STR_ENABLE_PUNYCODE_FLAG, NULL, subj))
throw win_runtime_error(__FUNCTION__ " Error retrieving server's certificate subject name."); throw win_runtime_error(__FUNCTION__ " Error retrieving server's certificate subject name.");
for (list<wstring>::const_iterator s = m_cfg.m_server_names.cbegin(), s_end = m_cfg.m_server_names.cend(); !found && s != s_end; ++s) { for (auto s = m_cfg.m_server_names.cbegin(), s_end = m_cfg.m_server_names.cend(); !found && s != s_end; ++s) {
if (_wcsicmp(s->c_str(), subj.c_str()) == 0) { if (_wcsicmp(s->c_str(), subj.c_str()) == 0) {
m_module.log_event(&EAPMETHOD_TLS_SERVER_NAME_TRUSTED1, event_data(subj), event_data::blank); m_module.log_event(&EAPMETHOD_TLS_SERVER_NAME_TRUSTED1, event_data(subj), event_data::blank);
found = true; found = true;
@ -1381,12 +1381,12 @@ void eap::method_tls::verify_server_trust() const
cert_store store; cert_store store;
if (!store.create(CERT_STORE_PROV_MEMORY, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, NULL, 0, NULL)) if (!store.create(CERT_STORE_PROV_MEMORY, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, NULL, 0, NULL))
throw win_runtime_error(__FUNCTION__ " Error creating temporary certificate store."); throw win_runtime_error(__FUNCTION__ " Error creating temporary certificate store.");
for (list<cert_context>::const_iterator c = m_cfg.m_trusted_root_ca.cbegin(), c_end = m_cfg.m_trusted_root_ca.cend(); c != c_end; ++c) for (auto c = m_cfg.m_trusted_root_ca.cbegin(), c_end = m_cfg.m_trusted_root_ca.cend(); c != c_end; ++c)
CertAddCertificateContextToStore(store, *c, CERT_STORE_ADD_REPLACE_EXISTING, NULL); CertAddCertificateContextToStore(store, *c, CERT_STORE_ADD_REPLACE_EXISTING, NULL);
// Add all intermediate certificates from the server's certificate chain. // Add all intermediate certificates from the server's certificate chain.
#if EAP_TLS < EAP_TLS_SCHANNEL #if EAP_TLS < EAP_TLS_SCHANNEL
for (list<cert_context>::const_iterator c = m_server_cert_chain.cbegin(), c_end = m_server_cert_chain.cend(); ++c != c_end;) { for (auto c = m_server_cert_chain.cbegin(), c_end = m_server_cert_chain.cend(); ++c != c_end;) {
const cert_context &_c = *c; const cert_context &_c = *c;
if (_c->pCertInfo->Issuer.cbData == _c->pCertInfo->Subject.cbData && if (_c->pCertInfo->Issuer.cbData == _c->pCertInfo->Subject.cbData &&
memcmp(_c->pCertInfo->Issuer.pbData, _c->pCertInfo->Subject.pbData, _c->pCertInfo->Issuer.cbData) == 0) memcmp(_c->pCertInfo->Issuer.pbData, _c->pCertInfo->Subject.pbData, _c->pCertInfo->Issuer.cbData) == 0)
@ -1453,7 +1453,7 @@ void eap::method_tls::verify_server_trust() const
throw sec_runtime_error(SEC_E_CERT_UNKNOWN, __FUNCTION__ " Can not verify empty certificate chain."); throw sec_runtime_error(SEC_E_CERT_UNKNOWN, __FUNCTION__ " Can not verify empty certificate chain.");
PCCERT_CONTEXT cert_root = context->rgpChain[0]->rgpElement[context->rgpChain[0]->cElement-1]->pCertContext; PCCERT_CONTEXT cert_root = context->rgpChain[0]->rgpElement[context->rgpChain[0]->cElement-1]->pCertContext;
for (list<cert_context>::const_iterator c = m_cfg.m_trusted_root_ca.cbegin(), c_end = m_cfg.m_trusted_root_ca.cend();; ++c) { for (auto c = m_cfg.m_trusted_root_ca.cbegin(), c_end = m_cfg.m_trusted_root_ca.cend();; ++c) {
if (c != c_end) { if (c != c_end) {
if (cert_root->cbCertEncoded == (*c)->cbCertEncoded && if (cert_root->cbCertEncoded == (*c)->cbCertEncoded &&
memcmp(cert_root->pbCertEncoded, (*c)->pbCertEncoded, cert_root->cbCertEncoded) == 0) memcmp(cert_root->pbCertEncoded, (*c)->pbCertEncoded, cert_root->cbCertEncoded) == 0)

View File

@ -246,7 +246,7 @@ bool wxFQDNListValidator::TransferToWindow()
if (m_val) { if (m_val) {
wxString str; wxString str;
for (std::list<std::wstring>::const_iterator name = m_val->cbegin(), name_end = m_val->cend(); name != name_end; ++name) { for (auto name = m_val->cbegin(), name_end = m_val->cend(); name != name_end; ++name) {
if (!str.IsEmpty()) str += wxT("; "); if (!str.IsEmpty()) str += wxT("; ");
str += *name; str += *name;
} }
@ -421,7 +421,7 @@ wxTLSServerTrustPanel::wxTLSServerTrustPanel(const eap::config_provider &prov, e
bool wxTLSServerTrustPanel::TransferDataToWindow() bool wxTLSServerTrustPanel::TransferDataToWindow()
{ {
// Populate trusted CA list. // Populate trusted CA list.
for (std::list<winstd::cert_context>::const_iterator cert = m_cfg.m_trusted_root_ca.cbegin(), cert_end = m_cfg.m_trusted_root_ca.cend(); cert != cert_end; ++cert) for (auto cert = m_cfg.m_trusted_root_ca.cbegin(), cert_end = m_cfg.m_trusted_root_ca.cend(); cert != cert_end; ++cert)
m_root_ca->Append(wxString(eap::get_cert_title(*cert)), new wxCertificateClientData(cert->duplicate())); m_root_ca->Append(wxString(eap::get_cert_title(*cert)), new wxCertificateClientData(cert->duplicate()));
// Set server acceptable names. The edit control will get populated by validator. // Set server acceptable names. The edit control will get populated by validator.

View File

@ -292,7 +292,7 @@ wstring eap::config_method_ttls::get_public_identity(const credentials_ttls &cre
} else if (m_anonymous_identity.compare(L"@") == 0) { } else if (m_anonymous_identity.compare(L"@") == 0) {
// Strip username part from identity (RFC 4822). // Strip username part from identity (RFC 4822).
wstring identity(std::move(cred.get_identity())); wstring identity(std::move(cred.get_identity()));
wstring::size_type offset = identity.find(L'@'); auto offset = identity.find(L'@');
if (offset != wstring::npos) identity.erase(0, offset); if (offset != wstring::npos) identity.erase(0, offset);
return identity; return identity;
} else { } else {

View File

@ -204,7 +204,7 @@ EAP_SESSION_HANDLE eap::peer_ttls::begin_session(
config_method_ttls *cfg_method; config_method_ttls *cfg_method;
for (config_connection::provider_list::iterator cfg_prov = s->m_cfg.m_providers.begin(), cfg_prov_end = s->m_cfg.m_providers.end();; ++cfg_prov) { for (auto cfg_prov = s->m_cfg.m_providers.begin(), cfg_prov_end = s->m_cfg.m_providers.end();; ++cfg_prov) {
if (cfg_prov != cfg_prov_end) { if (cfg_prov != cfg_prov_end) {
if (s->m_cred.match(*cfg_prov)) { if (s->m_cred.match(*cfg_prov)) {
// Matching provider found. // Matching provider found.
@ -366,7 +366,7 @@ const eap::config_method_ttls* eap::peer_ttls::combine_credentials(
user_impersonator impersonating(hTokenImpersonateUser); user_impersonator impersonating(hTokenImpersonateUser);
for (config_connection::provider_list::const_iterator cfg_prov = cfg.m_providers.cbegin(), cfg_prov_end = cfg.m_providers.cend(); cfg_prov != cfg_prov_end; ++cfg_prov) { for (auto cfg_prov = cfg.m_providers.cbegin(), cfg_prov_end = cfg.m_providers.cend(); cfg_prov != cfg_prov_end; ++cfg_prov) {
wstring target_name(std::move(cfg_prov->get_id())); wstring target_name(std::move(cfg_prov->get_id()));
// Get method configuration. // Get method configuration.

View File

@ -184,7 +184,7 @@ void eap::peer_ttls_ui::invoke_identity_ui(
// Create credentials dialog and populate it with providers. // Create credentials dialog and populate it with providers.
bool combined = false; bool combined = false;
wxEAPCredentialsConnectionDialog dlg(&parent); wxEAPCredentialsConnectionDialog dlg(&parent);
for (config_connection::provider_list::iterator cfg_prov = cfg.m_providers.begin(), cfg_prov_end = cfg.m_providers.end(); cfg_prov != cfg_prov_end; ++cfg_prov) { for (auto cfg_prov = cfg.m_providers.begin(), cfg_prov_end = cfg.m_providers.end(); cfg_prov != cfg_prov_end; ++cfg_prov) {
wstring target_name(std::move(cfg_prov->get_id())); wstring target_name(std::move(cfg_prov->get_id()));
// Get method configuration. // Get method configuration.

@ -1 +1 @@
Subproject commit 3b4448dcf4f2cfd54dc40be1ef262835ac532550 Subproject commit 7b0b38aab38c777d2b058baaab62fe55cba09b64

@ -1 +1 @@
Subproject commit 2e3e188026b7e6845e9e2b5552faf7589d25cbfc Subproject commit d7ac16dd8dea0bc0d1e9618093f57e57538c1503