Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 2.18 KB  |  hits: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. invalid read size of 1 valgrind
  2. bool Configurator::getParameterValue(const char *p_pParameterName, char** p_pParameterValue)
  3. {
  4.     bool blReturnValue = false;
  5.  
  6.     QDomElement element;
  7.     QDomNode node;
  8.     QDomNodeList list;
  9.  
  10.     list = doc.elementsByTagName(p_pParameterName);
  11.     if (!list.isEmpty())  
  12.     {
  13.         node = list.item(0);
  14.         element = node.toElement();
  15.         QString qs = element.text().toUtf8();
  16.         *p_pParameterValue = (char *)(qs.toStdString().c_str());
  17.         blReturnValue = true;
  18.     }
  19.     else
  20.     {
  21.         char sMessage[200];
  22.         sprintf(sMessage, "<Configurator::getParameterValue> Error! Parameter %s could not be foundn", p_pParameterName);
  23.         m_outputFunction(sMessage);
  24.     }
  25.  
  26.     return blReturnValue;
  27. }
  28.  
  29. bool Configurator::parseFile()
  30. {
  31.     bool blReturnValue = false;
  32.  
  33.     QString errorStr;
  34.     int errorLine;
  35.     int errorColumn;
  36.  
  37.     if (!doc.setContent((QIODevice*)(&file), true, &errorStr, &errorLine, &errorColumn))
  38.     {
  39.         char aTemp[512];
  40.         sprintf(aTemp, "<Configurator::parseFile> error! can not read the file row: %d, column: %d:n",errorLine, errorColumn);
  41.         m_outputFunction(aTemp);
  42.     }
  43.     else
  44.     {
  45.         closeFile();
  46.         blReturnValue = true;
  47.     }
  48.  
  49.     return blReturnValue;
  50. }
  51.  
  52. bool Application::readConfigurationFile()
  53. {
  54.     bool blReturnValue = false;
  55.  
  56.     m_outputFunction("<Application::readConfigurationFile> Reading configuration..n");
  57.  
  58.     if(m_configurator.parseFile())
  59.     {
  60.         blReturnValue = true;
  61.  
  62.         m_configurator.writeParameters();
  63.  
  64.         char *pTemp = 0;
  65.  
  66.  
  67.         if(!m_configurator.getParameterValue("center_no", m_bCenterNo))
  68.             m_bCenterNo = 1;
  69.         if(m_configurator.getParameterValue("highway_header", &pTemp))
  70.             m_strHighwayHeader.assign(pTemp);
  71.         else
  72.             m_strHighwayHeader.assign("... HIGHWAY"); // Default value
  73.     }
  74.     return blReturnValue;
  75. }
  76.        
  77. *p_pParameterValue = (char *)(qs.toStdString().c_str());
  78.        
  79. std::string QString::toStdString () const
  80.        
  81. const charT* c_str() const noexcept;
  82. const charT* data() const noexcept;
  83.        
  84. if(m_configurator.getParameterValue("highway_header", &pTemp))
  85.                 m_strHighwayHeader.assign(pTemp);