[librpfile] XAttrReader: Rename the "compressionAlgorithm" stuff to "zAlgorithm".

[kde,win32] Update for this change.
This commit is contained in:
David Korth 2025-05-02 21:10:41 -04:00
parent bca1c48b59
commit 147f9c745d
7 changed files with 42 additions and 42 deletions

View File

@ -98,14 +98,14 @@ int XAttrViewPrivate::loadExt2Attrs(void)
// since most file systems that support compression support
// Ext2-style attributes.
if (!xattrReader->hasExt2Attributes() &&
!xattrReader->hasCompressionAlgorithm()) {
!xattrReader->hasZAlgorithm()) {
// No Ext2 attributes.
return -ENOENT;
}
// We have Ext2 attributes.
ui.ext2AttrView->setFlags(xattrReader->ext2Attributes());
ui.ext2AttrView->setZAlgorithm(xattrReader->compressionAlgorithm());
ui.ext2AttrView->setZAlgorithm(xattrReader->zAlgorithm());
ui.grpExt2Attributes->show();
return 0;
}

View File

@ -131,20 +131,20 @@ unsigned int XAttrReader::validDosAttributes(void) const
* Get the compression algoirthm used for this file.
* @return Compression algorithm
*/
XAttrReader::ZAlgorithm XAttrReader::compressionAlgorithm(void) const
XAttrReader::ZAlgorithm XAttrReader::zAlgorithm(void) const
{
RP_D(const XAttrReader);
return d->compressionAlgorithm;
return d->zAlgorithm;
}
/**
* Does this file have a compression algorithm specified?
* @return True if it does; false if not.
*/
bool XAttrReader::hasCompressionAlgorithm(void) const
bool XAttrReader::hasZAlgorithm(void) const
{
RP_D(const XAttrReader);
return d->hasCompressionAlgorithm;
return d->hasZAlgorithm;
}
/**

View File

@ -125,13 +125,13 @@ public:
* Get the compression algoirthm used for this file.
* @return Compression algorithm
*/
ZAlgorithm compressionAlgorithm(void) const;
ZAlgorithm zAlgorithm(void) const;
/**
* Does this file have a compression algorithm specified?
* @return True if it does; false if not.
*/
bool hasCompressionAlgorithm(void) const;
bool hasZAlgorithm(void) const;
/**
* Does this file have generic extended attributes?

View File

@ -64,7 +64,7 @@ public:
* Internal fd (filename on Windows) must be set.
* @return 0 on success; negative POSIX error code on error.
*/
int loadCompressionAlgorithm(void);
int loadZAlgorithm(void);
#ifdef _WIN32
# ifdef UNICODE
@ -110,7 +110,7 @@ public:
bool hasExt2Attributes;
bool hasXfsAttributes;
bool hasDosAttributes;
bool hasCompressionAlgorithm;
bool hasZAlgorithm;
bool hasGenericXAttrs;
int ext2Attributes;
@ -118,7 +118,7 @@ public:
uint32_t xfsProjectId;
unsigned int dosAttributes;
unsigned int validDosAttributes;
XAttrReader::ZAlgorithm compressionAlgorithm;
XAttrReader::ZAlgorithm zAlgorithm;
XAttrReader::XAttrList genericXAttrs;
};

View File

