[FarGroup/FarManager] master: Renamings (04953171a)

0 views
Skip to first unread message

farg...@farmanager.com

unread,
May 26, 2024, 7:45:49 PMMay 26
to farco...@googlegroups.com
Repository : https://github.com/FarGroup/FarManager
On branch : master
Link : https://github.com/FarGroup/FarManager/commit/04953171ae57273c22fc97505177ac9ce8ea13c4

>---------------------------------------------------------------

commit 04953171ae57273c22fc97505177ac9ce8ea13c4
Author: Alex Alabuzhev <alab...@gmail.com>
Date: Mon May 27 00:36:18 2024 +0100

Renamings


>---------------------------------------------------------------

04953171ae57273c22fc97505177ac9ce8ea13c4
far/configdb.cpp | 4 ++--
far/cvtname.cpp | 2 +-
far/fileowner.cpp | 2 +-
far/filesystemwatcher.cpp | 2 +-
far/flink.cpp | 4 ++--
far/pathmix.cpp | 12 +++++-----
far/pathmix.hpp | 8 +++----
far/platform.fs.cpp | 58 +++++++++++++++++++++++------------------------
far/plugapi.cpp | 2 +-
far/plugins.cpp | 2 +-
far/scantree.cpp | 6 ++---
11 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/far/configdb.cpp b/far/configdb.cpp
index eb16b9d75..b411ee2ec 100644
--- a/far/configdb.cpp
+++ b/far/configdb.cpp
@@ -80,7 +80,7 @@ class representation_source
public:
explicit representation_source(string_view const File)
{
- const file_ptr XmlFile(_wfsopen(NTPath(File).c_str(), L"rb", _SH_DENYWR));
+ const file_ptr XmlFile(_wfsopen(nt_path(File).c_str(), L"rb", _SH_DENYWR));
if (!XmlFile)
throw far_known_exception(far::format(L"Error opening file \"{}\": {}"sv, File, os::format_errno(errno)));

@@ -140,7 +140,7 @@ public:

void Save(string_view const File)
{
- const file_ptr XmlFile(_wfsopen(NTPath(File).c_str(), L"w", _SH_DENYWR));
+ const file_ptr XmlFile(_wfsopen(nt_path(File).c_str(), L"w", _SH_DENYWR));
if (!XmlFile)
throw far_known_exception(far::format(L"Error opening file \"{}\": {}"sv, File, os::format_errno(errno)));

diff --git a/far/cvtname.cpp b/far/cvtname.cpp
index fe69b51dd..ff2075108 100644
--- a/far/cvtname.cpp
+++ b/far/cvtname.cpp
@@ -332,7 +332,7 @@ static string ConvertName(string_view const Object, bool(*Mutator)(string_view,

strDest = Object;

- if (HasPathPrefix(Object) || !Mutator(NTPath(Object), strDest))
+ if (HasPathPrefix(Object) || !Mutator(nt_path(Object), strDest))
return string(Object);

switch (ParsePath(strDest))
diff --git a/far/fileowner.cpp b/far/fileowner.cpp
index c83d8903a..fc2384082 100644
--- a/far/fileowner.cpp
+++ b/far/fileowner.cpp
@@ -276,7 +276,7 @@ bool SetOwnerInternal(const string& Object, const string& Owner)

bool SetFileOwner(string_view const Object, const string& Owner)
{
- const auto NtObject = NTPath(Object);
+ const auto NtObject = nt_path(Object);

if (SetOwnerInternal(NtObject, Owner))
return true;
diff --git a/far/filesystemwatcher.cpp b/far/filesystemwatcher.cpp
index 9180dfb7f..04e128a35 100644
--- a/far/filesystemwatcher.cpp
+++ b/far/filesystemwatcher.cpp
@@ -180,7 +180,7 @@ static os::handle open(const string_view Directory)

FileSystemWatcher::FileSystemWatcher(const string_view EventId, const string_view Directory, const bool WatchSubtree):
m_EventId(EventId),
- m_Directory(NTPath(Directory)),
+ m_Directory(nt_path(Directory)),
m_WatchSubtree(WatchSubtree),
m_DirectoryHandle(open(m_Directory))
{
diff --git a/far/flink.cpp b/far/flink.cpp
index 7fcbf5d43..e876677c9 100644
--- a/far/flink.cpp
+++ b/far/flink.cpp
@@ -205,7 +205,7 @@ static bool PrepareAndSetREPARSE_DATA_BUFFER(REPARSE_DATA_BUFFER& rdb, string_vi
case IO_REPARSE_TAG_MOUNT_POINT:
{
const auto PrintName = ConvertNameToFull(Target);
- const auto SubstituteName = KernelPath(NTPath(PrintName));
+ const auto SubstituteName = kernel_path(nt_path(PrintName));
if (!FillREPARSE_DATA_BUFFER(rdb, PrintName, SubstituteName))
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
@@ -222,7 +222,7 @@ static bool PrepareAndSetREPARSE_DATA_BUFFER(REPARSE_DATA_BUFFER& rdb, string_vi

if (IsAbsolutePath(Target))
{
- SubstituteNameBuffer = KernelPath(NTPath(SubstituteName));
+ SubstituteNameBuffer = kernel_path(nt_path(SubstituteName));
SubstituteName = SubstituteNameBuffer;
rdb.SymbolicLinkReparseBuffer.Flags = 0;
}
diff --git a/far/pathmix.cpp b/far/pathmix.cpp
index 243dfbc25..c4b4dcec2 100644
--- a/far/pathmix.cpp
+++ b/far/pathmix.cpp
@@ -57,7 +57,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

//----------------------------------------------------------------------------

-string NTPath(string Path)
+string nt_path(string Path)
{
if (Path.empty())
return Path;
@@ -92,17 +92,17 @@ string NTPath(string Path)
return Path;
}

-string NTPath(string_view const Path)
+string nt_path(string_view const Path)
{
- return NTPath(string(Path));
+ return nt_path(string(Path));
}

-string KernelPath(string_view const NtPath)
+string kernel_path(string_view const NtPath)
{
- return KernelPath(string(NtPath));
+ return kernel_path(string(NtPath));
}

-string KernelPath(string NtPath)
+string kernel_path(string NtPath)
{
if (HasPathPrefix(NtPath))
{
diff --git a/far/pathmix.hpp b/far/pathmix.hpp
index 6600413b2..26accaa96 100644
--- a/far/pathmix.hpp
+++ b/far/pathmix.hpp
@@ -130,11 +130,11 @@ namespace path
}
}

-string NTPath(string_view Path);
-string NTPath(string Path);
+string nt_path(string_view Path);
+string nt_path(string Path);

-string KernelPath(string_view NtPath);
-string KernelPath(string NtPath);
+string kernel_path(string_view NtPath);
+string kernel_path(string NtPath);

enum class root_type
{
diff --git a/far/platform.fs.cpp b/far/platform.fs.cpp
index 0bd29dbf6..71a5e7dcc 100644
--- a/far/platform.fs.cpp
+++ b/far/platform.fs.cpp
@@ -238,7 +238,7 @@ namespace os::fs
return GetDriveType(get_root_directory(PathType == root_type::drive_letter? Path[0] : Path[4]).c_str());
}

- auto NtPath = NTPath(Path.empty()? os::fs::get_current_directory() : Path);
+ auto NtPath = nt_path(Path.empty()? os::fs::get_current_directory() : Path);
AddEndSlash(NtPath);

return GetDriveType(NtPath.c_str());
@@ -272,7 +272,7 @@ namespace os::fs

static string enum_files_prepare(const string_view Object)
{
- string PreparedObject = NTPath(Object);
+ string PreparedObject = nt_path(Object);
auto Root = false;
ParsePath(PreparedObject, nullptr, &Root);
if (Root)
@@ -364,7 +364,7 @@ namespace os::fs

// TODO: It's a separate call so we might need an elevation for it
ULARGE_INTEGER Size;
- Size.LowPart = GetCompressedFileSize(NTPath(path::join(Directory, FindData.FileName)).c_str(), &Size.HighPart);
+ Size.LowPart = GetCompressedFileSize(nt_path(path::join(Directory, FindData.FileName)).c_str(), &Size.HighPart);
if (Size.LowPart == INVALID_FILE_SIZE && GetLastError() != NO_ERROR)
return;

@@ -505,7 +505,7 @@ namespace os::fs
string_view Str = m_Object;
// only links in the path should be processed, not the object name itself
CutToSlash(Str);
- m_Handle = FindFirstFileInternal(NTPath(path::join(ConvertNameToReal(Str), PointToName(m_Object))), Value);
+ m_Handle = FindFirstFileInternal(nt_path(path::join(ConvertNameToReal(Str), PointToName(m_Object))), Value);
}

if (!m_Handle && ElevationRequired(ELEVATION_READ_REQUEST))
@@ -542,7 +542,7 @@ namespace os::fs
if (!imports.FindFirstFileNameW)
return {};

- const auto NtFileName = NTPath(FileName);
+ const auto NtFileName = nt_path(FileName);
find_handle Handle;
// BUGBUG check result
(void)os::detail::ApiDynamicStringReceiver(LinkName, [&](std::span<wchar_t> Buffer)
@@ -605,7 +605,7 @@ namespace os::fs
{
if (imports.FindFirstStreamW && imports.FindNextStreamW)
{
- os_find_file_handle_impl Handle(imports.FindFirstStreamW(NTPath(FileName).c_str(), InfoLevel, FindStreamData, Flags));
+ os_find_file_handle_impl Handle(imports.FindFirstStreamW(nt_path(FileName).c_str(), InfoLevel, FindStreamData, Flags));
return find_file_handle(Handle? std::make_unique<os_find_file_handle_impl>(Handle.release()).release() : nullptr);
}

@@ -1841,7 +1841,7 @@ namespace os::fs

bool create_directory(const string_view TemplateDirectory, const string_view NewDirectory, SECURITY_ATTRIBUTES* SecurityAttributes)
{
- const auto NtNewDirectory = NTPath(NewDirectory);
+ const auto NtNewDirectory = nt_path(NewDirectory);

const auto Create = [&](const string& Template)
{
@@ -1859,7 +1859,7 @@ namespace os::fs
if (TemplateDirectory.empty())
return Create({});

- if (Create(NTPath(TemplateDirectory)))
+ if (Create(nt_path(TemplateDirectory)))
return true;

// CreateDirectoryEx not only can fail on some buggy FS (e.g. Samba),
@@ -1873,7 +1873,7 @@ namespace os::fs

bool remove_directory(const string_view DirName)
{
- const auto strNtName = NTPath(DirName);
+ const auto strNtName = nt_path(DirName);
if (low::remove_directory(strNtName.c_str()))
return true;

@@ -1894,7 +1894,7 @@ namespace os::fs

handle create_file(const string_view Object, const DWORD DesiredAccess, const DWORD ShareMode, SECURITY_ATTRIBUTES* SecurityAttributes, const DWORD CreationDistribution, DWORD FlagsAndAttributes, HANDLE TemplateFile, const bool ForceElevation)
{
- const auto strObject = NTPath(Object);
+ const auto strObject = nt_path(Object);
FlagsAndAttributes |= FILE_FLAG_BACKUP_SEMANTICS;
if (CreationDistribution == OPEN_EXISTING || CreationDistribution == TRUNCATE_EXISTING)
{
@@ -1935,7 +1935,7 @@ namespace os::fs

bool delete_file(const string_view FileName)
{
- const auto strNtName = NTPath(FileName);
+ const auto strNtName = nt_path(FileName);

if (low::delete_file(strNtName.c_str()))
return true;
@@ -1981,8 +1981,8 @@ namespace os::fs

bool copy_file(const string_view ExistingFileName, const string_view NewFileName, progress_routine ProgressRoutine, BOOL* const Cancel, const DWORD CopyFlags)
{
- const auto strFrom = NTPath(ExistingFileName);
- auto strTo = NTPath(NewFileName);
+ const auto strFrom = nt_path(ExistingFileName);
+ auto strTo = nt_path(NewFileName);

if (path::is_separator(strTo.back()))
{
@@ -2017,8 +2017,8 @@ namespace os::fs

bool move_file(const string_view ExistingFileName, const string_view NewFileName, const DWORD Flags)
{
- const auto strFrom = NTPath(ExistingFileName);
- auto strTo = NTPath(NewFileName);
+ const auto strFrom = nt_path(ExistingFileName);
+ auto strTo = nt_path(NewFileName);

if (path::is_separator(strTo.back()))
{
@@ -2056,9 +2056,9 @@ namespace os::fs
bool replace_file(string_view ReplacedFileName, string_view ReplacementFileName, string_view BackupFileName, DWORD Flags)
{
const auto
- To = NTPath(ReplacedFileName),
- From = NTPath(ReplacementFileName),
- Backup = NTPath(BackupFileName);
+ To = nt_path(ReplacedFileName),
+ From = nt_path(ReplacementFileName),
+ Backup = nt_path(BackupFileName);

if (low::replace_file(To.c_str(), From.c_str(), Backup.c_str(), Flags))
return true;
@@ -2072,7 +2072,7 @@ namespace os::fs

attributes get_file_attributes(const string_view FileName)
{
- const auto NtName = NTPath(FileName);
+ const auto NtName = nt_path(FileName);

const auto Result = low::get_file_attributes(NtName.c_str());
if (Result != INVALID_FILE_ATTRIBUTES)
@@ -2086,7 +2086,7 @@ namespace os::fs

bool set_file_attributes(string_view const FileName, attributes const Attributes)
{
- const auto NtName = NTPath(FileName);
+ const auto NtName = nt_path(FileName);

if (low::set_file_attributes(NtName.c_str(), Attributes))
return true;
@@ -2141,7 +2141,7 @@ namespace os::fs
bool GetVolumeNameForVolumeMountPoint(string_view const VolumeMountPoint, string& VolumeName)
{
wchar_t VolumeNameBuffer[50];
- auto strVolumeMountPoint = NTPath(VolumeMountPoint);
+ auto strVolumeMountPoint = nt_path(VolumeMountPoint);
AddEndSlash(strVolumeMountPoint);
if (!::GetVolumeNameForVolumeMountPoint(strVolumeMountPoint.c_str(), VolumeNameBuffer, static_cast<DWORD>(std::size(VolumeNameBuffer))))
return false;
@@ -2235,7 +2235,7 @@ namespace os::fs

security::descriptor get_file_security(const string_view Object, const SECURITY_INFORMATION RequestedInformation)
{
- const auto NtObject = NTPath(Object);
+ const auto NtObject = nt_path(Object);

if (auto Result = low::get_file_security(NtObject.c_str(), RequestedInformation))
return Result;
@@ -2248,7 +2248,7 @@ namespace os::fs

bool set_file_security(const string_view Object, const SECURITY_INFORMATION RequestedInformation, const security::descriptor& SecurityDescriptor)
{
- const auto NtObject = NTPath(Object);
+ const auto NtObject = nt_path(Object);

if (low::set_file_security(NtObject.c_str(), RequestedInformation, SecurityDescriptor.data()))
return true;
@@ -2261,7 +2261,7 @@ namespace os::fs

bool reset_file_security(string_view const Object)
{
- const auto NtObject = NTPath(Object);
+ const auto NtObject = nt_path(Object);
if (low::reset_file_security(NtObject.c_str()))
return true;

@@ -2284,7 +2284,7 @@ namespace os::fs

bool get_disk_size(const string_view Path, unsigned long long* const UserTotal, unsigned long long* const TotalFree, unsigned long long* const UserFree)
{
- auto strPath = NTPath(Path);
+ auto strPath = nt_path(Path);
AddEndSlash(strPath);

if (low::get_disk_free_space(strPath.c_str(), UserFree, UserTotal, TotalFree))
@@ -2366,7 +2366,7 @@ namespace os::fs
return false;
};

- if (Create(NTPath(FileName), NTPath(ExistingFileName)))
+ if (Create(nt_path(FileName), nt_path(ExistingFileName)))
return true;

// win2k bug: \\?\ fails
@@ -2378,7 +2378,7 @@ namespace os::fs

bool CreateSymbolicLink(string_view const SymlinkFileName, string_view const TargetFileName, DWORD Flags)
{
- const auto NtSymlinkFileName = NTPath(SymlinkFileName);
+ const auto NtSymlinkFileName = nt_path(SymlinkFileName);

if (CreateSymbolicLinkInternal(NtSymlinkFileName, TargetFileName, Flags))
return true;
@@ -2391,7 +2391,7 @@ namespace os::fs

bool set_file_encryption(const string_view FileName, const bool Encrypt)
{
- const auto NtName = NTPath(FileName);
+ const auto NtName = nt_path(FileName);

if (low::set_file_encryption(NtName.c_str(), Encrypt))
return true;
@@ -2404,7 +2404,7 @@ namespace os::fs

bool detach_virtual_disk(const string_view Object, VIRTUAL_STORAGE_TYPE& VirtualStorageType)
{
- const auto NtObject = NTPath(Object);
+ const auto NtObject = nt_path(Object);

if (low::detach_virtual_disk(NtObject.c_str(), VirtualStorageType))
return true;
diff --git a/far/plugapi.cpp b/far/plugapi.cpp
index d7d20935b..889393dc0 100644
--- a/far/plugapi.cpp
+++ b/far/plugapi.cpp
@@ -2127,7 +2127,7 @@ static size_t WINAPI apiConvertPath(CONVERTPATHMODES Mode, const wchar_t *Src, w
switch (Mode)
{
case CPM_NATIVE:
- strDest = NTPath(string_view{ Src });
+ strDest = nt_path(string_view{ Src });
break;

case CPM_REAL:
diff --git a/far/plugins.cpp b/far/plugins.cpp
index b271616a5..9d5eef39f 100644
--- a/far/plugins.cpp
+++ b/far/plugins.cpp
@@ -2415,7 +2415,7 @@ void PluginManager::GetContentData(
unordered_string_map<string>& ContentData
) const
{
- const auto Path = NTPath(FilePath);
+ const auto Path = nt_path(FilePath);
const auto Count = ColNames.size();

for (const auto& i: Plugins)
diff --git a/far/scantree.cpp b/far/scantree.cpp
index bfd45e8eb..3052cea5c 100644
--- a/far/scantree.cpp
+++ b/far/scantree.cpp
@@ -110,9 +110,9 @@ void ScanTree::SetFindPath(string_view const Path, string_view const Mask)
strFindPathOriginal = Path;
AddEndSlash(strFindPathOriginal);

- const auto FullPath = NTPath(ConvertNameToFull(Path));
+ const auto FullPath = nt_path(ConvertNameToFull(Path));

- strFindPath = NTPath(ConvertNameToReal(FullPath));
+ strFindPath = nt_path(ConvertNameToReal(FullPath));

scantree_item Item;
Item.RealPath = strFindPath;
@@ -229,7 +229,7 @@ bool ScanTree::GetNextName(os::fs::find_data& fdata,string &strFullName)
auto RealPath = path::join(ScanItems.back().RealPath, fdata.FileName);

if (is_link)
- RealPath = NTPath(ConvertNameToReal(RealPath));
+ RealPath = nt_path(ConvertNameToReal(RealPath));

//recursive symlinks guard
if (!ScanItems.back().ActiveDirectories.contains(RealPath))


Reply all
Reply to author
Forward
0 new messages