From 3a83b3f66abc06e25ed48665a5d639a11b5d4b96 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sun, 7 Feb 2010 14:24:50 +0000 Subject: [PATCH] 0...1000 is the key range --- Src/data_store.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Src/data_store.cpp b/Src/data_store.cpp index c6af296..baff79e 100644 --- a/Src/data_store.cpp +++ b/Src/data_store.cpp @@ -8,8 +8,7 @@ DataStore::DataStore() this->registeredData = NULL; this->n_registeredData = 0; - /* Convention: Odd numbers for the clients */ - this->key_counter = 1; + this->key_counter = 0; } DataStore::~DataStore() @@ -72,10 +71,10 @@ uint32_t DataStore::getNextKey() { uint32_t out = this->key_counter; - this->key_counter += 2; + this->key_counter++; - if (this->key_counter > DATA_KEY_RANGE) - this->key_counter = 1; + if (this->key_counter >= DATA_KEY_RANGE) + this->key_counter = 0; return out; }