@@ -139,7 +139,7 @@ bool CTado::CreateOverlay(const int idx, const float temp, const bool heatingEna
139
139
int ServiceIdx = (idx % 1000 ) % 100 ;
140
140
141
141
// Check if the zone actually exists.
142
- if (!& m_TadoHomes[HomeIdx].Zones [ZoneIdx] )
142
+ if (m_TadoHomes. size () == 0 || m_TadoHomes[HomeIdx].Zones . size () == 0 )
143
143
{
144
144
_log.Log (LOG_ERROR, " Tado: no such home/zone combo found: " + boost::to_string (HomeIdx) + " /" + boost::to_string (ZoneIdx));
145
145
return false ;
@@ -224,7 +224,8 @@ bool CTado::GetAuthToken(std::string &authtoken, std::string &refreshtoken, cons
224
224
std::string sPostData = s.str ();
225
225
226
226
std::string _sResponse;
227
- std::vector<std::string> _vExtraHeaders = { " Content-Type: application/x-www-form-urlencoded" };
227
+ std::vector<std::string> _vExtraHeaders;
228
+ _vExtraHeaders.push_back (" Content-Type: application/x-www-form-urlencoded" );
228
229
std::vector<std::string> _vResponseHeaders;
229
230
230
231
Json::Value _jsRoot;
@@ -442,7 +443,7 @@ bool CTado::CancelOverlay(const int Idx)
442
443
// int ServiceIdx = (Idx % 1000) % 100;
443
444
444
445
// Check if the home and zone actually exist.
445
- if (!& m_TadoHomes[HomeIdx].Zones [ZoneIdx] )
446
+ if (m_TadoHomes. size () == 0 || m_TadoHomes[HomeIdx].Zones . size () == 0 )
446
447
{
447
448
_log.Log (LOG_ERROR, " Tado: no such home/zone combo found: " + boost::to_string (HomeIdx) + " /" + boost::to_string (ZoneIdx));
448
449
return false ;
@@ -612,16 +613,20 @@ bool CTado::GetTadoApiEnvironment(std::string sUrl)
612
613
}
613
614
614
615
// Determine which keys we want to grab from the environment
615
- std::vector<std::string> vKeysToFetch = { " clientId" , " clientSecret" , " apiEndpoint" , " tgaRestApiV2Endpoint" };
616
+ std::vector<std::string> _vKeysToFetch;
617
+ _vKeysToFetch.push_back (" clientId" );
618
+ _vKeysToFetch.push_back (" clientSecret" );
619
+ _vKeysToFetch.push_back (" apiEndpoint" );
620
+ _vKeysToFetch.push_back (" tgaRestApiV2Endpoint" );
616
621
617
622
// The key values will be stored in a map, lets clean it out first.
618
623
m_TadoEnvironment.clear ();
619
624
620
- for (int i = 0 ; i < (int )vKeysToFetch .size (); i++)
625
+ for (int i = 0 ; i < (int )_vKeysToFetch .size (); i++)
621
626
{
622
627
// Feed the function the javascript response, and have it attempt to grab the provided key's value from it.
623
628
// Value is stored in m_TadoEnvironment[keyName]
624
- std::string _sKeyName = vKeysToFetch [i];
629
+ std::string _sKeyName = _vKeysToFetch [i];
625
630
if (!MatchValueFromJSKey (_sKeyName, _sResponse, m_TadoEnvironment[_sKeyName])) {
626
631
_log.Log (LOG_ERROR, " Tado: Failed to retrieve/match key '" + _sKeyName + " ' from the API environment." );
627
632
return false ;
@@ -670,7 +675,7 @@ bool CTado::GetHomes() {
670
675
671
676
try
672
677
{
673
- SendToTadoApi (Get, _sUrl, " " , _sResponse, std::vector<std::string>{} , _jsRoot);
678
+ SendToTadoApi (Get, _sUrl, " " , _sResponse, *( new std::vector<std::string>()) , _jsRoot);
674
679
}
675
680
catch (std::exception e)
676
681
{
0 commit comments