diff options
Diffstat (limited to 'src/cache')
| -rw-r--r-- | src/cache/backings/memory.c | 6 | ||||
| -rw-r--r-- | src/cache/handlers/file.c | 8 | ||||
| -rw-r--r-- | src/cache/meson.build | 8 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/cache/backings/memory.c b/src/cache/backings/memory.c index 063c1c5..ba0bb54 100644 --- a/src/cache/backings/memory.c +++ b/src/cache/backings/memory.c @@ -6,7 +6,11 @@ static void ensure_allocated(struct cch_backing_memory *mem, off_t amount) { if (amount > mem->expanse) mem->expanse = amount; if (amount > mem->alloc) { - mem->alloc = al_next_power_of_two(amount); + if (amount < MB(8)) { + mem->alloc = al_next_power_of_two(amount); + } else { + mem->alloc = amount; + } mem->data = (u8 *)al_realloc(mem->data, mem->alloc); } } diff --git a/src/cache/handlers/file.c b/src/cache/handlers/file.c index 1a70350..4ca8f47 100644 --- a/src/cache/handlers/file.c +++ b/src/cache/handlers/file.c @@ -30,11 +30,11 @@ static s32 handler_file_guess_format(struct cch_handler *handler) struct cch_backing_file *backing = (struct cch_backing_file *)file->backing; str *path = &backing->file.path; u32 dot = al_str_rfind(path, '.'); - if (dot != AL_STR_NO_POS) { - str ext = al_str_substr(path, dot, path->length); - return camu_guess_format(NULL, &ext, NULL); + if (dot == AL_STR_NO_POS) { + return CAMU_CODEC_FALLBACK; } - return -1; + str ext = al_str_substr(path, dot, path->length); + return camu_guess_format(NULL, &ext, NULL); } static void handler_file_free(struct cch_handler **handler) diff --git a/src/cache/meson.build b/src/cache/meson.build index 816b101..8243893 100644 --- a/src/cache/meson.build +++ b/src/cache/meson.build @@ -8,7 +8,8 @@ cache_deps = [] cache_args = [] if 'file' in get_option('sources') - if naunet_has_mmap + # @TODO: file mapped vs non-mapped should be selectable at runtime. + if naunet_has_mmap and not is_android cache_src += ['backings/file_mapped.c'] else cache_src += ['backings/file.c'] @@ -22,11 +23,12 @@ if 'http' in get_option('sources') and naunet_has_curl endif if 'cdio' in get_option('sources') + libcdio = dependency('libcdio', allow_fallback: true) libcdio_paranoia = dependency('libcdio_paranoia', allow_fallback: true) libcdio_cdda = dependency('libcdio_cdda', allow_fallback: true) - if libcdio_paranoia.found() and libcdio_cdda.found() + if libcdio.found() and libcdio_paranoia.found() and libcdio_cdda.found() cache_src += ['handlers/cdio.c'] - cache_deps += [libcdio_paranoia, libcdio_cdda] + cache_deps += [libcdio, libcdio_paranoia, libcdio_cdda] cache_args += ['-DCACHE_HAVE_CDIO'] endif endif |