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
0ccaf4a1
Commit
0ccaf4a1
authored
8 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage/FileInfo: add initializing constructor
parent
5cdbad79
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
24 deletions
+16
-24
CompositeStorage.cxx
src/storage/CompositeStorage.cxx
+3
-14
FileInfo.hxx
src/storage/FileInfo.hxx
+8
-0
CurlStorage.cxx
src/storage/plugins/CurlStorage.cxx
+5
-10
No files found.
src/storage/CompositeStorage.cxx
View file @
0ccaf4a1
...
...
@@ -86,12 +86,7 @@ CompositeDirectoryReader::GetInfo(bool follow)
assert
(
current
!=
names
.
end
());
StorageFileInfo
info
;
info
.
type
=
StorageFileInfo
::
Type
::
DIRECTORY
;
info
.
mtime
=
0
;
info
.
device
=
0
;
info
.
inode
=
0
;
return
info
;
return
StorageFileInfo
(
StorageFileInfo
::
Type
::
DIRECTORY
);
}
static
std
::
string
...
...
@@ -280,14 +275,8 @@ CompositeStorage::GetInfo(const char *uri, bool follow)
}
const
Directory
*
directory
=
f
.
directory
->
Find
(
f
.
uri
);
if
(
directory
!=
nullptr
)
{
StorageFileInfo
info
;
info
.
type
=
StorageFileInfo
::
Type
::
DIRECTORY
;
info
.
mtime
=
0
;
info
.
device
=
0
;
info
.
inode
=
0
;
return
info
;
}
if
(
directory
!=
nullptr
)
return
StorageFileInfo
(
StorageFileInfo
::
Type
::
DIRECTORY
);
if
(
error
)
std
::
rethrow_exception
(
error
);
...
...
This diff is collapsed.
Click to expand it.
src/storage/FileInfo.hxx
View file @
0ccaf4a1
...
...
@@ -50,6 +50,14 @@ struct StorageFileInfo {
*/
unsigned
device
,
inode
;
StorageFileInfo
()
=
default
;
explicit
constexpr
StorageFileInfo
(
Type
_type
)
:
type
(
_type
),
size
(
0
),
mtime
(
0
),
device
(
0
),
inode
(
0
)
{}
constexpr
bool
IsRegular
()
const
{
return
type
==
Type
::
REGULAR
;
}
...
...
This diff is collapsed.
Click to expand it.
src/storage/plugins/CurlStorage.cxx
View file @
0ccaf4a1
...
...
@@ -399,11 +399,8 @@ class HttpGetInfoOperation final : public PropfindOperation {
public
:
HttpGetInfoOperation
(
CurlGlobal
&
curl
,
const
char
*
uri
)
:
PropfindOperation
(
curl
,
uri
,
0
)
{
info
.
type
=
StorageFileInfo
::
Type
::
OTHER
;
info
.
size
=
0
;
info
.
mtime
=
0
;
info
.
device
=
info
.
inode
=
0
;
:
PropfindOperation
(
curl
,
uri
,
0
),
info
(
StorageFileInfo
::
Type
::
OTHER
)
{
}
const
StorageFileInfo
&
Perform
()
{
...
...
@@ -424,7 +421,6 @@ protected:
info
.
mtime
=
!
IsNegative
(
r
.
mtime
)
?
std
::
chrono
::
system_clock
::
to_time_t
(
r
.
mtime
)
:
0
;
info
.
device
=
info
.
inode
=
0
;
}
};
...
...
@@ -514,14 +510,13 @@ protected:
entries
.
emplace_front
(
std
::
string
(
name
.
data
,
name
.
size
));
auto
&
info
=
entries
.
front
().
info
;
info
.
type
=
r
.
collection
?
StorageFileInfo
::
Type
::
DIRECTORY
:
StorageFileInfo
::
Type
::
REGULAR
;
info
=
StorageFileInfo
(
r
.
collection
?
StorageFileInfo
::
Type
::
DIRECTORY
:
StorageFileInfo
::
Type
::
REGULAR
)
;
info
.
size
=
r
.
length
;
info
.
mtime
=
!
IsNegative
(
r
.
mtime
)
?
std
::
chrono
::
system_clock
::
to_time_t
(
r
.
mtime
)
:
0
;
info
.
device
=
info
.
inode
=
0
;
}
};
...
...
This diff is collapsed.
Click to expand it.
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