zhaopuming / quickfast

Automatically exported from code.google.com/p/quickfast
Other
1 stars 0 forks source link

User defined dictionaries are broken. #93

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've been working with some templates that contain user defined dictionaries 
and ran into problems while passing data from QuickFAST to OpenFAST: unsigned 
values using the delta operator and a private dictionary were being transmitted 
from QuickFAST as if the dictionary were global.  After convincing myself that 
my code wasn't erroneous, I dug into the latest QuickFAST code from svn and 
finally discovered the bug.

On line 46 of src/Codecs/FieldOp.cpp (in the definition of the member function 
FieldOp::indexDictionaries), an incorrect value is passed as the first argument 
of the call to DictionaryIndexer::getIndex.  The automatic variable "name" 
should be passed here, but the function argument "dictionaryName" is being 
passed instead, with the result that the value of the data member 
"dictionaryName_" is never actually used when it is non-empty.  I pasted the 
source for this member function below with a comment highlighting the erroneous 
line:

void
FieldOp::indexDictionaries(
  DictionaryIndexer & indexer,
  const std::string & dictionaryName,
  const std::string & typeName,
  const std::string & typeNamespace,
  const std::string & fieldName,
  const std::string & fieldNamespace)
{
  if(usesDictionary())
  {
    std::string name = dictionaryName;
    if(!dictionaryName_.empty())
    {
      name = dictionaryName_;
    }
    std::string key = fieldName;
    std::string keyNamespace = fieldNamespace;
    if(!key_.empty())
    {
      key = key_;
      keyNamespace = keyNamespace_;
    }
    dictionaryIndex_ = indexer.getIndex(
      dictionaryName,  // SHOULD BE "name" INSTEAD OF "dictionaryName"
      typeName,
      typeNamespace,
      key,
      keyNamespace);
    dictionaryIndexValid_ = true;
  }
}

Original issue reported on code.google.com by bd.at.ec...@gmail.com on 10 Sep 2011 at 8:27

GoogleCodeExporter commented 9 years ago
Thanks for the issue report and correct analysis of the problem.

Fixed in R510

Original comment by dale.wil...@gmail.com on 28 Sep 2011 at 8:44