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
17f207ff
Commit
17f207ff
authored
Jun 15, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
archive/Lookup: return AllocatedPath
parent
476647bf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
7 deletions
+5
-7
ArchiveLookup.cxx
src/archive/ArchiveLookup.cxx
+1
-1
ArchiveLookup.hxx
src/archive/ArchiveLookup.hxx
+4
-4
test_archive.cxx
test/test_archive.cxx
+0
-2
No files found.
src/archive/ArchiveLookup.cxx
View file @
17f207ff
...
@@ -53,7 +53,7 @@ archive_lookup(PathTraitsFS::pointer_type pathname)
...
@@ -53,7 +53,7 @@ archive_lookup(PathTraitsFS::pointer_type pathname)
//its a file ?
//its a file ?
if
(
file_info
.
IsRegular
())
{
if
(
file_info
.
IsRegular
())
{
//so the upper should be file
//so the upper should be file
return
{
Path
::
FromFS
(
pathname
),
Path
::
FromFS
(
slash
+
1
)};
return
{
AllocatedPath
::
FromFS
(
pathname
),
Allocated
Path
::
FromFS
(
slash
+
1
)};
}
else
{
}
else
{
return
{};
return
{};
}
}
...
...
src/archive/ArchiveLookup.hxx
View file @
17f207ff
...
@@ -20,13 +20,13 @@
...
@@ -20,13 +20,13 @@
#ifndef MPD_ARCHIVE_LOOKUP_HXX
#ifndef MPD_ARCHIVE_LOOKUP_HXX
#define MPD_ARCHIVE_LOOKUP_HXX
#define MPD_ARCHIVE_LOOKUP_HXX
#include "fs/Path.hxx"
#include "fs/
Allocated
Path.hxx"
struct
ArchiveLookupResult
{
struct
ArchiveLookupResult
{
Path
archive
=
nullptr
;
Allocated
Path
archive
=
nullptr
;
Path
inside
=
nullptr
;
Allocated
Path
inside
=
nullptr
;
constexpr
operator
bool
()
const
noexcept
{
operator
bool
()
const
noexcept
{
return
!
archive
.
IsNull
();
return
!
archive
.
IsNull
();
}
}
};
};
...
...
test/test_archive.cxx
View file @
17f207ff
...
@@ -29,7 +29,6 @@ TEST(ArchiveTest, Lookup)
...
@@ -29,7 +29,6 @@ TEST(ArchiveTest, Lookup)
path
=
strdup
(
"dummy/foo/bar"
);
path
=
strdup
(
"dummy/foo/bar"
);
auto
result
=
archive_lookup
(
path
);
auto
result
=
archive_lookup
(
path
);
EXPECT_TRUE
(
result
);
EXPECT_TRUE
(
result
);
EXPECT_EQ
((
const
char
*
)
path
,
result
.
archive
.
c_str
());
EXPECT_STREQ
(
result
.
archive
.
c_str
(),
"dummy"
);
EXPECT_STREQ
(
result
.
archive
.
c_str
(),
"dummy"
);
EXPECT_STREQ
(
result
.
inside
.
c_str
(),
"foo/bar"
);
EXPECT_STREQ
(
result
.
inside
.
c_str
(),
"foo/bar"
);
free
(
path
);
free
(
path
);
...
@@ -37,7 +36,6 @@ TEST(ArchiveTest, Lookup)
...
@@ -37,7 +36,6 @@ TEST(ArchiveTest, Lookup)
path
=
strdup
(
"config.h/foo/bar"
);
path
=
strdup
(
"config.h/foo/bar"
);
result
=
archive_lookup
(
path
);
result
=
archive_lookup
(
path
);
EXPECT_TRUE
(
result
);
EXPECT_TRUE
(
result
);
EXPECT_EQ
((
const
char
*
)
path
,
result
.
archive
.
c_str
());
EXPECT_STREQ
(
result
.
archive
.
c_str
(),
"config.h"
);
EXPECT_STREQ
(
result
.
archive
.
c_str
(),
"config.h"
);
EXPECT_STREQ
(
result
.
inside
.
c_str
(),
"foo/bar"
);
EXPECT_STREQ
(
result
.
inside
.
c_str
(),
"foo/bar"
);
free
(
path
);
free
(
path
);
...
...
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