summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2017-03-04 19:09:44 -0500
committerLioncash <mathew1800@gmail.com>2017-03-04 19:19:42 -0500
commit0e5a367ca3794fd4b38569ca2499fd5d5b8fd57a (patch)
tree6b42158764bbad633bdeeeeaca49ca9141aaf29e /Source
parent1ebd2cd7c389723d9935e2eb6e84a84c9aa93a39 (diff)
SysConf: const-correctness
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Common/SysConf.h34
-rw-r--r--Source/Core/Core/IOS/USB/Bluetooth/BTBase.cpp2
-rw-r--r--Source/Core/Core/IOS/USB/Bluetooth/BTBase.h2
3 files changed, 19 insertions, 19 deletions
diff --git a/Source/Core/Common/SysConf.h b/Source/Core/Common/SysConf.h
index 28af700b36..0d7e9c3e41 100644
--- a/Source/Core/Common/SysConf.h
+++ b/Source/Core/Common/SysConf.h
@@ -53,13 +53,13 @@ struct SSysConfEntry
std::vector<u8> data;
template <class T>
- T GetData()
+ T GetData() const
{
T extracted_data;
std::memcpy(&extracted_data, data.data(), sizeof(T));
return extracted_data;
}
- bool GetArrayData(u8* dest, u16 destSize)
+ bool GetArrayData(u8* dest, u16 destSize) const
{
if (dest && destSize >= dataLength)
{
@@ -68,7 +68,7 @@ struct SSysConfEntry
}
return false;
}
- bool SetArrayData(u8* buffer, u16 bufferSize)
+ bool SetArrayData(const u8* buffer, u16 bufferSize)
{
if (buffer)
{
@@ -85,9 +85,9 @@ public:
SysConf(Common::FromWhichRoot root_type);
~SysConf();
- bool IsValid() { return m_IsValid; }
+ bool IsValid() const { return m_IsValid; }
template <class T>
- T GetData(const char* sectionName)
+ T GetData(const char* sectionName) const
{
if (!m_IsValid)
{
@@ -95,13 +95,13 @@ public:
return 0;
}
- std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
- for (; index < m_Entries.end() - 1; ++index)
+ auto index = m_Entries.cbegin();
+ for (; index < m_Entries.cend() - 1; ++index)
{
if (strcmp(index->name, sectionName) == 0)
break;
}
- if (index == m_Entries.end() - 1)
+ if (index == m_Entries.cend() - 1)
{
PanicAlertT("Section %s not found in SYSCONF", sectionName);
return 0;
@@ -110,35 +110,35 @@ public:
return index->GetData<T>();
}
- bool GetArrayData(const char* sectionName, u8* dest, u16 destSize)
+ bool GetArrayData(const char* sectionName, u8* dest, u16 destSize) const
{
if (!m_IsValid)
{
PanicAlertT("Trying to read from invalid SYSCONF");
- return 0;
+ return false;
}
- std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
- for (; index < m_Entries.end() - 1; ++index)
+ auto index = m_Entries.cbegin();
+ for (; index < m_Entries.cend() - 1; ++index)
{
if (strcmp(index->name, sectionName) == 0)
break;
}
- if (index == m_Entries.end() - 1)
+ if (index == m_Entries.cend() - 1)
{
PanicAlertT("Section %s not found in SYSCONF", sectionName);
- return 0;
+ return false;
}
return index->GetArrayData(dest, destSize);
}
- bool SetArrayData(const char* sectionName, u8* buffer, u16 bufferSize)
+ bool SetArrayData(const char* sectionName, const u8* buffer, u16 bufferSize)
{
if (!m_IsValid)
return false;
- std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
+ auto index = m_Entries.begin();
for (; index < m_Entries.end() - 1; ++index)
{
if (strcmp(index->name, sectionName) == 0)
@@ -159,7 +159,7 @@ public:
if (!m_IsValid)
return false;
- std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
+ auto index = m_Entries.begin();
for (; index < m_Entries.end() - 1; ++index)
{
if (strcmp(index->name, sectionName) == 0)
diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTBase.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTBase.cpp
index 2eb03c862f..1048ad4ed4 100644
--- a/Source/Core/Core/IOS/USB/Bluetooth/BTBase.cpp
+++ b/Source/Core/Core/IOS/USB/Bluetooth/BTBase.cpp
@@ -22,7 +22,7 @@ namespace HLE
{
constexpr u16 BT_INFO_SECTION_LENGTH = 0x460;
-void BackUpBTInfoSection(SysConf* sysconf)
+void BackUpBTInfoSection(const SysConf* sysconf)
{
const std::string filename = File::GetUserPath(D_SESSION_WIIROOT_IDX) + DIR_SEP WII_BTDINF_BACKUP;
if (File::Exists(filename))
diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTBase.h b/Source/Core/Core/IOS/USB/Bluetooth/BTBase.h
index 60ca2f1f3c..55eee82b22 100644
--- a/Source/Core/Core/IOS/USB/Bluetooth/BTBase.h
+++ b/Source/Core/Core/IOS/USB/Bluetooth/BTBase.h
@@ -18,7 +18,7 @@ namespace IOS
{
namespace HLE
{
-void BackUpBTInfoSection(SysConf* sysconf);
+void BackUpBTInfoSection(const SysConf* sysconf);
void RestoreBTInfoSection(SysConf* sysconf);
namespace Device