openweathermapdataengine.cpp: Fix error: taking address of temporary
authorFranklin S. Cooper Jr <fcooper@ti.com>
Thu, 9 May 2013 19:00:52 +0000 (14:00 -0500)
committerFranklin S. Cooper Jr <fcooper@ti.com>
Fri, 10 May 2013 15:08:06 +0000 (10:08 -0500)
* 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 <fcooper@ti.com>
webdataengine/openweathermapdataengine.cpp
webdataengine/openweathermapdataengine.h

index 213c97f21556cf9447b9e9e8aeac88d9439be2e1..0286dd5bc337e6d18c458d7b3a39ed34d463a2f1 100644 (file)
@@ -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;
index 687be5e9d094e5ea851e7bcfe45d66351f9d1a71..04d2ccc59fc681196b684fbef15e326f452f5930 100644 (file)
@@ -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();