Patch for File Transfer Progress Bar with Files > 2GB
Dino Klein
zagzag-lists at speakeasy.net
Wed Nov 30 05:12:06 MET 2005
The progress bar in the transfer window goes fakakta when transferring
files larger than 2GB. This happens because the progress bar uses int
to represent min/max/progress, while a file size requires a long variable.
So, I changed the progress bar not to use the file size as the max, but
employ "steps"; this combined with a bit of arithmetic seems to take
care of business.
diff -ru mindterm_3.0-orig/com/mindbright/sshcommon/SSHFileTransferGUIThreadSwing.java mindterm_3.0/com/mindbright/sshcommon/SSHFileTransferGUIThreadSwing.java
--- mindterm_3.0-orig/com/mindbright/sshcommon/SSHFileTransferGUIThreadSwing.java 2005-10-06 06:37:47.000000000 -0400
+++ mindterm_3.0/com/mindbright/sshcommon/SSHFileTransferGUIThreadSwing.java 2005-11-29 22:34:46.000000000 -0500
@@ -44,20 +44,24 @@
private static class ProgressBar extends JProgressBar implements Progress {
- ProgressBar(int max, int w, int h) {
- super(0, max);
+ private static final int STEPS = 2048;
+ private long max;
+
+ ProgressBar(long max, int w, int h) {
+ super(0, steps);
+ this.max = max;
}
public void progress(int value) {
- setValue(value);
+ setValue((int)(value/(double)max * STEPS));
}
public void setValue(long value) {
- setValue((int)value);
+ setValue((int)(value/(double)max * STEPS));
}
public void setMaximum(long value) {
- setMaximum((int)value);
+ max = value;
}
}
More information about the Mindterm-users
mailing list