Skip to content

Commit c77e853

Browse files
author
dotms
committed
Pointer and vector fix for osx build.
1 parent 40c1cd7 commit c77e853

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

hardware/Tado.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ bool CTado::CreateOverlay(const int idx, const float temp, const bool heatingEna
139139
int ServiceIdx = (idx % 1000) % 100;
140140

141141
// 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)
143143
{
144144
_log.Log(LOG_ERROR, "Tado: no such home/zone combo found: " + boost::to_string(HomeIdx) + "/" + boost::to_string(ZoneIdx));
145145
return false;
@@ -224,7 +224,8 @@ bool CTado::GetAuthToken(std::string &authtoken, std::string &refreshtoken, cons
224224
std::string sPostData = s.str();
225225

226226
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");
228229
std::vector<std::string> _vResponseHeaders;
229230

230231
Json::Value _jsRoot;
@@ -442,7 +443,7 @@ bool CTado::CancelOverlay(const int Idx)
442443
//int ServiceIdx = (Idx % 1000) % 100;
443444

444445
// 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)
446447
{
447448
_log.Log(LOG_ERROR, "Tado: no such home/zone combo found: " + boost::to_string(HomeIdx) + "/" + boost::to_string(ZoneIdx));
448449
return false;
@@ -612,16 +613,20 @@ bool CTado::GetTadoApiEnvironment(std::string sUrl)
612613
}
613614

614615
// 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");
616621

617622
// The key values will be stored in a map, lets clean it out first.
618623
m_TadoEnvironment.clear();
619624

620-
for (int i = 0; i < (int)vKeysToFetch.size(); i++)
625+
for (int i = 0; i < (int)_vKeysToFetch.size(); i++)
621626
{
622627
// Feed the function the javascript response, and have it attempt to grab the provided key's value from it.
623628
// Value is stored in m_TadoEnvironment[keyName]
624-
std::string _sKeyName = vKeysToFetch[i];
629+
std::string _sKeyName = _vKeysToFetch[i];
625630
if (!MatchValueFromJSKey(_sKeyName, _sResponse, m_TadoEnvironment[_sKeyName])) {
626631
_log.Log(LOG_ERROR, "Tado: Failed to retrieve/match key '" + _sKeyName + "' from the API environment.");
627632
return false;
@@ -670,7 +675,7 @@ bool CTado::GetHomes() {
670675

671676
try
672677
{
673-
SendToTadoApi(Get, _sUrl, "", _sResponse, std::vector<std::string>{}, _jsRoot);
678+
SendToTadoApi(Get, _sUrl, "", _sResponse, *(new std::vector<std::string>()), _jsRoot);
674679
}
675680
catch (std::exception e)
676681
{

0 commit comments

Comments
 (0)