From 839151eaaad24771892afaae6bac690e31e58384 Mon Sep 17 00:00:00 2001 From: Igor Pavlov <87184205+ip7z@users.noreply.github.com> Date: Thu, 12 Feb 2026 00:00:00 +0000 Subject: 26.00 --- CPP/Windows/Control/ComboBox.cpp | 9 +++++++++ CPP/Windows/Control/ComboBox.h | 2 ++ CPP/Windows/FileFind.cpp | 13 +++++++++++-- CPP/Windows/FileFind.h | 6 +++--- CPP/Windows/SecurityUtils.h | 4 ++++ CPP/Windows/System.cpp | 10 ++++++---- CPP/Windows/System.h | 23 +++++++++++++++++++++-- CPP/Windows/SystemInfo.cpp | 4 ++-- CPP/Windows/TimeUtils.h | 8 ++++++++ 9 files changed, 66 insertions(+), 13 deletions(-) (limited to 'CPP/Windows') diff --git a/CPP/Windows/Control/ComboBox.cpp b/CPP/Windows/Control/ComboBox.cpp index 8da487d..2e9c8cb 100644 --- a/CPP/Windows/Control/ComboBox.cpp +++ b/CPP/Windows/Control/ComboBox.cpp @@ -63,4 +63,13 @@ LRESULT CComboBox::GetLBText(int index, UString &s) } #endif +LRESULT CComboBox::AddString_SetItemData(LPCWSTR s, LPARAM lParam) +{ + const LRESULT index = AddString(s); + // NOTE: SetItemData((int)-1, lParam) works as unexpected. + if (index >= 0) // optional check, because (index < 0) is not expected for normal inputs + SetItemData((int)index, lParam); + return index; +} + }} diff --git a/CPP/Windows/Control/ComboBox.h b/CPP/Windows/Control/ComboBox.h index 2a60b8a..224efca 100644 --- a/CPP/Windows/Control/ComboBox.h +++ b/CPP/Windows/Control/ComboBox.h @@ -21,6 +21,8 @@ public: LRESULT AddString(LPCWSTR s); #endif + LRESULT AddString_SetItemData(LPCWSTR s, LPARAM lParam); + /* If this parameter is -1, any current selection in the list is removed and the edit control is cleared.*/ LRESULT SetCurSel(int index) { return SendMsg(CB_SETCURSEL, MY_int_TO_WPARAM(index), 0); } LRESULT SetCurSel(unsigned index) { return SendMsg(CB_SETCURSEL, index, 0); } diff --git a/CPP/Windows/FileFind.cpp b/CPP/Windows/FileFind.cpp index 64075ab..669541e 100644 --- a/CPP/Windows/FileFind.cpp +++ b/CPP/Windows/FileFind.cpp @@ -1162,6 +1162,15 @@ void CFileInfoBase::SetFrom_stat(const struct stat &st) MTime = st.st_mtimespec; ATime = st.st_atimespec; + #elif defined(__QNXNTO__) && defined(__ARM__) && !defined(__aarch64__) + + // CTime = ST_CTIME(st); + // MTime = ST_MTIME(st); + // ATime = ST_ATIME(st); + CTime.tv_sec = st.st_ctime; CTime.tv_nsec = 0; + MTime.tv_sec = st.st_mtime; MTime.tv_nsec = 0; + ATime.tv_sec = st.st_atime; ATime.tv_nsec = 0; + #else // timespec_To_FILETIME(st.st_ctim, CTime, &CTime_ns100); // timespec_To_FILETIME(st.st_mtim, MTime, &MTime_ns100); @@ -1312,7 +1321,7 @@ bool CDirEntry::IsDots() const throw() /* some systems (like CentOS 7.x on XFS) have (Type == DT_UNKNOWN) we can call fstatat() for that case, but we use only (Name) check here */ -#if !defined(_AIX) && !defined(__sun) +#if !defined(_AIX) && !defined(__sun) && !defined(__QNXNTO__) if (Type != DT_DIR && Type != DT_UNKNOWN) return false; #endif @@ -1352,7 +1361,7 @@ bool CEnumerator::NextAny(CDirEntry &fi, bool &found) fi.iNode = de->d_ino; -#if !defined(_AIX) && !defined(__sun) +#if !defined(_AIX) && !defined(__sun) && !defined(__QNXNTO__) fi.Type = de->d_type; /* some systems (like CentOS 7.x on XFS) have (Type == DT_UNKNOWN) we can set (Type) from fstatat() in that case. diff --git a/CPP/Windows/FileFind.h b/CPP/Windows/FileFind.h index f68673a..944bca2 100644 --- a/CPP/Windows/FileFind.h +++ b/CPP/Windows/FileFind.h @@ -277,13 +277,13 @@ typedef CFileInfo CDirEntry; struct CDirEntry { ino_t iNode; -#if !defined(_AIX) && !defined(__sun) +#if !defined(_AIX) && !defined(__sun) && !defined(__QNXNTO__) Byte Type; #endif FString Name; /* -#if !defined(_AIX) && !defined(__sun) +#if !defined(_AIX) && !defined(__sun) && !defined(__QNXNTO__) bool IsDir() const { // (Type == DT_UNKNOWN) on some systems @@ -310,7 +310,7 @@ public: bool Fill_FileInfo(const CDirEntry &de, CFileInfo &fileInfo, bool followLink) const; bool DirEntry_IsDir(const CDirEntry &de, bool followLink) const { -#if !defined(_AIX) && !defined(__sun) +#if !defined(_AIX) && !defined(__sun) && !defined(__QNXNTO__) if (de.Type == DT_DIR) return true; if (de.Type != DT_UNKNOWN) diff --git a/CPP/Windows/SecurityUtils.h b/CPP/Windows/SecurityUtils.h index 7219f06..022a8f3 100644 --- a/CPP/Windows/SecurityUtils.h +++ b/CPP/Windows/SecurityUtils.h @@ -3,7 +3,11 @@ #ifndef ZIP7_INC_WINDOWS_SECURITY_UTILS_H #define ZIP7_INC_WINDOWS_SECURITY_UTILS_H +#if defined(__MINGW32__) || defined(__MINGW64__) +#include +#else #include +#endif #include "Defs.h" diff --git a/CPP/Windows/System.cpp b/CPP/Windows/System.cpp index 4745785..6999ef9 100644 --- a/CPP/Windows/System.cpp +++ b/CPP/Windows/System.cpp @@ -5,8 +5,9 @@ #ifndef _WIN32 #include #include -#if defined(__APPLE__) || defined(__DragonFly__) || \ - defined(BSD) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__APPLE__) || defined(__DragonFly__) \ + || defined(BSD) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \ + || defined(__QNXNTO__) #include #else #include @@ -299,8 +300,9 @@ bool GetRamSize(size_t &size) size = (size_t)sizeof(size_t) << 29; size64 = size; -#if defined(__APPLE__) || defined(__DragonFly__) || \ - defined(BSD) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__APPLE__) || defined(__DragonFly__) \ + || defined(BSD) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \ + || defined(__QNXNTO__) uint64_t val = 0; int mib[2]; diff --git a/CPP/Windows/System.h b/CPP/Windows/System.h index 0c80373..041a44d 100644 --- a/CPP/Windows/System.h +++ b/CPP/Windows/System.h @@ -15,6 +15,8 @@ namespace NWindows { namespace NSystem { +UInt32 GetNumberOfProcessors(); + #ifdef _WIN32 struct CCpuGroups @@ -103,6 +105,25 @@ struct CProcessAffinity return CountAffinity(systemAffinityMask); } + // it returns normilized number of threads + void Get_and_return_NumProcessThreads_and_SysThreads(UInt32 &numProcessThreads, UInt32 &numSysThreads) + { + UInt32 num1 = 0, num2 = 0; + if (Get()) + { + num1 = GetNumProcessThreads(); + num2 = GetNumSystemThreads(); + } + if (num1 == 0) + num1 = NSystem::GetNumberOfProcessors(); + if (num1 == 0) + num1 = 1; + if (num2 < num1) + num2 = num1; + numProcessThreads = num1; + numSysThreads = num2; + } + BOOL Get(); BOOL SetProcAffinity() const @@ -177,8 +198,6 @@ struct CProcessAffinity #endif // _WIN32 -UInt32 GetNumberOfProcessors(); - bool GetRamSize(size_t &size); // returns false, if unknown ram size unsigned long Get_File_OPEN_MAX(); diff --git a/CPP/Windows/SystemInfo.cpp b/CPP/Windows/SystemInfo.cpp index 35846e0..2eced2a 100644 --- a/CPP/Windows/SystemInfo.cpp +++ b/CPP/Windows/SystemInfo.cpp @@ -22,7 +22,7 @@ #if defined(__GLIBC__) && (__GLIBC__ * 100 + __GLIBC_MINOR__ >= 216) #define Z7_GETAUXV_AVAILABLE -#else +#elif !defined(__QNXNTO__) // #pragma message("=== is not NEW GLIBC === ") #if defined __has_include #if __has_include () @@ -58,7 +58,7 @@ #ifdef USE_HWCAP -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__OpenBSD__) // #if (__FreeBSD__ >= 13) // (FreeBSD 12.01 is required for elf_aux_info() ???) static unsigned long MY_getauxval(int aux) diff --git a/CPP/Windows/TimeUtils.h b/CPP/Windows/TimeUtils.h index 4a9d0f2..8e1e478 100644 --- a/CPP/Windows/TimeUtils.h +++ b/CPP/Windows/TimeUtils.h @@ -65,6 +65,14 @@ inline bool FILETIME_IsZero(const FILETIME &ft) #define ST_MTIME(st) st.st_mtimespec #define ST_ATIME(st) st.st_atimespec #define ST_CTIME(st) st.st_ctimespec + #elif defined(__QNXNTO__) && defined(__ARM__) && !defined(__aarch64__) + // QNX armv7le (32-bit) for "struct stat" timestamps uses time_t instead of timespec + inline CFiTime ST_MTIME(const struct stat &st) + { timespec ts; ts.tv_sec = st.st_mtime; ts.tv_nsec = 0; return ts; } + inline CFiTime ST_ATIME(const struct stat &st) + { timespec ts; ts.tv_sec = st.st_atime; ts.tv_nsec = 0; return ts; } + inline CFiTime ST_CTIME(const struct stat &st) + { timespec ts; ts.tv_sec = st.st_ctime; ts.tv_nsec = 0; return ts; } #else #define ST_MTIME(st) st.st_mtim #define ST_ATIME(st) st.st_atim -- cgit v1.2.3-55-g6feb