Mercurial > hg > orthanc
changeset 4400:029366f95217
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Dec 2020 12:30:56 +0100 |
parents | 80fd140b12ba |
children | 354ea95b294a |
files | OrthancFramework/Sources/RestApi/RestApi.cpp OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp OrthancFramework/Sources/RestApi/RestApiCallDocumentation.h OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp OrthancFramework/Sources/RestApi/RestApiHierarchy.h OrthancServer/Resources/RunCppCheck.sh |
diffstat | 6 files changed, 30 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/RestApi/RestApi.cpp Wed Dec 23 12:21:03 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApi.cpp Wed Dec 23 12:30:56 2020 +0100 @@ -79,7 +79,7 @@ const HttpToolbox::Arguments& components, const UriComponents& trailing) { - if (resource.HasMethod(method_)) + if (resource.HasHandler(method_)) { switch (method_) { @@ -133,7 +133,7 @@ Json::Value paths_; public: - OpenApiVisitor(RestApi& restApi) : + explicit OpenApiVisitor(RestApi& restApi) : restApi_(restApi) { } @@ -146,18 +146,12 @@ { const std::string path = Toolbox::FlattenUri(uri); - if (hasTrailing) - LOG(WARNING) << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " << path; - if (paths_.isMember(path)) { throw OrthancException(ErrorCode_InternalError); } - //if (path == "/patients/{id}/protected") - //asm("int $3"); - - if (resource.HasMethod(HttpMethod_Get)) + if (resource.HasHandler(HttpMethod_Get)) { StringHttpOutput o1; HttpOutput o2(o1, false); @@ -193,7 +187,7 @@ } } - if (resource.HasMethod(HttpMethod_Post)) + if (resource.HasHandler(HttpMethod_Post)) { StringHttpOutput o1; HttpOutput o2(o1, false); @@ -228,7 +222,7 @@ } } - if (resource.HasMethod(HttpMethod_Delete)) + if (resource.HasHandler(HttpMethod_Delete)) { StringHttpOutput o1; HttpOutput o2(o1, false); @@ -263,7 +257,7 @@ } } - if (resource.HasMethod(HttpMethod_Put)) + if (resource.HasHandler(HttpMethod_Put)) { StringHttpOutput o1; HttpOutput o2(o1, false);
--- a/OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp Wed Dec 23 12:21:03 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp Wed Dec 23 12:30:56 2020 +0100 @@ -278,13 +278,13 @@ if (it->first == MimeType_Json) { - for (Parameters::const_iterator it = requestFields_.begin(); - it != requestFields_.end(); ++it) + for (Parameters::const_iterator field = requestFields_.begin(); + field != requestFields_.end(); ++field) { Json::Value p = Json::objectValue; - p["type"] = TypeToString(it->second.type_); - p["description"] = it->second.description_; - schema["properties"][it->first] = p; + p["type"] = TypeToString(field->second.type_); + p["description"] = field->second.description_; + schema["properties"][field->first] = p; } } } @@ -300,13 +300,13 @@ if (it->first == MimeType_Json) { - for (Parameters::const_iterator it = answerFields_.begin(); - it != answerFields_.end(); ++it) + for (Parameters::const_iterator field = answerFields_.begin(); + field != answerFields_.end(); ++field) { Json::Value p = Json::objectValue; - p["type"] = TypeToString(it->second.type_); - p["description"] = it->second.description_; - schema["properties"][it->first] = p; + p["type"] = TypeToString(field->second.type_); + p["description"] = field->second.description_; + schema["properties"][field->first] = p; } } }
--- a/OrthancFramework/Sources/RestApi/RestApiCallDocumentation.h Wed Dec 23 12:21:03 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiCallDocumentation.h Wed Dec 23 12:30:56 2020 +0100 @@ -71,7 +71,7 @@ Json::Value sample_; public: - RestApiCallDocumentation(HttpMethod method) : + explicit RestApiCallDocumentation(HttpMethod method) : method_(method), sample_(Json::nullValue) {
--- a/OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp Wed Dec 23 12:21:03 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp Wed Dec 23 12:30:56 2020 +0100 @@ -39,7 +39,7 @@ } - bool RestApiHierarchy::Resource::HasMethod(HttpMethod method) const + bool RestApiHierarchy::Resource::HasHandler(HttpMethod method) const { switch (method) { @@ -377,22 +377,22 @@ target = Json::objectValue; /*std::string s = " "; - if (handlers_.HasMethod(HttpMethod_Get)) + if (handlers_.HasHandler(HttpMethod_Get)) { s += "GET "; } - if (handlers_.HasMethod(HttpMethod_Post)) + if (handlers_.HasHandler(HttpMethod_Post)) { s += "POST "; } - if (handlers_.HasMethod(HttpMethod_Put)) + if (handlers_.HasHandler(HttpMethod_Put)) { s += "PUT "; } - if (handlers_.HasMethod(HttpMethod_Delete)) + if (handlers_.HasHandler(HttpMethod_Delete)) { s += "DELETE "; } @@ -450,22 +450,22 @@ { if (!hasTrailing) // Ignore universal handlers { - if (resource.HasMethod(HttpMethod_Get)) + if (resource.HasHandler(HttpMethod_Get)) { methods_.insert(HttpMethod_Get); } - if (resource.HasMethod(HttpMethod_Post)) + if (resource.HasHandler(HttpMethod_Post)) { methods_.insert(HttpMethod_Post); } - if (resource.HasMethod(HttpMethod_Put)) + if (resource.HasHandler(HttpMethod_Put)) { methods_.insert(HttpMethod_Put); } - if (resource.HasMethod(HttpMethod_Delete)) + if (resource.HasHandler(HttpMethod_Delete)) { methods_.insert(HttpMethod_Delete); }
--- a/OrthancFramework/Sources/RestApi/RestApiHierarchy.h Wed Dec 23 12:21:03 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiHierarchy.h Wed Dec 23 12:30:56 2020 +0100 @@ -45,7 +45,7 @@ public: Resource(); - bool HasMethod(HttpMethod method) const; + bool HasHandler(HttpMethod method) const; void Register(RestApiGetCall::Handler handler);
--- a/OrthancServer/Resources/RunCppCheck.sh Wed Dec 23 12:21:03 2020 +0100 +++ b/OrthancServer/Resources/RunCppCheck.sh Wed Dec 23 12:30:56 2020 +0100 @@ -12,9 +12,11 @@ constParameter:../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp knownArgument:../../OrthancFramework/UnitTestsSources/ImageTests.cpp knownConditionTrueFalse:../../OrthancServer/Plugins/Engine/OrthancPlugins.cpp -nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:318 +nullPointer:../../OrthancFramework/UnitTestsSources/RestApiTests.cpp:319 nullPointerRedundantCheck:../../OrthancFramework/UnitTestsSources/DicomMapTests.cpp stlFindInsert:../../OrthancFramework/Sources/DicomFormat/DicomMap.cpp:1163 +stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:174 +stlFindInsert:../../OrthancFramework/Sources/RestApi/RestApiCallDocumentation.cpp:71 stlFindInsert:../../OrthancServer/Sources/OrthancWebDav.cpp:384 stlFindInsert:../../OrthancServer/Sources/ServerIndex.cpp:400 syntaxError:../../OrthancFramework/Sources/SQLite/FunctionContext.h:50