SHA256
1
0
forked from pool/doxygen
Petr Gajdos 2022-07-25 08:19:31 +00:00 committed by Git OBS Bridge
parent 3bebd679a5
commit 0be7ade6c2
2 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,70 @@
Index: doxygen-1.9.4/filesystem/filesystem.hpp
===================================================================
--- doxygen-1.9.4.orig/filesystem/filesystem.hpp
+++ doxygen-1.9.4/filesystem/filesystem.hpp
@@ -5548,12 +5548,13 @@ public:
impl(const path& path, directory_options options)
: _base(path)
, _options(options)
- , _dir(nullptr)
+ , _n(-1)
+ , _name_list(nullptr)
, _entry(nullptr)
{
if (!path.empty()) {
- _dir = ::opendir(path.native().c_str());
- if (!_dir) {
+ _n = ::scandir(path.native().c_str(), &_name_list, NULL, alphasort);
+ if (_n == -1) {
auto error = errno;
_base = filesystem::path();
if ((error != EACCES && error != EPERM) || (options & directory_options::skip_permission_denied) == directory_options::none) {
@@ -5568,30 +5569,31 @@ public:
impl(const impl& other) = delete;
~impl()
{
- if (_dir) {
- ::closedir(_dir);
+ if (_name_list) {
+ ::free(_name_list);
}
}
void increment(std::error_code& ec)
{
- if (_dir) {
+ if (_name_list) {
bool skip;
do {
skip = false;
errno = 0;
- _entry = ::readdir(_dir);
- if (_entry) {
+ if (_n >= 0) {
+ _entry = _name_list[_n--];
_dir_entry._path = _base;
_dir_entry._path.append_name(_entry->d_name);
copyToDirEntry();
+ ::free(_entry);
if (ec && (ec.value() == EACCES || ec.value() == EPERM) && (_options & directory_options::skip_permission_denied) == directory_options::skip_permission_denied) {
ec.clear();
skip = true;
}
}
else {
- ::closedir(_dir);
- _dir = nullptr;
+ ::free(_name_list);
+ _name_list = nullptr;
_dir_entry._path.clear();
if (errno) {
ec = detail::make_system_error();
@@ -5634,7 +5636,8 @@ public:
}
path _base;
directory_options _options;
- DIR* _dir;
+ int _n;
+ struct ::dirent** _name_list;
struct ::dirent* _entry;
directory_entry _dir_entry;
std::error_code _ec;

View File

@ -36,6 +36,8 @@ Patch0: %{name}-modify_footer.patch
Patch1: %{name}-no-lowercase-man-names.patch
# PATCH-FIX-UPSTREAM
Patch2: doxygen-gcc12.patch
# reproducible
Patch3: doxygen-reproducible.patch
# The unified libclang-cpp library doesn't exist on older Leap / SLE
Patch10: doxygen-no-libclang-cpp.patch
BuildRequires: bison
@ -69,6 +71,7 @@ as well.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%if %{with libclang}
%if 0%{?sle_version} == 150100 || (0%{?sle_version} == 150200 && !0%{?is_opensuse})
%patch10 -p1