Explorar el Código

Fix problems with LCR datasets inside IFBLOCKS

An IFBLOCK that only contained a DATASET could generate invalid code if
link counted child datasets were enabled.

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday hace 13 años
padre
commit
f467c9ec16
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  1. 9 2
      ecl/hqlcpp/hqltcppc2.cpp

+ 9 - 2
ecl/hqlcpp/hqltcppc2.cpp

@@ -453,7 +453,10 @@ void CChildLimitedDatasetColumnInfo::gatherSize(SizeStruct & target)
             fixedSize = (unsigned)getIntValue(countField) * fixedChildSize;
         }
 
-        target.addFixed(fixedSize);
+        if (isConditional())
+            addVariableSize(fixedSize, target);
+        else
+            target.addFixed(fixedSize);
     }
     else
     {
@@ -649,7 +652,11 @@ void CChildLinkedDatasetColumnInfo::buildColumnExpr(HqlCppTranslator & translato
 
 void CChildLinkedDatasetColumnInfo::gatherSize(SizeStruct & target)
 {
-    target.addFixed(sizeof(size32_t) + sizeof(byte * *));
+    unsigned thisSize = sizeof(size32_t) + sizeof(byte * *);
+    if (isConditional())
+        addVariableSize(thisSize, target);      // the size is used for ensure if condition is true
+    else
+        target.addFixed(thisSize);
 }