~aleteoryx/muditaos

236f7eac210f27e78534e3cb92e3f43fbf5177cd — Lucjan Bryndza 5 years ago d48d2d8
[EGD-4549] Mediaplayer read file timeout (#1098)

It is caused that fread() works really really slow after
changing ff_fread() items/num.
1 files changed, 12 insertions(+), 4 deletions(-)

M module-vfs/src/newlib/vfs_io_syscalls.cpp
M module-vfs/src/newlib/vfs_io_syscalls.cpp => module-vfs/src/newlib/vfs_io_syscalls.cpp +12 -4
@@ 128,7 128,7 @@ namespace vfsn::internal::syscalls
        }
        auto ret = ff_fwrite(buf, cnt, 1, fil);
        _errno_  = stdioGET_ERRNO();
        return ret * cnt;
        return ret > 0 ? (ret * cnt) : ret;
    }

    long read(int &_errno_, int fd, void *buf, size_t cnt)


@@ 143,9 143,17 @@ namespace vfsn::internal::syscalls
            _errno_ = EBADF;
            return -1;
        }
        auto ret = ff_fread(buf, 1, cnt, fil);
        _errno_  = stdioGET_ERRNO();
        return ret * cnt;
        const auto remain_bytes = fil->ulFileSize - fil->ulFilePointer;
        if (remain_bytes > 0) {
            cnt            = std::min<size_t>(cnt, remain_bytes);
            const auto ret = ff_fread(buf, cnt, 1, fil);
            _errno_        = stdioGET_ERRNO();
            return ret > 0 ? ret * cnt : ret;
        }
        else {
            _errno_ = 0;
            return 0;
        }
    }

    off_t lseek(int &_errno_, int fd, off_t pos, int dir)