Soft Sensor Manager - Fix 64bit build warnings and crash
authorjk13 <jihyeok13.kim@samsung.com>
Tue, 14 Apr 2015 13:36:41 +0000 (22:36 +0900)
committerUze Choi <uzchoi@samsung.com>
Wed, 15 Apr 2015 11:04:03 +0000 (11:04 +0000)
Fix 64bit build warnings and crash due to invalid pointer value

Change-Id: I97400c77ad82d072237893da264e60afa7d36b38
Signed-off-by: jk13 <jihyeok13.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/719
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/soft-sensor-manager/SSMCore/src/QueryProcessor/EvaluationEngine.cpp
service/soft-sensor-manager/SSMCore/src/QueryProcessor/QueryEngine.cpp
service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMResourceServer.cpp

index 29603f22e3be81d29b2c03190c618039843b5d41..11f76e5a6df175bc3a003d11376a0f743ee33180 100644 (file)
@@ -75,7 +75,7 @@ CLEANUP:
 void CEvaluationEngine::onSQLTrigger(IN sqlite3_context *context, IN int argc,
                                      IN sqlite3_value **argv)
 {
-    CEvaluationEngine *pEvaluationEngine = (CEvaluationEngine *)sqlite3_value_int(argv[0]);
+    CEvaluationEngine *pEvaluationEngine = (CEvaluationEngine *)sqlite3_value_int64(argv[0]);
 
     pEvaluationEngine->onWatcherTriggered(sqlite3_value_int(argv[1]), sqlite3_value_int(argv[2]));
 }
index 59e130b8662e0cb6b646fa1007d22a9e2aee122d..3630e0538053b40dc224f9dc07469c9875ae3607 100644 (file)
@@ -261,12 +261,12 @@ void CQueryEngine::onTerminate(void *pArg)
     switch (pData[0])
     {
         case EVENT_TYPE_INNER:
-            pResult = (std::vector<result_model> *)(((int *)pArg)[2]);
+            pResult = (std::vector<result_model> *)pData[2];
             SAFE_DELETE(pResult);
             break;
 
         case EVENT_TYPE_OUTER:
-            pDataReader = (CDataReader *)(((int *)pArg)[2]);
+            pDataReader = (CDataReader *)pData[2];
             SAFE_DELETE(pDataReader);
             break;
 
index 9ec71d2961cea18a9caaf168f779825a884909d9..85b0c30e0528c1af15ce830fb0a1cadf2aa9d6d7 100644 (file)
@@ -202,8 +202,6 @@ OCEntityHandlerResult SSMResourceServer::entityHandler(std::shared_ptr< OCResour
 
         if (requestFlag & RequestHandlerFlag::RequestFlag)
         {
-            std::cout << "\t\trequestFlag : Request\n";
-
             // If the request type is GET
             if (requestType == "GET")
             {
@@ -274,7 +272,7 @@ OCEntityHandlerResult SSMResourceServer::entityHandler(std::shared_ptr< OCResour
                 }
                 else if (rep.getValue<std::string>("command") == "ReleaseQueryEngine")
                 {
-                    pQueryEngine = (IQueryEngine *) std::stoi(
+                    pQueryEngine = (IQueryEngine *) std::stol(
                                        rep.getValue<std::string>("queryEngineId"));
 
                     ReleaseQueryEngine(pQueryEngine);
@@ -283,7 +281,7 @@ OCEntityHandlerResult SSMResourceServer::entityHandler(std::shared_ptr< OCResour
                 {
                     int CQID = 0;
 
-                    pQueryEngine = (IQueryEngine *) std::stoi(
+                    pQueryEngine = (IQueryEngine *)std::stol(
                                        rep.getValue<std::string>("queryEngineId"));
 
                     res = pQueryEngine->executeContextQuery(
@@ -301,7 +299,7 @@ OCEntityHandlerResult SSMResourceServer::entityHandler(std::shared_ptr< OCResour
                 }
                 else if (rep.getValue<std::string>("command") == "KillContextQuery")
                 {
-                    pQueryEngine = (IQueryEngine *) std::stoi(
+                    pQueryEngine = (IQueryEngine *)std::stol(
                                        rep.getValue<std::string>("queryEngineId"));
 
                     res = pQueryEngine->killContextQuery(std::stoi(rep.getValue<std::string>("CQID")));