diff --git a/cfg/std.cfg b/cfg/std.cfg index 41274cd3a..a050cba96 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -3321,8 +3321,8 @@ - + + false @@ -3336,8 +3336,8 @@ 0:255 - + + @@ -3352,8 +3352,8 @@ - + + false @@ -3595,9 +3595,9 @@ - + @@ -3611,8 +3611,8 @@ - + @@ -3621,9 +3621,9 @@ - + @@ -3636,9 +3636,9 @@ - + @@ -3651,9 +3651,9 @@ - + @@ -3668,9 +3668,9 @@ - + @@ -3685,9 +3685,9 @@ - + @@ -3697,9 +3697,9 @@ - + @@ -3712,8 +3712,8 @@ - + diff --git a/gui/cppchecklibrarydata.cpp b/gui/cppchecklibrarydata.cpp index 93ffab567..409f32e60 100644 --- a/gui/cppchecklibrarydata.cpp +++ b/gui/cppchecklibrarydata.cpp @@ -119,7 +119,7 @@ static CppcheckLibraryData::Function::Arg loadFunctionArg(QXmlStreamReader &xmlR return arg; } -static CppcheckLibraryData::Function loadFunction(QXmlStreamReader &xmlReader, const QStringList &comments) +static CppcheckLibraryData::Function loadFunction(QXmlStreamReader &xmlReader, const QString comments) { CppcheckLibraryData::Function function; function.comments = comments; @@ -185,13 +185,15 @@ static CppcheckLibraryData::PodType loadPodType(const QXmlStreamReader &xmlReade bool CppcheckLibraryData::open(QIODevice &file) { clear(); - QStringList comments; + QString comments; QXmlStreamReader xmlReader(&file); while (!xmlReader.atEnd()) { const QXmlStreamReader::TokenType t = xmlReader.readNext(); switch (t) { case QXmlStreamReader::Comment: - comments.append(xmlReader.text().toString()); + if (!comments.isEmpty()) + comments += "\n"; + comments += xmlReader.text().toString(); break; case QXmlStreamReader::StartElement: if (xmlReader.name() == "container") @@ -263,7 +265,12 @@ static void writeContainer(QXmlStreamWriter &xmlWriter, const CppcheckLibraryDat static void writeFunction(QXmlStreamWriter &xmlWriter, const CppcheckLibraryData::Function &function) { - foreach(const QString &comment, function.comments) { + QString comments = function.comments; + while (comments.startsWith("\n")) + comments = comments.mid(1); + while (comments.endsWith("\n")) + comments.chop(1); + foreach(const QString &comment, comments.split('\n')) { xmlWriter.writeComment(comment); } diff --git a/gui/cppchecklibrarydata.h b/gui/cppchecklibrarydata.h index 10462d909..a540f3ace 100644 --- a/gui/cppchecklibrarydata.h +++ b/gui/cppchecklibrarydata.h @@ -64,7 +64,7 @@ public: leakignore(false), useretval(false) { } - QStringList comments; + QString comments; QString name; enum TrueFalseUnknown { False, True, Unknown } noreturn; bool gccPure; diff --git a/gui/librarydialog.cpp b/gui/librarydialog.cpp index d754c5fb7..a160a05e1 100644 --- a/gui/librarydialog.cpp +++ b/gui/librarydialog.cpp @@ -167,6 +167,7 @@ void LibraryDialog::selectFunction() } ignoreChanges = true; + ui->comments->setPlainText(function->comments); ui->noreturn->setCurrentIndex(function->noreturn); ui->useretval->setChecked(function->useretval); ui->leakignore->setChecked(function->leakignore); @@ -214,6 +215,7 @@ void LibraryDialog::changeFunction() return; CppcheckLibraryData::Function *function = currentFunction(); + function->comments = ui->comments->toPlainText(); function->noreturn = (CppcheckLibraryData::Function::TrueFalseUnknown)ui->noreturn->currentIndex(); function->useretval = ui->useretval->isChecked(); function->leakignore = ui->leakignore->isChecked(); diff --git a/gui/librarydialog.ui b/gui/librarydialog.ui index 460bf5d11..052fb4e30 100644 --- a/gui/librarydialog.ui +++ b/gui/librarydialog.ui @@ -134,6 +134,55 @@ + + + + + 0 + 32 + + + + + 16777215 + 80 + + + + + + + + + Comments + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + QPlainTextEdit::NoWrap + + + + + + @@ -249,12 +298,12 @@ changeFunction() - 739 - 74 + 550 + 157 - 750 - 74 + 561 + 157 @@ -265,12 +314,12 @@ changeFunction() - 735 - 103 + 531 + 183 - 744 - 102 + 540 + 182 @@ -313,8 +362,8 @@ editArg() - 519 - 575 + 488 + 580 497 @@ -329,12 +378,12 @@ editArg() - 685 - 149 + 529 + 223 - 693 - 148 + 543 + 223 @@ -393,12 +442,12 @@ changeFunction() - 696 - 46 + 545 + 137 - 703 - 46 + 552 + 138 @@ -418,6 +467,38 @@ + + noreturn + editTextChanged(QString) + LibraryDialog + changeFunction() + + + 548 + 128 + + + 555 + 128 + + + + + comments + textChanged() + LibraryDialog + changeFunction() + + + 567 + 50 + + + 584 + 48 + + + addFunction()