summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-08-30 23:57:43 +0200
committertycho <work.tycho@gmail.com>2015-09-15 17:19:49 +0200
commit3187dbf0aa0943d9eca0c5c1259f8a8ca549709b (patch)
tree82d3aaa2905d360779ea472bc3baf91f8539758b /Tools
parentMerge pull request #2473 from cuberite/APIDumpRename (diff)
downloadcuberite-3187dbf0aa0943d9eca0c5c1259f8a8ca549709b.tar
cuberite-3187dbf0aa0943d9eca0c5c1259f8a8ca549709b.tar.gz
cuberite-3187dbf0aa0943d9eca0c5c1259f8a8ca549709b.tar.bz2
cuberite-3187dbf0aa0943d9eca0c5c1259f8a8ca549709b.tar.lz
cuberite-3187dbf0aa0943d9eca0c5c1259f8a8ca549709b.tar.xz
cuberite-3187dbf0aa0943d9eca0c5c1259f8a8ca549709b.tar.zst
cuberite-3187dbf0aa0943d9eca0c5c1259f8a8ca549709b.zip
Diffstat (limited to '')
-rw-r--r--Tools/MCADefrag/MCADefrag.cpp20
-rw-r--r--Tools/ProtoProxy/ProtoProxy.cpp14
2 files changed, 20 insertions, 14 deletions
diff --git a/Tools/MCADefrag/MCADefrag.cpp b/Tools/MCADefrag/MCADefrag.cpp
index 80c6f5be2..cf1db85d5 100644
--- a/Tools/MCADefrag/MCADefrag.cpp
+++ b/Tools/MCADefrag/MCADefrag.cpp
@@ -22,26 +22,26 @@ static const Byte g_Zeroes[4096] = {0};
int main(int argc, char ** argv)
{
- cLogger::cListener * consoleLogListener = MakeConsoleListener(false);
- cLogger::cListener * fileLogListener = new cFileListener();
- cLogger::GetInstance().AttachListener(consoleLogListener);
- cLogger::GetInstance().AttachListener(fileLogListener);
+ auto consoleLogListener = MakeConsoleListener(false);
+ auto consoleAttachment = cLogger::GetInstance().AttachListener(std::move(consoleLogListener));
+ auto fileLogListenerRet = MakeFileListener();
+ if (!fileLogListenerRet.first)
+ {
+ LOGERROR("Failed to open log file, aborting");
+ return EXIT_FAILURE;
+ }
+ auto fileAttachment = cLogger::GetInstance().AttachListener(std::move(fileLogListenerRet.second));
cLogger::InitiateMultithreading();
cMCADefrag Defrag;
if (!Defrag.Init(argc, argv))
{
- return 1;
+ return EXIT_FAILURE;
}
Defrag.Run();
- cLogger::GetInstance().DetachListener(consoleLogListener);
- delete consoleLogListener;
- cLogger::GetInstance().DetachListener(fileLogListener);
- delete fileLogListener;
-
return 0;
}
diff --git a/Tools/ProtoProxy/ProtoProxy.cpp b/Tools/ProtoProxy/ProtoProxy.cpp
index 2d27d7556..06a486778 100644
--- a/Tools/ProtoProxy/ProtoProxy.cpp
+++ b/Tools/ProtoProxy/ProtoProxy.cpp
@@ -15,11 +15,17 @@
int main(int argc, char ** argv)
{
// Initialize logging subsystem:
- cLogger::InitiateMultithreading();
auto consoleLogListener = MakeConsoleListener(false);
- auto fileLogListener = new cFileListener();
- cLogger::GetInstance().AttachListener(consoleLogListener);
- cLogger::GetInstance().AttachListener(fileLogListener);
+ auto consoleAttachment = cLogger::GetInstance().AttachListener(std::move(consoleLogListener));
+ auto fileLogListenerRet = MakeFileListener();
+ if (!fileLogListenerRet.first)
+ {
+ LOGERROR("Failed to open log file, aborting");
+ return EXIT_FAILURE;
+ }
+ auto fileAttachment = cLogger::GetInstance().AttachListener(std::move(fileLogListenerRet.second));
+
+ cLogger::InitiateMultithreading();
int ListenPort = (argc > 1) ? atoi(argv[1]) : 25564;
int ConnectPort = (argc > 2) ? atoi(argv[2]) : 25565;