AP_Filesystem: avoid decompressing in directory listing

this makes ROMFS much more efficient
This commit is contained in:
Andrew Tridgell 2024-03-19 06:09:41 +11:00 committed by Peter Barker
parent aa7ae2327d
commit 8763084a9e
1 changed files with 1 additions and 3 deletions

View File

@ -119,12 +119,10 @@ int32_t AP_Filesystem_ROMFS::lseek(int fd, int32_t offset, int seek_from)
int AP_Filesystem_ROMFS::stat(const char *name, struct stat *stbuf)
{
uint32_t size;
const uint8_t *data = AP_ROMFS::find_decompress(name, size);
if (data == nullptr) {
if (!AP_ROMFS::find_size(name, size)) {
errno = ENOENT;
return -1;
}
AP_ROMFS::free(data);
memset(stbuf, 0, sizeof(*stbuf));
stbuf->st_size = size;
return 0;