You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by sa...@apache.org on 2017/01/09 17:07:12 UTC

[3/4] incubator-trafodion git commit: The cause ffor the core could be due to the use of an address of a stack variable being passed out of scope. Removed the use of the stack intermediate variable and simplified the passing of a user buffer address to t

The cause ffor the core could be due to the use of an address of a stack variable being passed out of scope. Removed the use of the stack intermediate variable and simplified the passing of a user buffer address to the LOB interfaces. In all cases now, the user buffer address contents are used directly eliminating one  level of indirection.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/8f06af35
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/8f06af35
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/8f06af35

Branch: refs/heads/master
Commit: 8f06af3501e0f9cae8e22ff65fd7d63791a11fbd
Parents: 5b89187
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Sat Jan 7 00:19:43 2017 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Sat Jan 7 00:19:43 2017 +0000

----------------------------------------------------------------------
 core/sql/executor/ExExeUtilLoad.cpp |  9 ++-------
 core/sql/exp/ExpLOB.cpp             |  8 ++++++--
 core/sql/exp/ExpLOBaccess.cpp       | 15 +++------------
 3 files changed, 11 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8f06af35/core/sql/executor/ExExeUtilLoad.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilLoad.cpp b/core/sql/executor/ExExeUtilLoad.cpp
index 6a2a293..4da4a28 100644
--- a/core/sql/executor/ExExeUtilLoad.cpp
+++ b/core/sql/executor/ExExeUtilLoad.cpp
@@ -3455,13 +3455,8 @@ short ExExeUtilLobUpdateTcb::work()
     so= Lob_Buffer;
   
   Int64 lobLen = lobTdb().updateSize();
-  char * data = (char *)lobTdb().getBufAddr();
-  
-  if (so == Lob_Buffer)
-    {
-      Int64 inputAddr = lobTdb().getBufAddr();
-      data = (char *)&inputAddr;
-    }
+  char * data = (char *)(lobTdb().getBufAddr());
+ 
   void * lobGlobs = getLobGlobals()->lobAccessGlobals();
 
   while (1)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8f06af35/core/sql/exp/ExpLOB.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOB.cpp b/core/sql/exp/ExpLOB.cpp
index ac97b89..feb9641 100644
--- a/core/sql/exp/ExpLOB.cpp
+++ b/core/sql/exp/ExpLOB.cpp
@@ -926,7 +926,9 @@ ex_expr::exp_return_type ExpLOBiud::insertData(Lng32 handleLen,
   if (fromBuffer())
     {
       memcpy(&lobLen, op_data[2],sizeof(Int64)); // user specified buffer length
-      memcpy(lobData,op_data[1],sizeof(Int64)); // user buffer address
+      Int64 userBufAddr = 0;
+      memcpy(&userBufAddr,op_data[1],sizeof(Int64));
+      lobData = (char *)userBufAddr;
     }
   LobsOper lo ;
  
@@ -1348,7 +1350,9 @@ ex_expr::exp_return_type ExpLOBupdate::eval(char *op_data[],
   if (fromBuffer())
     {
       memcpy(&lobLen, op_data[3],sizeof(Int64)); // user specified buffer length
-      memcpy(data,op_data[1],sizeof(Int64)); // user buffer address
+      Int64 userBufAddr = 0;
+      memcpy(&userBufAddr,op_data[1],sizeof(Int64));
+      data = (char *)userBufAddr;
     }
 
   if(fromEmpty())

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8f06af35/core/sql/exp/ExpLOBaccess.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBaccess.cpp b/core/sql/exp/ExpLOBaccess.cpp
index 0788382..aecf153 100644
--- a/core/sql/exp/ExpLOBaccess.cpp
+++ b/core/sql/exp/ExpLOBaccess.cpp
@@ -1132,10 +1132,7 @@ Ex_Lob_Error ExLob::append(char *data, Int64 size, LobsSubOper so, Int64 headDes
     }
 
     char *inputAddr = data;
-    if (so == Lob_Buffer)
-      {
-	inputAddr = (char *)(*(long *)data);
-      }
+   
      str_sprintf(logBuf,"Calling writeLobData: inputAddr: %Ld, InputSize%Ld, tgtOffset:%Ld",(long)inputAddr,sourceLen,dataOffset);
     err = writeLobData(inputAddr, sourceLen,so,dataOffset,operLen,lobMaxChunkMemSize);
     if (err != LOB_OPER_OK)
@@ -1170,10 +1167,7 @@ Ex_Lob_Error ExLob::insertData(char *data, Int64 size, LobsSubOper so,Int64 head
     }
 
     char *inputAddr = data;
-    if (so == Lob_Buffer)
-      {
-	inputAddr = (char *)(*(long *)data);
-      }
+   
     Int64 inputSize = desc.getSize();
     Int64 tgtOffset = desc.getOffset();
     str_sprintf(logBuf,"Calling writeLobData: inputAddr: %Ld, InputSize%Ld, tgtOffset:%Ld",(long)inputAddr,inputSize,tgtOffset);
@@ -1247,10 +1241,7 @@ Ex_Lob_Error ExLob::update(char *data, Int64 size, LobsSubOper so,Int64 headDesc
         return err;
       }
     char *inputAddr = data;
-    if (so == Lob_Buffer)
-      {
-	inputAddr = (char *)(*(long *)data);
-      }
+   
     str_sprintf(logBuf,"Calling writeLobData.sourceLen:%Ld, dataOffset:%Ld",sourceLen,dataOffset);
     lobDebugInfo(logBuf,0,__LINE__,lobTrace_);