Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ssh.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4379 by doda, Wed Mar 9 08:56:17 2011 UTC revision 4381 by doda, Thu Mar 10 10:04:51 2011 UTC
# Line 7468  static unsigned __stdcall ssh_scp_thread Line 7468  static unsigned __stdcall ssh_scp_thread
7468          HWND hWnd = c->scp.progress_window;          HWND hWnd = c->scp.progress_window;
7469          scp_dlg_parm_t parm;          scp_dlg_parm_t parm;
7470          int rate, ProgStat;          int rate, ProgStat;
7471            DWORD stime;
7472            int elapsed, prev_elapsed;
7473    
7474          //SendMessage(GetDlgItem(hWnd, IDC_FILENAME), WM_SETTEXT, 0, (LPARAM)c->scp.localfile);          //SendMessage(GetDlgItem(hWnd, IDC_FILENAME), WM_SETTEXT, 0, (LPARAM)c->scp.localfile);
7475          SendMessage(GetDlgItem(hWnd, IDC_FILENAME), WM_SETTEXT, 0, (LPARAM)c->scp.localfilefull);          SendMessage(GetDlgItem(hWnd, IDC_FILENAME), WM_SETTEXT, 0, (LPARAM)c->scp.localfilefull);
7476    
7477          InitDlgProgress(hWnd, IDC_PROGBAR, &ProgStat);          InitDlgProgress(hWnd, IDC_PROGBAR, &ProgStat);
7478    
7479            stime = GetTickCount();
7480            prev_elapsed = 0;
7481    
7482          do {          do {
7483                  // Cancelボタンが押下されたらウィンドウが消える。                  // Cancelボタンが押下されたらウィンドウが消える。
7484                  if (is_canceled_window(hWnd))                  if (is_canceled_window(hWnd))
# Line 7512  static unsigned __stdcall ssh_scp_thread Line 7517  static unsigned __stdcall ssh_scp_thread
7517                          SendDlgItemMessage(hWnd, IDC_PROGBAR, PBM_SETPOS, (WPARAM)ProgStat, 0);                          SendDlgItemMessage(hWnd, IDC_PROGBAR, PBM_SETPOS, (WPARAM)ProgStat, 0);
7518                  }                  }
7519    
7520                    elapsed = (GetTickCount() - stime) / 1000;
7521                    if (elapsed > prev_elapsed) {
7522                            if (elapsed > 2) {
7523                                    rate = (int)(total_size / elapsed);
7524                                    if (rate < 1200) {
7525                                            _snprintf_s(s, sizeof(s), _TRUNCATE, "%d:%02d (%d %s)", elapsed / 60, elapsed % 60, rate, "Bytes/s");
7526                                    }
7527                                    else if (rate < 1200000) {
7528                                            _snprintf_s(s, sizeof(s), _TRUNCATE, "%d:%02d (%d.%02d %s)", elapsed / 60, elapsed % 60, rate / 1000, rate / 10 % 100, "KBytes/s");
7529                                    }
7530                                    else {
7531                                            _snprintf_s(s, sizeof(s), _TRUNCATE, "%d:%02d (%d.%02d %s)", elapsed / 60, elapsed % 60, rate / (1000 * 1000), rate / 100000 % 100, "MBytes/s");
7532                                    }
7533                            }
7534                            else {
7535                                    _snprintf_s(s, sizeof(s), _TRUNCATE, "%d:%02d", elapsed / 60, elapsed % 60);
7536                            }
7537                            SendDlgItemMessage(hWnd, IDC_PROGTIME, WM_SETTEXT, 0, (LPARAM)s);
7538                            prev_elapsed = elapsed;
7539                    }
7540    
7541          } while (ret <= sizeof(buf));          } while (ret <= sizeof(buf));
7542    
7543          // eof          // eof
# Line 7602  static unsigned __stdcall ssh_scp_receiv Line 7628  static unsigned __stdcall ssh_scp_receiv
7628          unsigned int buflen;          unsigned int buflen;
7629          int eof;          int eof;
7630          int rate, ProgStat;          int rate, ProgStat;
7631            DWORD stime;
7632            int elapsed, prev_elapsed;
7633    
7634          InitDlgProgress(hWnd, IDC_PROGBAR, &ProgStat);          InitDlgProgress(hWnd, IDC_PROGBAR, &ProgStat);
7635    
7636            stime = GetTickCount();
7637            prev_elapsed = 0;
7638    
7639          for (;;) {          for (;;) {
7640                  // Cancelボタンが押下されたらウィンドウが消える。                  // Cancelボタンが押下されたらウィンドウが消える。
7641                  if (is_canceled_window(hWnd))                  if (is_canceled_window(hWnd))
# Line 7644  static unsigned __stdcall ssh_scp_receiv Line 7675  static unsigned __stdcall ssh_scp_receiv
7675                                          SendDlgItemMessage(c->scp.progress_window, IDC_PROGBAR, PBM_SETPOS, (WPARAM)ProgStat, 0);                                          SendDlgItemMessage(c->scp.progress_window, IDC_PROGBAR, PBM_SETPOS, (WPARAM)ProgStat, 0);
7676                                  }                                  }
7677    
7678                                    elapsed = (GetTickCount() - stime) / 1000;
7679                                    if (elapsed > prev_elapsed) {
7680                                            if (elapsed > 2) {
7681                                                    rate = (int)(c->scp.filercvsize / elapsed);
7682                                                    if (rate < 1200) {
7683                                                            _snprintf_s(s, sizeof(s), _TRUNCATE, "%d:%02d (%d %s)", elapsed / 60, elapsed % 60, rate, "Bytes/s");
7684                                                    }
7685                                                    else if (rate < 1200000) {
7686                                                            _snprintf_s(s, sizeof(s), _TRUNCATE, "%d:%02d (%d.%02d %s)", elapsed / 60, elapsed % 60, rate / 1000, rate / 10 % 100, "KBytes/s");
7687                                                    }
7688                                                    else {
7689                                                            _snprintf_s(s, sizeof(s), _TRUNCATE, "%d:%02d (%d.%02d %s)", elapsed / 60, elapsed % 60, rate / (1000 * 1000), rate / 10000 % 100, "MBytes/s");
7690                                                    }
7691                                            }
7692                                            else {
7693                                                    _snprintf_s(s, sizeof(s), _TRUNCATE, "%d:%02d", elapsed / 60, elapsed % 60);
7694                                            }
7695                                            SendDlgItemMessage(hWnd, IDC_PROGTIME, WM_SETTEXT, 0, (LPARAM)s);
7696                                            prev_elapsed = elapsed;
7697                                    }
7698    
7699                                  if (eof)                                  if (eof)
7700                                          goto done;                                          goto done;
7701    

Legend:
Removed from v.4379  
changed lines
  Added in v.4381

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26