COMP: reduce off_t as int64 for windows compilation

- avoids unresolved pTraits<long int> for reductions
This commit is contained in:
Mark Olesen
2025-06-18 17:43:48 +02:00
parent 7021b073cf
commit 3c4e226130
2 changed files with 17 additions and 5 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2018 OpenFOAM Foundation
Copyright (C) 2019-2024 OpenCFD Ltd.
Copyright (C) 2019-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -867,7 +867,7 @@ off_t Foam::fileOperations::masterUncollatedFileOperation::fileSize
const bool followLink
) const
{
return masterOp<off_t>
return masterOp<fileSizeOp::value_type>
(
fName,
fileSizeOp(followLink),

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenFOAM Foundation
Copyright (C) 2019-2024 OpenCFD Ltd.
Copyright (C) 2019-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -222,14 +222,26 @@ protected:
{
const bool followLink_;
public:
fileSizeOp(const bool followLink)
#ifdef _WIN32
// off_t is 'long int' for windows (missing pTraits)
typedef int64_t value_type;
#else
typedef off_t value_type;
#endif
fileSizeOp(bool followLink) noexcept
:
followLink_(followLink)
{}
off_t operator()(const fileName& f) const
auto operator()(const fileName& f) const
{
#ifdef _WIN32
return value_type(Foam::fileSize(f, followLink_));
#else
return Foam::fileSize(f, followLink_);
#endif
}
};