summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-04-14 18:35:41 +0200
committerattilamolnar <attilamolnar@hush.com>2013-04-14 18:35:41 +0200
commit895554aebccbeeb45e2c469d0bafa1e0d85dd8fb (patch)
tree543357ea7b5af9a17ec56ba1e5db2d33f81cc2bf /src/server.cpp
parent0a9f710e25f22fa67276aa8d15a008a5341b0f2a (diff)
Use std::string internally in UIDGenerator, move UUID_LENGTH into the class as a constant
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp9
1 files changed, 2 insertions, 7 deletions
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;