diff options
author | Juergen Funk <juergen.funk_ml@cib.de> | 2019-09-25 13:49:26 +0200 |
---|---|---|
committer | Juergen Funk (CIB) <juergen.funk_ml@cib.de> | 2019-10-02 07:10:50 +0200 |
commit | 8fe03eef707561bb0b9e1655292619ec3cd347f5 (patch) | |
tree | 8cfd6d8f86f0b82e93c42bef9d96f9221d019ae6 /desktop/source/minidump | |
parent | d09dc224977c498356ab76738afe03136c98fabe (diff) |
Refactoring of the class CrashReporter
- remove double code
- using of all the methode of the CrashReporter-Class
- all methode only active when crash-dump enable
except the addKeyValue
With this change the handling for the patch
tdf#127711 A runtime-switch for the MiniCrashDump
would be simpler
Change-Id: I339b3b8e06f7fc2cd3c0d34ece112a6fd352913a
Reviewed-on: https://gerrit.libreoffice.org/79272
Tested-by: Jenkins
Reviewed-by: Juergen Funk (CIB) <juergen.funk_ml@cib.de>
Diffstat (limited to 'desktop/source/minidump')
-rw-r--r-- | desktop/source/minidump/minidump.cxx | 20 | ||||
-rw-r--r-- | desktop/source/minidump/minidump_upload.cxx | 2 |
2 files changed, 17 insertions, 5 deletions
diff --git a/desktop/source/minidump/minidump.cxx b/desktop/source/minidump/minidump.cxx index f9666bff5998..8b96d2ff37f1 100644 --- a/desktop/source/minidump/minidump.cxx +++ b/desktop/source/minidump/minidump.cxx @@ -191,7 +191,7 @@ static bool uploadContent(std::map<std::string, std::string>& parameters, std::s namespace crashreport { -bool readConfig(const std::string& iniPath, std::string& response) +bool readConfig(const std::string& iniPath, std::string * response) { std::ifstream file(iniPath); std::map<std::string, std::string> parameters = readStrings(file); @@ -199,17 +199,29 @@ bool readConfig(const std::string& iniPath, std::string& response) // make sure that at least the mandatory parameters are in there if (parameters.find("DumpFile") == parameters.end()) { - response = "ini file needs to contain a key DumpFile!"; + if(response != nullptr) + *response = "ini file needs to contain a key DumpFile!"; return false; } if (parameters.find("Version") == parameters.end()) { - response = "ini file needs to contain a key Version!"; + if (response != nullptr) + *response = "ini file needs to contain a key Version!"; return false; } - return uploadContent(parameters, response); + if (parameters.find("URL") == parameters.end()) + { + if (response != nullptr) + *response = "ini file needs to contain a key URL!"; + return false; + } + + if (response != nullptr) + return uploadContent(parameters, *response); + + return true; } } diff --git a/desktop/source/minidump/minidump_upload.cxx b/desktop/source/minidump/minidump_upload.cxx index ded2f1df0a43..15af26430764 100644 --- a/desktop/source/minidump/minidump_upload.cxx +++ b/desktop/source/minidump/minidump_upload.cxx @@ -22,7 +22,7 @@ int main(int argc, char** argv) std::string iniPath(argv[1]); std::string response; - if (!crashreport::readConfig(iniPath, response)) + if (!crashreport::readConfig(iniPath, &response)) return EXIT_FAILURE; std::cout << "Response: " << response << std::endl; |