[BugFix] Negative statistics (pixel data, update rectangles etc). Fixed by replacing statistics variables type from int to long.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3457 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/java/src/com/tightvnc/vncviewer/VncCanvas.java b/java/src/com/tightvnc/vncviewer/VncCanvas.java
index 32d709a..823f899 100644
--- a/java/src/com/tightvnc/vncviewer/VncCanvas.java
+++ b/java/src/com/tightvnc/vncviewer/VncCanvas.java
@@ -76,17 +76,17 @@
// Update statistics.
long statStartTime; // time on first framebufferUpdateRequest
- int statNumUpdates; // counter for FramebufferUpdate messages
- int statNumTotalRects; // rectangles in FramebufferUpdate messages
- int statNumPixelRects; // the same, but excluding pseudo-rectangles
- int statNumRectsTight; // Tight-encoded rectangles (including JPEG)
- int statNumRectsTightJPEG; // JPEG-compressed Tight-encoded rectangles
- int statNumRectsZRLE; // ZRLE-encoded rectangles
- int statNumRectsHextile; // Hextile-encoded rectangles
- int statNumRectsRaw; // Raw-encoded rectangles
- int statNumRectsCopy; // CopyRect rectangles
- int statNumBytesEncoded; // number of bytes in updates, as received
- int statNumBytesDecoded; // number of bytes, as if Raw encoding was used
+ long statNumUpdates; // counter for FramebufferUpdate messages
+ long statNumTotalRects; // rectangles in FramebufferUpdate messages
+ long statNumPixelRects; // the same, but excluding pseudo-rectangles
+ long statNumRectsTight; // Tight-encoded rectangles (including JPEG)
+ long statNumRectsTightJPEG; // JPEG-compressed Tight-encoded rectangles
+ long statNumRectsZRLE; // ZRLE-encoded rectangles
+ long statNumRectsHextile; // Hextile-encoded rectangles
+ long statNumRectsRaw; // Raw-encoded rectangles
+ long statNumRectsCopy; // CopyRect rectangles
+ long statNumBytesEncoded; // number of bytes in updates, as received
+ long statNumBytesDecoded; // number of bytes, as if Raw encoding was used
// True if we process keyboard and mouse events.
boolean inputEnabled;
diff --git a/java/src/com/tightvnc/vncviewer/VncViewer.java b/java/src/com/tightvnc/vncviewer/VncViewer.java
index 7b913b3..4ff85ff 100644
--- a/java/src/com/tightvnc/vncviewer/VncViewer.java
+++ b/java/src/com/tightvnc/vncviewer/VncViewer.java
@@ -838,12 +838,12 @@
if (vc != null) {
double sec = (System.currentTimeMillis() - vc.statStartTime) / 1000.0;
double rate = Math.round(vc.statNumUpdates / sec * 100) / 100.0;
- int nRealRects = vc.statNumPixelRects;
- int nPseudoRects = vc.statNumTotalRects - vc.statNumPixelRects;
+ long nRealRects = vc.statNumPixelRects;
+ long nPseudoRects = vc.statNumTotalRects - vc.statNumPixelRects;
System.out.println("Updates received: " + vc.statNumUpdates + " (" +
nRealRects + " rectangles + " + nPseudoRects +
" pseudo), " + rate + " updates/sec");
- int numRectsOther = nRealRects - vc.statNumRectsTight
+ long numRectsOther = nRealRects - vc.statNumRectsTight
- vc.statNumRectsZRLE - vc.statNumRectsHextile
- vc.statNumRectsRaw - vc.statNumRectsCopy;
System.out.println("Rectangles:" +
@@ -855,8 +855,8 @@
" CopyRect=" + vc.statNumRectsCopy +
" other=" + numRectsOther);
- int raw = vc.statNumBytesDecoded;
- int compressed = vc.statNumBytesEncoded;
+ long raw = vc.statNumBytesDecoded;
+ long compressed = vc.statNumBytesEncoded;
if (compressed > 0) {
double ratio = Math.round((double)raw / compressed * 1000) / 1000.0;
System.out.println("Pixel data: " + vc.statNumBytesDecoded +