From: Franklin S. Cooper Jr Date: Thu, 9 May 2013 19:00:52 +0000 (-0500) Subject: openweathermapdataengine.cpp: Fix error: taking address of temporary X-Git-Url: https://git.ti.com/gitweb?p=apps%2Fthermostat-demo.git;a=commitdiff_plain;h=27e033a0ac59928cc3acbb45f4d9bc2101fcf024 openweathermapdataengine.cpp: Fix error: taking address of temporary * Fix the error error: taking address of temporary [-fpermissive] by no longer trying to get an address of a temporary string. * This string is not being modified or stored so need reason to pass the string by reference. Signed-off-by: Franklin S. Cooper Jr --- diff --git a/webdataengine/openweathermapdataengine.cpp b/webdataengine/openweathermapdataengine.cpp index 213c97f..0286dd5 100644 --- a/webdataengine/openweathermapdataengine.cpp +++ b/webdataengine/openweathermapdataengine.cpp @@ -67,7 +67,7 @@ void OpenWeatherMapDataEngine::responseReceived() QByteArray data = m_reply->readAll(); //qDebug() << data; - m_cityId = parseCityInformation(&QString::fromAscii(data)); + m_cityId = parseCityInformation(QString::fromAscii(data)); //docs say do not delete in the slot so well pass it off to the event loop m_reply->deleteLater(); if(m_cityId == -1) @@ -278,12 +278,12 @@ void OpenWeatherMapDataEngine::generateJSONWeatherLookupTables() } -qlonglong OpenWeatherMapDataEngine::parseCityInformation(QString* jsonData) +qlonglong OpenWeatherMapDataEngine::parseCityInformation(QString jsonData) { QScriptEngine engine; //must have an object set equal to the class data received from the web or qt throws parse error - QScriptValue result = engine.evaluate("weatherObject="+*jsonData); + QScriptValue result = engine.evaluate("weatherObject="+jsonData); if(result.property("message").toString() != "") return -1; diff --git a/webdataengine/openweathermapdataengine.h b/webdataengine/openweathermapdataengine.h index 687be5e..04d2ccc 100644 --- a/webdataengine/openweathermapdataengine.h +++ b/webdataengine/openweathermapdataengine.h @@ -34,7 +34,7 @@ private: void dispatchWeatherDataRequests(); - qint64 parseCityInformation(QString *jsonData); + qint64 parseCityInformation(QString jsonData); bool parseJSONWeatherData(QString* jsonData, WeatherData* weatherData); bool parseJSONForecastData(QString* jsonData, WeatherData* weatherData); void generateJSONWeatherLookupTables();