From 9233a6258f8732aacc903e6cf3eb1d5598a35058 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 19 Mar 2009 13:54:09 +0000 Subject: 2009-03-19 Tatsuhiro Tsujikawa 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 --- src/CUIDCounter.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/CUIDCounter.h') 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; } }; -- cgit