@ -113,14 +113,14 @@ XAttrReaderPrivate::XAttrReaderPrivate(const char *filename)
, hasExt2Attributes(false)
, hasXfsAttributes(false)
, hasDosAttributes(false)
, hasCompressionAlgorithm(false)
, hasZAlgorithm(false)
, hasGenericXAttrs(false)
, ext2Attributes(0)
, xfsXFlags(0)
, xfsProjectId(0)
, dosAttributes(0)
, validDosAttributes(0)
, compressionAlgorithm(XAttrReader::ZAlgorithm::None)
, zAlgorithm(XAttrReader::ZAlgorithm::None)
{
// Make sure this is a regular file or a directory.
mode_t mode;
@ -176,7 +176,7 @@ XAttrReaderPrivate::XAttrReaderPrivate(const char *filename)
loadExt2Attrs();
loadXfsAttrs();
loadDosAttrs();
loadCompressionAlgorithm();
loadZAlgorithm();
loadGenericXattrs();
lastError = 0;
@ -325,10 +325,10 @@ int XAttrReaderPrivate::loadDosAttrs(void)
* Internal fd (filename on Windows) must be set.
* @return 0 on success; negative POSIX error code on error.
*/
int XAttrReaderPrivate::loadCompressionAlgorithm(void)
int XAttrReaderPrivate::loadZAlgorithm(void)
{
hasCompressionAlgorithm = false;
compressionAlgorithm = XAttrReader::ZAlgorithm::None;
hasZAlgorithm = false;
zAlgorithm = XAttrReader::ZAlgorithm::None;
#if defined(__linux__) && defined(HAVE_SYS_XATTR_H) && !defined(__stub_getxattr)
// TODO: Get the mount point, then look it up in /proc/mounts.
@ -354,14 +354,14 @@ int XAttrReaderPrivate::loadCompressionAlgorithm(void)
value[sizeof(value)-1] = '\0';
if (!strcmp(value, "zlib")) {
compressionAlgorithm = XAttrReader::ZAlgorithm::ZLIB;
hasCompressionAlgorithm = true;
zAlgorithm = XAttrReader::ZAlgorithm::ZLIB;
hasZAlgorithm = true;
} else if (!strcmp(value, "lzo")) {
compressionAlgorithm = XAttrReader::ZAlgorithm::LZO;
hasCompressionAlgorithm = true;
zAlgorithm = XAttrReader::ZAlgorithm::LZO;
hasZAlgorithm = true;
} else if (!strcmp(value, "zstd")) {
compressionAlgorithm = XAttrReader::ZAlgorithm::ZSTD;
hasCompressionAlgorithm = true;
zAlgorithm = XAttrReader::ZAlgorithm::ZSTD;
hasZAlgorithm = true;
}
break;
}

View File

@ -92,14 +92,14 @@ XAttrReaderPrivate::XAttrReaderPrivate(const char *filename)
, hasExt2Attributes(false)
, hasXfsAttributes(false)
, hasDosAttributes(false)
, hasCompressionAlgorithm(false)
, hasZAlgorithm(false)
, hasGenericXAttrs(false)
, ext2Attributes(0)
, xfsXFlags(0)
, xfsProjectId(0)
, dosAttributes(0)
, validDosAttributes(0)
, compressionAlgorithm(XAttrReader::ZAlgorithm::None)
, zAlgorithm(XAttrReader::ZAlgorithm::None)
{
// NOTE: While there is a GetFileInformationByHandle() function,
// there's no easy way to get alternate data streams using a
@ -112,7 +112,7 @@ XAttrReaderPrivate::XAttrReaderPrivate(const char *filename)
// NOTE: Load the compression algorithm first.
// GetFileAttributes() does *not* set "Compressed" if a
// WIM compression method is set.
loadCompressionAlgorithm();
loadZAlgorithm();
loadDosAttrs();
loadGenericXattrs();
@ -190,7 +190,7 @@ int XAttrReaderPrivate::loadDosAttrs(void)
if (fileSystemFlags & FILE_FILE_COMPRESSION) {
// Compression is supported.
validDosAttributes |= FILE_ATTRIBUTE_COMPRESSED;
if (hasCompressionAlgorithm && compressionAlgorithm > XAttrReader::ZAlgorithm::None) {
if (hasZAlgorithm && zAlgorithm > XAttrReader::ZAlgorithm::None) {
// File is definitely compressed.
// GetFileAttributes() will *not* set FILE_ATTRIBUTE_COMPRESSED for
// anything other than LZNT1, so we'll set it ourselves.
@ -211,15 +211,15 @@ int XAttrReaderPrivate::loadDosAttrs(void)
* Internal fd (filename on Windows) must be set.
* @return 0 on success; negative POSIX error code on error.
*/
int XAttrReaderPrivate::loadCompressionAlgorithm(void)
int XAttrReaderPrivate::loadZAlgorithm(void)
{
HANDLE hFile = CreateFile(filename.c_str(),
GENERIC_READ, FILE_SHARE_READ, nullptr,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (!hFile || hFile == INVALID_HANDLE_VALUE) {
// Unable to open the file...
hasCompressionAlgorithm = false;
compressionAlgorithm = XAttrReader::ZAlgorithm::None;
hasZAlgorithm = false;
zAlgorithm = XAttrReader::ZAlgorithm::None;
return -EIO;
}
@ -250,9 +250,9 @@ int XAttrReaderPrivate::loadCompressionAlgorithm(void)
Buffer.ProviderInfo.Algorithm <= FILE_PROVIDER_COMPRESSION_XPRESS16K)
{
// Supported algorithm.
compressionAlgorithm = static_cast<XAttrReader::ZAlgorithm>(
zAlgorithm = static_cast<XAttrReader::ZAlgorithm>(
static_cast<int>(XAttrReader::ZAlgorithm::XPRESS4K) + Buffer.ProviderInfo.Algorithm);
hasCompressionAlgorithm = true;
hasZAlgorithm = true;
CloseHandle(hFile);
return 0;
}
@ -279,20 +279,20 @@ int XAttrReaderPrivate::loadCompressionAlgorithm(void)
switch (ntfs_compress) {
case COMPRESSION_FORMAT_NONE:
// No compression
compressionAlgorithm = XAttrReader::ZAlgorithm::None;
hasCompressionAlgorithm = true;
zAlgorithm = XAttrReader::ZAlgorithm::None;
hasZAlgorithm = true;
break;
case COMPRESSION_FORMAT_LZNT1:
// LZNT1 compression
compressionAlgorithm = XAttrReader::ZAlgorithm::LZNT1;
hasCompressionAlgorithm = true;
zAlgorithm = XAttrReader::ZAlgorithm::LZNT1;
hasZAlgorithm = true;
break;
default:
// Unsupported?
compressionAlgorithm = XAttrReader::ZAlgorithm::None;
hasCompressionAlgorithm = false;
zAlgorithm = XAttrReader::ZAlgorithm::None;
hasZAlgorithm = false;
// TODO: Return an error code.
break;
}
@ -300,8 +300,8 @@ int XAttrReaderPrivate::loadCompressionAlgorithm(void)
}
// Not supported.
hasCompressionAlgorithm = false;
compressionAlgorithm = XAttrReader::ZAlgorithm::None;
hasZAlgorithm = false;
zAlgorithm = XAttrReader::ZAlgorithm::None;
return -ENOTSUP;
}

View File

@ -115,7 +115,7 @@ int RP_XAttrView_Private::loadCompressionAlgorithm(void)
{
HWND hCboZAlg = GetDlgItem(hDlgSheet, IDC_XATTRVIEW_NTFS_COMPRESSION_ALG);
if (!xattrReader->hasCompressionAlgorithm()) {
if (!xattrReader->hasZAlgorithm()) {
// No compression algorithm...
// NOTE: If FILE_ATTRIBUTE_COMPRESSED is set, assume LZNT1.
XAttrReader::ZAlgorithm zalg = XAttrReader::ZAlgorithm::None;
@ -131,7 +131,7 @@ int RP_XAttrView_Private::loadCompressionAlgorithm(void)
return -ENOENT;
}
ComboBox_SetCurSel(hCboZAlg, static_cast<int>(xattrReader->compressionAlgorithm()));
ComboBox_SetCurSel(hCboZAlg, static_cast<int>(xattrReader->zAlgorithm()));
return 0;
}