OSDN Git Service

転送量カウンタのオーバーフロー修正 IM0027-5-2
authoreru <eru01@users.sourceforge.jp>
Sat, 28 Jun 2008 13:51:59 +0000 (13:51 +0000)
committereru <eru01@users.sourceforge.jp>
Sat, 28 Jun 2008 13:51:59 +0000 (13:51 +0000)
PeerCast.root/PeerCast/core/common/stats.cpp
PeerCast.root/PeerCast/core/common/stats.h
PeerCast.root/PeerCast/core/common/version2.h
PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp
c:/Git/PeerCast.root/PeerCast/core/common/stats.cpp
c:/Git/PeerCast.root/PeerCast/core/common/stats.h
c:/Git/PeerCast.root/PeerCast/core/common/version2.h
c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.cpp

index 46e0a44..0a18198 100644 (file)
@@ -52,7 +52,7 @@ void  Stats::update()
                
                for(int i=0; i<Stats::MAX; i++)
                {
-                       perSec[i] = (current[i]-last[i])/diff;
+                       perSec[i] = (unsigned)(current[i]-last[i])/diff;
                        last[i] = current[i];
                }
 
index 9c52717..1d635c1 100644 (file)
@@ -74,9 +74,10 @@ public:
        void    clear(STAT s) {current[s]=0;}
        void    add(STAT s,int n=1) {current[s]+=n;}
        unsigned int getPerSecond(STAT s) {return perSec[s];}
-       unsigned int getCurrent(STAT s) {return current[s];}
+       unsigned long long int getCurrent(STAT s) {return current[s];}
 
-       unsigned int    current[Stats::MAX],last[Stats::MAX],perSec[Stats::MAX];
+       unsigned long long int  current[Stats::MAX],last[Stats::MAX];
+       unsigned int perSec[Stats::MAX];
        unsigned int    lastUpdate;
 };
 
index 6dec935..d354394 100644 (file)
@@ -45,8 +45,8 @@ extern int version_ex; // PP
 //#define VERSION_EX 1
 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
 static const int  PCP_CLIENT_VERSION_EX_NUMBER = 27;
-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0027-5)";
-static const char *PCX_VERSTRING_EX = "v0.1218(IM0027-5)";
+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0027-5-2)";
+static const char *PCX_VERSTRING_EX = "v0.1218(IM0027-5-2)";
 #endif
 
 // ------------------------------------------------
index d7b4fd4..d777ed1 100644 (file)
@@ -1564,8 +1564,8 @@ LRESULT CALLBACK TrafficDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
                        char suffix[][3] = { "B", "KB", "MB", "GB" };
                        const int bufsize = 60;
                        char szUp[bufsize], szDown[bufsize];
-                       unsigned int totalDown = stats.getCurrent(Stats::BYTESIN) - stats.getCurrent(Stats::LOCALBYTESIN);
-                       unsigned int totalUp = stats.getCurrent(Stats::BYTESOUT) - stats.getCurrent(Stats::LOCALBYTESOUT);
+                       unsigned long long int totalDown = stats.getCurrent(Stats::BYTESIN) - stats.getCurrent(Stats::LOCALBYTESIN);
+                       unsigned long long int totalUp = stats.getCurrent(Stats::BYTESOUT) - stats.getCurrent(Stats::LOCALBYTESOUT);
 
                        // up
                        for (int i=GB; i>0; --i)
index 46e0a44..0a18198 100644 (file)
@@ -52,7 +52,7 @@ void  Stats::update()
                
                for(int i=0; i<Stats::MAX; i++)
                {
-                       perSec[i] = (current[i]-last[i])/diff;
+                       perSec[i] = (unsigned)(current[i]-last[i])/diff;
                        last[i] = current[i];
                }
 
index 9c52717..1d635c1 100644 (file)
@@ -74,9 +74,10 @@ public:
        void    clear(STAT s) {current[s]=0;}
        void    add(STAT s,int n=1) {current[s]+=n;}
        unsigned int getPerSecond(STAT s) {return perSec[s];}
-       unsigned int getCurrent(STAT s) {return current[s];}
+       unsigned long long int getCurrent(STAT s) {return current[s];}
 
-       unsigned int    current[Stats::MAX],last[Stats::MAX],perSec[Stats::MAX];
+       unsigned long long int  current[Stats::MAX],last[Stats::MAX];
+       unsigned int perSec[Stats::MAX];
        unsigned int    lastUpdate;
 };
 
index 6dec935..d354394 100644 (file)
@@ -45,8 +45,8 @@ extern int version_ex; // PP
 //#define VERSION_EX 1
 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only
 static const int  PCP_CLIENT_VERSION_EX_NUMBER = 27;
-static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0027-5)";
-static const char *PCX_VERSTRING_EX = "v0.1218(IM0027-5)";
+static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0027-5-2)";
+static const char *PCX_VERSTRING_EX = "v0.1218(IM0027-5-2)";
 #endif
 
 // ------------------------------------------------
index d7b4fd4..d777ed1 100644 (file)
@@ -1564,8 +1564,8 @@ LRESULT CALLBACK TrafficDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
                        char suffix[][3] = { "B", "KB", "MB", "GB" };
                        const int bufsize = 60;
                        char szUp[bufsize], szDown[bufsize];
-                       unsigned int totalDown = stats.getCurrent(Stats::BYTESIN) - stats.getCurrent(Stats::LOCALBYTESIN);
-                       unsigned int totalUp = stats.getCurrent(Stats::BYTESOUT) - stats.getCurrent(Stats::LOCALBYTESOUT);
+                       unsigned long long int totalDown = stats.getCurrent(Stats::BYTESIN) - stats.getCurrent(Stats::LOCALBYTESIN);
+                       unsigned long long int totalUp = stats.getCurrent(Stats::BYTESOUT) - stats.getCurrent(Stats::LOCALBYTESOUT);
 
                        // up
                        for (int i=GB; i>0; --i)