Skip to content

Commit

Permalink
v3.321 Added option to avoid DST (Daylight Saving Time) problem betwe…
Browse files Browse the repository at this point in the history
…en NTFS and FAT file system
  • Loading branch information
agiudiceandrea committed Oct 11, 2017
1 parent 5400727 commit d478a49
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 8 deletions.
10 changes: 8 additions & 2 deletions FastCopy.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26730.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FastCopy", "FastCopy.vcxproj", "{D6FF3145-1A10-4739-8E42-C5327BF51584}"
ProjectSection(ProjectDependencies) = postProject
Expand All @@ -16,6 +16,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "install", "src\install\inst
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shellext", "src\shellext\shellext.vcxproj", "{DD8C289F-DDEB-4664-A8CD-65A2B067A1DF}"
ProjectSection(ProjectDependencies) = postProject
{E99EE17D-136C-4C37-B78A-18D324E7119C} = {E99EE17D-136C-4C37-B78A-18D324E7119C}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLib", "src\TLib\TLib.vcxproj", "{E99EE17D-136C-4C37-B78A-18D324E7119C}"
ProjectSection(ProjectDependencies) = postProject
Expand Down Expand Up @@ -76,4 +79,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E1E50FBD-8F38-41B2-AF97-B239608257D8}
EndGlobalSection
EndGlobal
3 changes: 3 additions & 0 deletions src/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
#define STATUSFONT_KEY "status_font"
#define STATUSFONTSIZE_KEY "status_fontsize"
#define PREVENTSLEEP_KEY "prevent_sleep"
#define DSTPROB_KEY "dst_prob"

#define NONBUFMINSIZENTFS_KEY "nonbuf_minsize_ntfs2"
#define NONBUFMINSIZEFAT_KEY "nonbuf_minsize_fat"
Expand Down Expand Up @@ -580,6 +581,7 @@ BOOL Cfg::ReadIni(WCHAR *user_dir, WCHAR *virtual_dir)
finishNotify = ini.GetInt(FINISHNOTIFY_KEY, 1);
finishNotifyTout = ini.GetInt(FINISHNOTIFYTOUT_KEY, FINISH_NOTIFY_DEFAULT);
preventSleep = ini.GetInt(PREVENTSLEEP_KEY, 1);
dstProb = ini.GetInt(DSTPROB_KEY, FALSE);

infoSpan = ini.GetInt(INFOSPAN_KEY, DEFAULT_INFOSPAN);
if (infoSpan < 0 || infoSpan > 2) infoSpan = DEFAULT_INFOSPAN;
Expand Down Expand Up @@ -834,6 +836,7 @@ BOOL Cfg::WriteIni(void)
// ini.SetInt(FINISHNOTIFYTOUT_KEY, finishNotifyTout);
ini.SetInt(PREVENTSLEEP_KEY, preventSleep);
ini.SetInt(INFOSPAN_KEY, infoSpan);
ini.SetInt(DSTPROB_KEY, dstProb);

