pass std::strings by const reference

pull/779/head
Gergo Koteles 3 months ago
parent ffb6449258
commit 5b3275647f
  1. 6
      src/minidexed.cpp
  2. 4
      src/minidexed.h
  3. 9
      src/performanceconfig.cpp
  4. 2
      src/performanceconfig.h

@ -1968,9 +1968,9 @@ std::string CMiniDexed::GetNewPerformanceDefaultName(void)
return m_PerformanceConfig.GetNewPerformanceDefaultName();
}
void CMiniDexed::SetNewPerformanceName(std::string nName)
void CMiniDexed::SetNewPerformanceName(const std::string &Name)
{
m_PerformanceConfig.SetNewPerformanceName(nName);
m_PerformanceConfig.SetNewPerformanceName(Name);
}
bool CMiniDexed::IsValidPerformance(unsigned nID)
@ -1983,7 +1983,7 @@ bool CMiniDexed::IsValidPerformanceBank(unsigned nBankID)
return m_PerformanceConfig.IsValidPerformanceBank(nBankID);
}
void CMiniDexed::SetVoiceName (std::string VoiceName, unsigned nTG)
void CMiniDexed::SetVoiceName (const std::string &VoiceName, unsigned nTG)
{
assert (nTG < CConfig::AllToneGenerators);
if (nTG >= m_nToneGenerators) return; // Not an active TG

@ -164,8 +164,8 @@ public:
int GetParameter (TParameter Parameter);
std::string GetNewPerformanceDefaultName(void);
void SetNewPerformanceName(std::string nName);
void SetVoiceName (std::string VoiceName, unsigned nTG);
void SetNewPerformanceName(const std::string &Name);
void SetVoiceName (const std::string &VoiceName, unsigned nTG);
bool DeletePerformance(unsigned nID);
bool DoDeletePerformance(void);

@ -1095,17 +1095,16 @@ std::string CPerformanceConfig::GetNewPerformanceDefaultName(void)
return "Perf" + nIndex;
}
void CPerformanceConfig::SetNewPerformanceName(std::string nName)
void CPerformanceConfig::SetNewPerformanceName(const std::string &Name)
{
int i = nName.length();
int i = Name.length();
do
{
--i;
}
while (i>=0 && nName[i] == 32);
nName=nName.substr(0,i+1) ;
while (i >= 0 && Name[i] == 32);
NewPerformanceName = nName;
NewPerformanceName = Name.substr(0, i + 1);
}
bool CPerformanceConfig::DeletePerformance(unsigned nID)

@ -137,7 +137,7 @@ public:
bool CreateNewPerformanceFile(void);
bool GetInternalFolderOk();
std::string GetNewPerformanceDefaultName(void);
void SetNewPerformanceName(std::string nName);
void SetNewPerformanceName(const std::string &Name);
bool DeletePerformance(unsigned nID);
bool CheckFreePerformanceSlot(void);
std::string AddPerformanceBankDirName(unsigned nBankID);

Loading…
Cancel
Save