From c43d99845740e8a9cf44af67b2ed7f7376d30b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Thu, 11 Oct 2018 08:51:04 +0200 Subject: [PATCH] Fix cppcheck issues: passedByValue --- samples/exiv2json.cpp | 4 ++-- samples/geotag.cpp | 6 +++--- src/exiv2.cpp | 2 +- src/exiv2app.hpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/exiv2json.cpp b/samples/exiv2json.cpp index ee435ed0..a33a383b 100644 --- a/samples/exiv2json.cpp +++ b/samples/exiv2json.cpp @@ -101,7 +101,7 @@ Jzon::Node& recursivelyBuildTree(Jzon::Node& root,Tokens& tokens,size_t k) } // build the json tree for this key. return location and discover the name -Jzon::Node& objectForKey(const std::string Key,Jzon::Object& root,std::string& name,Exiv2::StringSet* pNS=NULL) +Jzon::Node& objectForKey(const std::string& Key,Jzon::Object& root,std::string& name,Exiv2::StringSet* pNS=NULL) { // Parse the key Tokens tokens ; @@ -351,4 +351,4 @@ int main(int argc, char* const argv[]) std::cout << "Caught Exiv2 exception '" << e.what() << "'\n"; return -1; } -} \ No newline at end of file +} diff --git a/samples/geotag.cpp b/samples/geotag.cpp index 0a1ff807..217c5131 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -467,7 +467,7 @@ string getExifTime(const time_t t) return result ; } -std::string makePath(std::string dir,std::string file) +std::string makePath(const std::string& dir, const std::string& file) { return dir + std::string(EXV_SEPARATOR_STR) + file ; } @@ -607,7 +607,7 @@ bool readImage(const char* path,Options& /* options */) return bResult ; } -time_t readImageTime(std::string path,std::string* pS=NULL) +time_t readImageTime(const std::string& path,std::string* pS=NULL) { using namespace Exiv2; @@ -753,7 +753,7 @@ int parseTZ(const char* adjust) return (3600*h)+(60*m); } -bool mySort(std::string a,std::string b) +bool mySort(const std::string& a, const std::string& b) { time_t A = readImageTime(a); time_t B = readImageTime(b); diff --git a/src/exiv2.cpp b/src/exiv2.cpp index d6d58683..35e3ca8e 100644 --- a/src/exiv2.cpp +++ b/src/exiv2.cpp @@ -247,7 +247,7 @@ void Params::usage(std::ostream& os) const << _("Manipulate the Exif metadata of images.\n"); } -std::string Params::printTarget(std::string before,int target,bool bPrint,std::ostream& out) +std::string Params::printTarget(const std::string &before, int target, bool bPrint, std::ostream& out) { std::string t; if ( target & Params::ctExif ) t+= 'e'; diff --git a/src/exiv2app.hpp b/src/exiv2app.hpp index f86938b3..f924c20d 100644 --- a/src/exiv2app.hpp +++ b/src/exiv2app.hpp @@ -344,7 +344,7 @@ public: void version(bool verbose =false, std::ostream& os =std::cout) const; //! Print target_ - static std::string printTarget(std::string before,int target,bool bPrint=false,std::ostream& os=std::cout); + static std::string printTarget(const std::string& before,int target,bool bPrint=false,std::ostream& os=std::cout); //! getStdin binary data read from stdin to DataBuf /*