char val[256];
sprintf(val, "%d,%d,%d,%d", winpos.x, winpos.y, winsize.cx, winsize.cy);
Expand Down
1 change: 1 addition & 0 deletions src/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class Cfg {
int finishNotify;
int finishNotifyTout;
BOOL preventSleep;
BOOL dstProb;

int infoSpan; // information update timing (0:250msec, 1:500msec, 2:1000sec)
BOOL isTopLevel;
Expand Down
25 changes: 20 additions & 5 deletions src/fastcopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1981,11 +1981,26 @@ BOOL FastCopy::IsOverWriteFile(FileStat *srcStat, FileStat *dstStat)
if ((srcStat->WriteTime() % 10000000) == 0
|| (dstStat->WriteTime() % 10000000) == 0) {
// タイムスタンプの差が 2 秒以内なら、 同一タイムスタンプとみなす
if (safe_add(dstStat->WriteTime(), 20000000) >= srcStat->WriteTime() &&
safe_add(dstStat->WriteTime(), -20000000) <= srcStat->WriteTime() &&
((info.flags & COMPARE_CREATETIME) == 0
|| safe_add(dstStat->CreateTime(), 10000000) >= srcStat->CreateTime() &&
safe_add(dstStat->CreateTime(), -10000000) <= srcStat->CreateTime()))
if (
(
(safe_add(dstStat->WriteTime(), 20000000) >= srcStat->WriteTime() &&
safe_add(dstStat->WriteTime(), -20000000) <= srcStat->WriteTime())
||
(
(info.flags & DST_PROB) &&
(
(safe_add(dstStat->WriteTime(), 36020000000) >= srcStat->WriteTime() &&
safe_add(dstStat->WriteTime(), 35980000000) <= srcStat->WriteTime())
|| (safe_add(dstStat->WriteTime(), -35980000000) >= srcStat->WriteTime() &&
safe_add(dstStat->WriteTime(), -36020000000) <= srcStat->WriteTime())
)
)
)
&&
(((info.flags & COMPARE_CREATETIME) == 0)
|| safe_add(dstStat->CreateTime(), 10000000) >= srcStat->CreateTime() &&
safe_add(dstStat->CreateTime(), -10000000) <= srcStat->CreateTime())
)
return FALSE;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/fastcopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ class FastCopy {
NET_BKUPWR_NOOVL = 0x00200000,
WRITESHARE_OPEN = 0x00800000,
//
DST_PROB = 0x00400000,
//
LISTING = 0x01000000,
LISTING_ONLY = 0x02000000,
//
Expand Down
Binary file modified src/fastcopy.rc
Binary file not shown.
1 change: 1 addition & 0 deletions src/mainwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,7 @@ BOOL TMainDlg::ExecCopy(DWORD exec_flags)
| (!is_listing && fileLogMode != NO_FILELOG ? FastCopy::LISTING : 0)
| (IsDlgButtonChecked(ACL_CHECK) ? FastCopy::WITH_ACL : 0)
| (IsDlgButtonChecked(STREAM_CHECK) ? FastCopy::WITH_ALTSTREAM : 0)
| (cfg.dstProb ? FastCopy::DST_PROB : 0)
| (cfg.aclErrLog ? FastCopy::REPORT_ACL_ERROR : 0)
| (cfg.streamErrLog ? FastCopy::REPORT_STREAM_ERROR : 0)
| (!is_delete_mode && IsDlgButtonChecked(ESTIMATE_CHECK) && !is_listing ?
Expand Down
Binary file modified src/resource.h
Binary file not shown.
2 changes: 2 additions & 0 deletions src/setupdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ BOOL TSetupSheet::SetData()
SendDlgItemMessage(HASH_COMBO, CB_SETCURSEL,
cfg->hashMode <= Cfg::SHA256 ? int(cfg->hashMode) : 3, 0);
SetDlgItemText(TIMEGRACE_EDIT, Fmt("%lld", cfg->timeDiffGrace));
CheckDlgButton(DSTPROB_CHECK, cfg->dstProb);
}
else if (resId == DEL_SHEET) {
CheckDlgButton(NSA_CHECK, cfg->enableNSA);
Expand Down Expand Up @@ -296,6 +297,7 @@ BOOL TSetupSheet::GetData()
if (GetDlgItemText(TIMEGRACE_EDIT, buf, sizeof(buf)) > 0) {
cfg->timeDiffGrace = strtoll(buf, 0, 10);
}
cfg->dstProb = IsDlgButtonChecked(DSTPROB_CHECK);
}
else if (resId == DEL_SHEET) {
cfg->enableNSA = IsDlgButtonChecked(NSA_CHECK);
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
static char *version_id =
"@(#)Copyright (C) 2004-2017 H.Shirouzu Version.cpp ver3.32";
"@(#)Copyright (C) 2004-2017 H.Shirouzu Version.cpp ver3.321";
/* ========================================================================
Project Name : Fast/Force copy file and directory
Module Name : Version
Expand Down

0 comments on commit d478a49

Please sign in to comment.