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
fcf64159
Commit
fcf64159
authored
Jun 15, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
archive/Lookup: pass class Path
parent
be79b44d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
12 deletions
+10
-12
ArchiveLookup.cxx
src/archive/ArchiveLookup.cxx
+2
-4
ArchiveLookup.hxx
src/archive/ArchiveLookup.hxx
+1
-1
ArchiveInputPlugin.cxx
src/input/plugins/ArchiveInputPlugin.cxx
+1
-1
test_archive.cxx
test/test_archive.cxx
+6
-6
No files found.
src/archive/ArchiveLookup.cxx
View file @
fcf64159
...
...
@@ -21,8 +21,6 @@
#include "fs/FileInfo.hxx"
#include "system/Error.hxx"
#include <string.h>
gcc_pure
static
PathTraitsFS
::
pointer_type
FindSlash
(
PathTraitsFS
::
pointer_type
p
,
size_t
i
)
noexcept
...
...
@@ -35,9 +33,9 @@ FindSlash(PathTraitsFS::pointer_type p, size_t i) noexcept
}
ArchiveLookupResult
archive_lookup
(
Path
TraitsFS
::
const_pointer_type
pathname
)
archive_lookup
(
Path
pathname
)
{
PathTraitsFS
::
string
buffer
(
pathname
);
PathTraitsFS
::
string
buffer
(
pathname
.
c_str
()
);
size_t
idx
=
buffer
.
size
();
PathTraitsFS
::
pointer_type
slash
=
nullptr
;
...
...
src/archive/ArchiveLookup.hxx
View file @
fcf64159
...
...
@@ -50,7 +50,7 @@ struct ArchiveLookupResult {
* Throws on error.
*/
ArchiveLookupResult
archive_lookup
(
Path
TraitsFS
::
const_pointer_type
pathname
);
archive_lookup
(
Path
pathname
);
#endif
src/input/plugins/ArchiveInputPlugin.cxx
View file @
fcf64159
...
...
@@ -34,7 +34,7 @@ OpenArchiveInputStream(Path path, Mutex &mutex)
// archive_lookup will modify pname when true is returned
ArchiveLookupResult
l
;
try
{
l
=
archive_lookup
(
path
.
c_str
()
);
l
=
archive_lookup
(
path
);
if
(
l
.
archive
.
IsNull
())
{
return
nullptr
;
}
...
...
test/test_archive.cxx
View file @
fcf64159
...
...
@@ -8,22 +8,22 @@
TEST
(
ArchiveTest
,
Lookup
)
{
EXPECT_THROW
(
archive_lookup
(
""
),
std
::
system_error
);
EXPECT_THROW
(
archive_lookup
(
Path
::
FromFS
(
""
)
),
std
::
system_error
);
EXPECT_FALSE
(
archive_lookup
(
"."
));
EXPECT_FALSE
(
archive_lookup
(
Path
::
FromFS
(
"."
)
));
EXPECT_FALSE
(
archive_lookup
(
"config.h"
));
EXPECT_FALSE
(
archive_lookup
(
Path
::
FromFS
(
"config.h"
)
));
EXPECT_THROW
(
archive_lookup
(
"src/foo/bar"
),
std
::
system_error
);
EXPECT_THROW
(
archive_lookup
(
Path
::
FromFS
(
"src/foo/bar"
)
),
std
::
system_error
);
fclose
(
fopen
(
"dummy"
,
"w"
));
auto
result
=
archive_lookup
(
"dummy/foo/bar"
);
auto
result
=
archive_lookup
(
Path
::
FromFS
(
"dummy/foo/bar"
)
);
EXPECT_TRUE
(
result
);
EXPECT_STREQ
(
result
.
archive
.
c_str
(),
"dummy"
);
EXPECT_STREQ
(
result
.
inside
.
c_str
(),
"foo/bar"
);
result
=
archive_lookup
(
"config.h/foo/bar"
);
result
=
archive_lookup
(
Path
::
FromFS
(
"config.h/foo/bar"
)
);
EXPECT_TRUE
(
result
);
EXPECT_STREQ
(
result
.
archive
.
c_str
(),
"config.h"
);
EXPECT_STREQ
(
result
.
inside
.
c_str
(),
"foo/bar"
);
...
...
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