Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
de61c3b9
Commit
de61c3b9
authored
Mar 07, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
archive/iso9660: use a single path buffer for Visit()
Avoid wasting 4 kB stack per directory level.
parent
c46fc453
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
Iso9660ArchivePlugin.cxx
src/archive/plugins/Iso9660ArchivePlugin.cxx
+13
-11
No files found.
src/archive/plugins/Iso9660ArchivePlugin.cxx
View file @
de61c3b9
...
...
@@ -66,7 +66,8 @@ public:
return
iso9660_iso_seek_read
(
iso
,
ptr
,
start
,
i_size
);
}
void
Visit
(
const
char
*
path
,
ArchiveVisitor
&
visitor
);
void
Visit
(
char
*
path
,
size_t
length
,
ArchiveVisitor
&
visitor
);
virtual
void
Close
()
override
{
Unref
();
...
...
@@ -84,11 +85,10 @@ static constexpr Domain iso9660_domain("iso9660");
/* archive open && listing routine */
inline
void
Iso9660ArchiveFile
::
Visit
(
const
char
*
psz_path
,
ArchiveVisitor
&
visitor
)
Iso9660ArchiveFile
::
Visit
(
char
*
path
,
size_t
length
,
ArchiveVisitor
&
visitor
)
{
char
pathname
[
4096
];
auto
*
entlist
=
iso9660_ifs_readdir
(
iso
,
psz_path
);
auto
*
entlist
=
iso9660_ifs_readdir
(
iso
,
path
);
if
(
!
entlist
)
{
return
;
}
...
...
@@ -101,15 +101,16 @@ Iso9660ArchiveFile::Visit(const char *psz_path, ArchiveVisitor &visitor)
if
(
strcmp
(
filename
,
"."
)
==
0
||
strcmp
(
filename
,
".."
)
==
0
)
continue
;
strcpy
(
pathname
,
psz_path
);
strcat
(
pathname
,
filename
);
size_t
filename_length
=
strlen
(
filename
);
memcpy
(
path
+
length
,
filename
,
filename_length
+
1
);
size_t
new_length
=
length
+
filename_length
;
if
(
iso9660_stat_s
::
_STAT_DIR
==
statbuf
->
type
)
{
strcat
(
pathname
,
"/"
);
Visit
(
path
name
,
visitor
);
memcpy
(
path
+
new_length
,
"/"
,
2
);
Visit
(
path
,
new_length
+
1
,
visitor
);
}
else
{
//remove leading /
visitor
.
VisitArchiveEntry
(
path
name
+
1
);
visitor
.
VisitArchiveEntry
(
path
+
1
);
}
}
_cdio_list_free
(
entlist
,
true
);
...
...
@@ -133,7 +134,8 @@ iso9660_archive_open(Path pathname, Error &error)
void
Iso9660ArchiveFile
::
Visit
(
ArchiveVisitor
&
visitor
)
{
Visit
(
"/"
,
visitor
);
char
path
[
4096
]
=
"/"
;
Visit
(
path
,
1
,
visitor
);
}
/* single archive handling */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment