diff --git a/src/linkapp.cpp b/src/linkapp.cpp index 98eac62..ad0b56e 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -523,7 +523,7 @@ void LinkApp::showManual() { // Txt manuals if (manual.substr(manual.size()-8,8)==".man.txt") { - string text(readFileAsString(manual.c_str())); + string text(readFileAsString(manual)); TextManualDialog tmd(gmenu2x, getTitle(), getIconPath(), text); tmd.exec(); return; diff --git a/src/utilities.cpp b/src/utilities.cpp index 54ecf0e..0bbf636 100644 --- a/src/utilities.cpp +++ b/src/utilities.cpp @@ -58,7 +58,7 @@ string rtrim(const string& s) { // See this article for a performance comparison of different approaches: // http://insanecoding.blogspot.com/2011/11/how-to-read-in-file-in-c.html -string readFileAsString(const char *filename) { +string readFileAsString(string const& filename) { ifstream in(filename, ios::in | ios::binary); if (!in) { return ""; diff --git a/src/utilities.h b/src/utilities.h index 2d84e39..cd442ac 100644 --- a/src/utilities.h +++ b/src/utilities.h @@ -47,7 +47,7 @@ std::string ltrim(const std::string& s); std::string rtrim(const std::string& s); /** Returns the contents of the given file as a string. */ -std::string readFileAsString(const char *filename); +std::string readFileAsString(std::string const& filename); std::string strreplace(std::string orig, const std::string &search, const std::string &replace); std::string cmdclean(std::string cmdline);