Don't throw on invalid whence (return fs::error::einval)

This commit is contained in:
Nekotekina 2020-03-07 11:52:54 +03:00
parent 8461a5cbe2
commit a166d3680e
4 changed files with 5 additions and 10 deletions

View File

@ -1313,8 +1313,7 @@ fs::file::file(const void* ptr, std::size_t size)
const s64 new_pos =
whence == fs::seek_set ? offset :
whence == fs::seek_cur ? offset + m_pos :
whence == fs::seek_end ? offset + size() :
(fmt::raw_error("fs::file::memory_stream::seek(): invalid whence"), 0);
whence == fs::seek_end ? offset + size() : -1;
if (new_pos < 0)
{
@ -1765,8 +1764,7 @@ fs::file fs::make_gather(std::vector<fs::file> files)
const s64 new_pos =
whence == fs::seek_set ? offset :
whence == fs::seek_cur ? offset + pos :
whence == fs::seek_end ? offset + end :
(fmt::raw_error("fs::gather_stream::seek(): invalid whence"), 0);
whence == fs::seek_end ? offset + end : -1;
if (new_pos < 0)
{

View File

@ -598,8 +598,7 @@ namespace fs
const s64 new_pos =
whence == fs::seek_set ? offset :
whence == fs::seek_cur ? offset + pos :
whence == fs::seek_end ? offset + size() :
(fmt::raw_error("fs::container_stream<>::seek(): invalid whence"), 0);
whence == fs::seek_end ? offset + size() : -1;
if (new_pos < 0)
{

View File

@ -112,8 +112,7 @@ public:
const s64 new_pos =
whence == fs::seek_set ? offset :
whence == fs::seek_cur ? offset + pos :
whence == fs::seek_end ? offset + size() :
(fmt::raw_error("EDATADecrypter::seek(): invalid whence"), 0);
whence == fs::seek_end ? offset + size() : -1;
if (new_pos < 0)
{

View File

@ -181,8 +181,7 @@ struct lv2_file::file_view : fs::file_base
const s64 new_pos =
whence == fs::seek_set ? offset :
whence == fs::seek_cur ? offset + m_pos :
whence == fs::seek_end ? offset + size() :
(fmt::raw_error("lv2_file::file_view::seek(): invalid whence"), 0);
whence == fs::seek_end ? offset + size() : -1;
if (new_pos < 0)
{