From 5acc60a117ea325457dcfc569b914d8911b739b8 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 28 Dec 2015 01:47:17 +0000 Subject: [PATCH] Replaced PREF code for SOURCE with ProcessIntegerValue. --- source/contacteditor/ContactDataObject.cpp | 26 +++++----------------- source/contacteditor/ContactDataObject.h | 4 ++-- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index 532884d..12486bc 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -611,24 +611,8 @@ void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySe } else if (PropertyName == wxT("PREF")){ - int PriorityNumber = 0; - bool ValidNumber = TRUE; - - try{ - PriorityNumber = std::stoi(PropertyValue.ToStdString()); - } - - catch(std::invalid_argument &e){ - ValidNumber = FALSE; - } - - if (ValidNumber == TRUE){ + ProcessIntegerValue(this, &SourceListPref, &PropertyValue, SourceCount); - SourceListPref.erase(*SourceCount); - SourceListPref.insert(std::make_pair(*SourceCount, PriorityNumber)); - - } - } else if (PropertyName == wxT("MEDIATYPE")){ SourceListMediatype.erase(*SourceCount); @@ -5878,9 +5862,9 @@ void ContactDataObject::ProcessVendor(wxString PropertySeg1, wxString PropertySe } void ProcessIntegerValue(ContactDataObject *ContactData, - std::map *KeyListPref, + std::map *PrefPtr, wxString *PropertyValue, - int *KeyCount){ + int *ItemCount){ int PriorityNumber = 0; bool ValidNumber = TRUE; @@ -5895,8 +5879,8 @@ void ProcessIntegerValue(ContactDataObject *ContactData, if (ValidNumber == TRUE){ - KeyListPref->erase(*KeyCount); - KeyListPref->insert(std::make_pair(*KeyCount, PriorityNumber)); + PrefPtr->erase(*ItemCount); + PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber)); } diff --git a/source/contacteditor/ContactDataObject.h b/source/contacteditor/ContactDataObject.h index 9e1be8a..1df38ff 100644 --- a/source/contacteditor/ContactDataObject.h +++ b/source/contacteditor/ContactDataObject.h @@ -619,8 +619,8 @@ void CheckType(wxString *PropertySeg1, PropertyType *intType); void ProcessIntegerValue(ContactDataObject *ContactData, - std::map *KeyListPref, + std::map *PrefPtr, wxString *PropertyValue, - int *KeyCount); + int *ItemCount); #endif \ No newline at end of file -- 2.39.5