refactor
This commit is contained in:
@ -33,7 +33,11 @@ auto directory_iterator::fill_buffer(const remote::file_offset &offset,
|
|||||||
-> int {
|
-> int {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
if (offset < items_.size()) {
|
if (offset >= items_.size()) {
|
||||||
|
errno = 120;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::string item_name;
|
std::string item_name;
|
||||||
struct stat st{};
|
struct stat st{};
|
||||||
@ -58,11 +62,12 @@ auto directory_iterator::fill_buffer(const remote::file_offset &offset,
|
|||||||
#if FUSE_USE_VERSION >= 30
|
#if FUSE_USE_VERSION >= 30
|
||||||
if (filler_function(buffer, item_name.data(), pst,
|
if (filler_function(buffer, item_name.data(), pst,
|
||||||
static_cast<off_t>(offset + 1),
|
static_cast<off_t>(offset + 1),
|
||||||
FUSE_FILL_DIR_PLUS) != 0) {
|
FUSE_FILL_DIR_PLUS) != 0)
|
||||||
#else // FUSE_USE_VERSION < 30
|
#else // FUSE_USE_VERSION < 30
|
||||||
if (filler_function(buffer, item_name.data(), pst,
|
if (filler_function(buffer, item_name.data(), pst,
|
||||||
static_cast<off_t>(offset + 1)) != 0) {
|
static_cast<off_t>(offset + 1)) != 0)
|
||||||
#endif // FUSE_USE_VERSION >= 30
|
#endif // FUSE_USE_VERSION >= 30
|
||||||
|
{
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -73,10 +78,6 @@ auto directory_iterator::fill_buffer(const remote::file_offset &offset,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
errno = 120;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif // !defined(_WIN32)
|
#endif // !defined(_WIN32)
|
||||||
|
|
||||||
auto directory_iterator::get(std::size_t offset, std::string &item) -> int {
|
auto directory_iterator::get(std::size_t offset, std::string &item) -> int {
|
||||||
|
Reference in New Issue
Block a user