From 895554aebccbeeb45e2c469d0bafa1e0d85dd8fb Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 14 Apr 2013 18:35:41 +0200 Subject: Use std::string internally in UIDGenerator, move UUID_LENGTH into the class as a constant --- src/server.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index c49e17b56..6790b45e7 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -143,15 +143,10 @@ void UIDGenerator::init(const std::string& sid) * -- w */ + current_uid.resize(UUID_LENGTH, '9'); current_uid[0] = sid[0]; current_uid[1] = sid[1]; current_uid[2] = sid[2]; - - for (int i = 3; i < (UUID_LENGTH - 1); i++) - current_uid[i] = '9'; - - // Null terminator. Important. - current_uid[UUID_LENGTH - 1] = '\0'; } /* @@ -162,7 +157,7 @@ std::string UIDGenerator::GetUID() while (1) { // Add one to the last UID - this->IncrementUID(UUID_LENGTH - 2); + this->IncrementUID(UUID_LENGTH - 1); if (!ServerInstance->FindUUID(current_uid)) break; -- cgit v1.3.1-10-gc9f91