summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-04-10 12:13:39 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-04-10 12:13:39 (GMT)
commit533242a8b422e66854327468a544a461c8bf9b7c (patch)
treeeadea9931af7cce7a0a27da0c8bdc6919626af10
parentd6c0408b905868713856921af35654accf918686 (diff)
downloadDoxygen-533242a8b422e66854327468a544a461c8bf9b7c.zip
Doxygen-533242a8b422e66854327468a544a461c8bf9b7c.tar.gz
Doxygen-533242a8b422e66854327468a544a461c8bf9b7c.tar.bz2
Fixes after coverity run
-rw-r--r--src/doxygen.cpp9
-rw-r--r--src/linkedmap.h12
-rw-r--r--src/reflist.cpp9
-rw-r--r--src/rtfgen.cpp9
4 files changed, 23 insertions, 16 deletions
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 3cf3596..6163e81 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -6274,7 +6274,6 @@ static void findMember(const Entry *root,
{
bool newMember=TRUE; // assume we have a new member
MemberDef *mdDefine=0;
- bool isDefine=FALSE;
{
mn = Doxygen::functionNameLinkedMap->find(funcName);
if (mn)
@@ -6325,7 +6324,7 @@ static void findMember(const Entry *root,
if (newMember) // need to create a new member
{
MemberType mtype;
- if (isDefine)
+ if (mdDefine)
mtype=MemberType_Define;
else if (root->mtype==Signal)
mtype=MemberType_Signal;
@@ -6336,7 +6335,7 @@ static void findMember(const Entry *root,
else
mtype=MemberType_Function;
- if (isDefine && mdDefine)
+ if (mdDefine)
{
mdDefine->setHidden(TRUE);
funcType="#define";
@@ -6364,7 +6363,7 @@ static void findMember(const Entry *root,
funcArgs.isEmpty() ? ArgumentList() : root->argList,
root->metaData) };
- if (isDefine && mdDefine)
+ if (mdDefine)
{
md->setInitializer(mdDefine->initializer());
}
@@ -6451,7 +6450,7 @@ static void findMember(const Entry *root,
cd->insertUsedFile(fd);
md->setRefItems(root->sli);
if (root->relatesType == Duplicate) md->setRelatedAlso(cd);
- if (!isDefine)
+ if (!mdDefine)
{
addMemberToGroups(root,md.get());
}
diff --git a/src/linkedmap.h b/src/linkedmap.h
index f3caeb0..c724a39 100644
--- a/src/linkedmap.h
+++ b/src/linkedmap.h
@@ -36,8 +36,9 @@ class LinkedMap
//! find an element given the key.
//! Returns a pointer to the element if found or nullptr if it is not found.
- const T *find(const char *key) const
+ const T *find(const char *k) const
{
+ std::string key = k ? std::string(k) : std::string();
auto it = m_lookup.find(key);
return it!=m_lookup.end() ? it->second : nullptr;
}
@@ -52,14 +53,15 @@ class LinkedMap
//! Return a non-owning pointer to the newly added item, or to the existing item if it was
//! already inserted before.
template<class...Args>
- T *add(const char *key, Args&&... args)
+ T *add(const char *k, Args&&... args)
{
- T *result = find(key);
+ T *result = find(k);
if (result==nullptr)
{
- Ptr ptr = std::make_unique<T>(key,std::forward<Args>(args)...);
+ std::string key = k ? std::string(k) : std::string();
+ Ptr ptr = std::make_unique<T>(k,std::forward<Args>(args)...);
result = ptr.get();
- m_lookup.insert({key ? std::string(key) : std::string(),result});
+ m_lookup.insert({key,result});
m_entries.push_back(std::move(ptr));
}
return result;
diff --git a/src/reflist.cpp b/src/reflist.cpp
index b04c494..55e9708 100644
--- a/src/reflist.cpp
+++ b/src/reflist.cpp
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2020 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -24,7 +24,7 @@
void RefList::generatePage()
{
std::sort(m_entries.begin(),m_entries.end(),
- [](std::unique_ptr<RefItem> &left,std::unique_ptr<RefItem> &right)
+ [](std::unique_ptr<RefItem> &left,std::unique_ptr<RefItem> &right)
{ return qstricmp(left->title(),left->title()); });
//RefItem *item;
QCString doc;
@@ -59,7 +59,7 @@ void RefList::generatePage()
QCString escapedTitle = substitute(item->title(),"\\","\\\\");
doc += " \""+escapedTitle+"\" ";
// write declaration in case a function with arguments
- if (!item->args().isEmpty())
+ if (!item->args().isEmpty())
{
// escape @'s in argument list, needed for Java annotations (see issue #6208)
// escape \'s in argument list (see issue #6533)
@@ -76,6 +76,7 @@ void RefList::generatePage()
doc += " ";
doc += item->text();
lastGroup = item->group();
+ first = false;
}
if (!first)
{
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp
index 97d96d2..ecf2d32 100644
--- a/src/rtfgen.cpp
+++ b/src/rtfgen.cpp
@@ -174,9 +174,14 @@ void RTFGenerator::init()
while(def->reference != 0)
{
if (def->definition == 0)
+ {
err("Internal: rtf_Style_Default[%s] has no definition.\n", def->name);
- StyleData* styleData = new StyleData(def->reference, def->definition);
- rtf_Style.insert(def->name, styleData);
+ }
+ else
+ {
+ StyleData* styleData = new StyleData(def->reference, def->definition);
+ rtf_Style.insert(def->name, styleData);
+ }
def++;
}