diff --git a/appveyor.yml b/appveyor.yml index b906c34..576a99f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,7 +14,9 @@ init: #version: 1.0.{build} image: Visual Studio 2019 configuration: Release -platform: Win32 +platform: + - Win32 + - x64 for: - branches: @@ -27,7 +29,7 @@ build: project: finddupe.sln verbosity: normal artifacts: -- path: Release/*.exe +- path: $(platform)/Release/*.exe name: finddupe deploy: release: finddupe-v$(MY_BUILD_VERSION) diff --git a/finddupe.c b/finddupe.c index 5d8d133..604c49e 100644 --- a/finddupe.c +++ b/finddupe.c @@ -33,6 +33,7 @@ // Version 1.33 (c) Jun 2024 thomas694 // fixed a problem writing filenames with special unicode characters to the batch file // fixed a memory problem with very large amounts of files +// added a 64-bit version for addressing more memory // // finddupe is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -97,7 +98,7 @@ typedef struct { }Checksum_t; KHASH_MAP_INIT_INT64(hset, Checksum_t) -KHASH_MAP_INIT_INT64(hmap, INT32) +KHASH_MAP_INIT_INT64(hmap, UINT64) // Data structure for file allocations: typedef struct FileData_t FileData_t; @@ -262,7 +263,7 @@ static khiter_t kh_put_fn(INT64 filenameCRC) return k; } -static khiter_t kh_get_fd(INT64 fileSize, int createNew, int* found) +static khiter_t kh_get_fd(UINT64 fileSize, int createNew, int* found) { khint_t k = kh_get(hmap, FileDataMap, fileSize); if (k == kh_end(FileDataMap)) @@ -275,7 +276,7 @@ static khiter_t kh_get_fd(INT64 fileSize, int createNew, int* found) return k; } -static khiter_t kh_put_fd(INT64 fileSize) +static khiter_t kh_put_fd(UINT64 fileSize) { int ret; khint_t k = kh_put(hmap, FileDataMap, fileSize, &ret); @@ -1107,10 +1108,11 @@ int _tmain (int argc, TCHAR **argv) } #endif - if (BatchFileName){ + if (BatchFileName) { BatchFile = _tfopen(BatchFileName, TEXT("w")); - if (BatchFile == NULL){ - _tprintf(TEXT("Unable to open task batch file '%s'\n"), BatchFileName); + if (BatchFile == NULL) { + _ftprintf(stderr, TEXT("Unable to open task batch file '%s'\n"), BatchFileName); + exit(EXIT_FAILURE); } _ftprintf(BatchFile, TEXT("@echo off\n")); _ftprintf(BatchFile, TEXT("REM Batch file for replacing duplicates with hard links\n")); diff --git a/finddupe.sln b/finddupe.sln index ff25ec5..227f41f 100644 --- a/finddupe.sln +++ b/finddupe.sln @@ -7,16 +7,25 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "finddupe", "finddupe.vcxpro EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 Debug|Win32 = Debug|Win32 + Release|x64 = Release|x64 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5ACEBB24-9088-4D2B-9B89-0AABE4250D99}.Debug|x64.ActiveCfg = Debug|x64 + {5ACEBB24-9088-4D2B-9B89-0AABE4250D99}.Debug|x64.Build.0 = Debug|x64 {5ACEBB24-9088-4D2B-9B89-0AABE4250D99}.Debug|Win32.ActiveCfg = Debug|Win32 {5ACEBB24-9088-4D2B-9B89-0AABE4250D99}.Debug|Win32.Build.0 = Debug|Win32 + {5ACEBB24-9088-4D2B-9B89-0AABE4250D99}.Release|x64.ActiveCfg = Release|x64 + {5ACEBB24-9088-4D2B-9B89-0AABE4250D99}.Release|x64.Build.0 = Release|x64 {5ACEBB24-9088-4D2B-9B89-0AABE4250D99}.Release|Win32.ActiveCfg = Release|Win32 {5ACEBB24-9088-4D2B-9B89-0AABE4250D99}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3A64AB72-6B0A-47D2-AD66-AF9F429A90A5} + EndGlobalSection EndGlobal diff --git a/finddupe.vcxproj b/finddupe.vcxproj index 31a83ea..1ae50f1 100644 --- a/finddupe.vcxproj +++ b/finddupe.vcxproj @@ -5,10 +5,18 @@ Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + {5ACEBB24-9088-4D2B-9B89-0AABE4250D99} @@ -23,6 +31,12 @@ Unicode v142 + + Application + true + Unicode + v142 + Application false @@ -30,21 +44,48 @@ Unicode v142 + + Application + false + true + Unicode + v142 + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(ProjectName) + + + true + $(ProjectName)_x64 false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(ProjectName) + + + false + $(ProjectName)_x64 @@ -59,6 +100,19 @@ true + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + Level3 @@ -76,6 +130,23 @@ true + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + diff --git a/myglob.c b/myglob.c index 29b3dae..2af848f 100644 --- a/myglob.c +++ b/myglob.c @@ -240,7 +240,7 @@ static void Recurse(const TCHAR * Pattern, int FollowReparse, void (*FileFuncPar int NumHave = 0; struct _tfinddata_t finddata; - long find_handle; + intptr_t find_handle; find_handle = _tfindfirst(MatchPattern, &finddata);