summaryrefslogtreecommitdiff
path: root/src/CUIDCounter.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-03-19 13:54:09 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-03-19 13:54:09 +0000
commit9233a6258f8732aacc903e6cf3eb1d5598a35058 (patch)
tree36f4fba944ce1a7e7e47a1e18248065d4153179b /src/CUIDCounter.h
parente3ed6adf91180f11edd407432bda16aa5f474dde (diff)
2009-03-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Typedefed cuid_t as int32_t in Command.h * src/CUIDCounter.h * src/Command.cc * src/Command.h * src/DownloadEngine.cc * src/DownloadEngine.h * src/PeerStat.h * src/SegmentMan.cc * src/SegmentMan.h
Diffstat (limited to 'src/CUIDCounter.h')
-rw-r--r--src/CUIDCounter.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/CUIDCounter.h b/src/CUIDCounter.h
index 7d7b94e1..ab6097f7 100644
--- a/src/CUIDCounter.h
+++ b/src/CUIDCounter.h
@@ -36,22 +36,25 @@
#define _D_CUID_COUNTER_H_
#include "common.h"
+#include "Command.h"
namespace aria2 {
-typedef int32_t CUID;
-
class CUIDCounter {
private:
- int32_t count;
+ cuid_t _count;
public:
- CUIDCounter():count(0) {}
+ CUIDCounter():_count(0) {}
~CUIDCounter() {}
- CUID newID()
+ cuid_t newID()
{
- return ++count;
+ cuid_t id = ++_count;
+ if(id == INT32_MAX) {
+ _count = 0;
+ }
+ return id;
}
};