summaryrefslogtreecommitdiffstats
path: root/lib/inifile/iniFile.cpp
diff options
context:
space:
mode:
authorarchshift <admin@archshift.com>2014-07-29 22:04:00 +0200
committerarchshift <admin@archshift.com>2014-07-29 22:04:00 +0200
commita9b597087b56b4526a3f6447789ba141568575a1 (patch)
treea08542d77b5668a25ca5e00492577ed6f4d61a9a /lib/inifile/iniFile.cpp
parentSpacing fixes and a few more BLOCK_META constants. (diff)
parentSlight cleanup after portals (diff)
downloadcuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.gz
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.bz2
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.lz
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.xz
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.tar.zst
cuberite-a9b597087b56b4526a3f6447789ba141568575a1.zip
Diffstat (limited to '')
-rw-r--r--lib/inifile/iniFile.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/lib/inifile/iniFile.cpp b/lib/inifile/iniFile.cpp
index 19db9723a..2bf6c91ed 100644
--- a/lib/inifile/iniFile.cpp
+++ b/lib/inifile/iniFile.cpp
@@ -243,7 +243,7 @@ int cIniFile::FindKey(const AString & a_KeyName) const
{
if (CheckCase(names[keyID]) == CaseKeyName)
{
- return keyID;
+ return (int)keyID;
}
}
return noID;
@@ -279,7 +279,7 @@ int cIniFile::AddKeyName(const AString & keyname)
{
names.resize(names.size() + 1, keyname);
keys.resize(keys.size() + 1);
- return names.size() - 1;
+ return (int)names.size() - 1;
}
@@ -447,6 +447,15 @@ bool cIniFile::SetValueI(const AString & a_KeyName, const AString & a_ValueName,
+bool cIniFile::SetValueI(const AString & a_Keyname, const AString & a_ValueName, const Int64 a_Value, const bool a_CreateIfNotExists)
+{
+ return SetValue(a_Keyname, a_ValueName, Printf("%lld", a_Value), a_CreateIfNotExists);
+}
+
+
+
+
+
bool cIniFile::SetValueF(const AString & a_KeyName, const AString & a_ValueName, double const a_Value, const bool a_CreateIfNotExists)
{
return SetValue(a_KeyName, a_ValueName, Printf("%f", a_Value), a_CreateIfNotExists);
@@ -571,6 +580,24 @@ int cIniFile::GetValueSetI(const AString & keyname, const AString & valuename, c
+Int64 cIniFile::GetValueSetI(const AString & keyname, const AString & valuename, const Int64 defValue)
+{
+ AString Data;
+ Printf(Data, "%lld", defValue);
+ AString resultstring = GetValueSet(keyname, valuename, Data);
+ Int64 result = defValue;
+#ifdef _WIN32
+ sscanf_s(resultstring.c_str(), "%lld", &result);
+#else
+ sscanf(resultstring.c_str(), "%lld", &result);
+#endif
+ return result;
+}
+
+
+
+
+
bool cIniFile::DeleteValueByID(const int keyID, const int valueID)
{
if ((keyID < (int)keys.size()) && (valueID < (int)keys[keyID].names.size()))
@@ -683,7 +710,7 @@ int cIniFile::GetNumKeyComments(const int keyID) const
{
if (keyID < (int)keys.size())
{
- return keys[keyID].comments.size();
+ return (int)keys[keyID].comments.size();
}
return 0;
}