summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------MCServer/Plugins/Core0
-rw-r--r--MCServer/favicon.pngbin0 -> 9265 bytes
-rw-r--r--Tools/ProtoProxy/Connection.cpp4
-rw-r--r--src/StringUtils.cpp10
-rw-r--r--src/main.cpp5
5 files changed, 11 insertions, 8 deletions
diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core
-Subproject 302115ae19276227bf371971d4b6fa5f9f857da
+Subproject c65b56767a5e59ca387a05be72ef18791baa9ae
diff --git a/MCServer/favicon.png b/MCServer/favicon.png
new file mode 100644
index 000000000..946cce005
--- /dev/null
+++ b/MCServer/favicon.png
Binary files differ
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index 10f2b4073..f38ea02ed 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -2390,12 +2390,12 @@ bool cConnection::HandleServerStatusResponse(void)
{
Response.assign(Response.substr(0, idx + sizeof(DescSearch) - 1) + "ProtoProxy: " + Response.substr(idx + sizeof(DescSearch) - 1));
}
- cByteBuffer Packet(1000);
+ cByteBuffer Packet(Response.size() + 50);
Packet.WriteVarInt(0); // Packet type - status response
Packet.WriteVarUTF8String(Response);
AString Pkt;
Packet.ReadAll(Pkt);
- cByteBuffer ToClient(1000);
+ cByteBuffer ToClient(Response.size() + 50);
ToClient.WriteVarUTF8String(Pkt);
CLIENTSEND(ToClient);
return true;
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index 5d16616c5..0b38297ef 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -47,15 +47,13 @@ AString & AppendVPrintf(AString & str, const char *format, va_list args)
#endif // _MSC_VER
// Allocate a buffer and printf into it:
- str.resize(len + 1);
- // HACK: we're accessing AString's internal buffer in a way that is NOT guaranteed to always work. But it works on all STL implementations tested.
- // I can't think of any other way that is safe, doesn't allocate twice as much space as needed and doesn't use C++11 features like the move constructor
+ std::vector<char> Buffer(len + 1);
#ifdef _MSC_VER
- vsprintf_s((char *)str.data(), len + 1, format, args);
+ vsprintf_s((char *)&(Buffer.front()), Buffer.size(), format, args);
#else // _MSC_VER
- vsnprintf((char *)str.data(), len + 1, format, args);
+ vsnprintf((char *)&(Buffer.front()), Buffer.size(), format, args);
#endif // else _MSC_VER
- str.resize(len);
+ str.append(&(Buffer.front()), Buffer.size() - 1);
return str;
}
diff --git a/src/main.cpp b/src/main.cpp
index 81c6b41e4..0620e0f0e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -50,6 +50,11 @@ void NonCtrlHandler(int a_Signal)
LOGWARN("Segmentation fault; MCServer has crashed :(");
exit(EXIT_FAILURE);
}
+ case SIGTERM:
+ {
+ std::signal(SIGTERM, SIG_IGN); // Server is shutting down, wait for it...
+ break;
+ }
default: break;
}
}