summaryrefslogtreecommitdiff
path: root/src/cache
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2026-08-26 15:08:16 -0400
committerAndrew Opalach <andrew@akon.city> 2026-08-26 15:08:16 -0400
commit6094c907b26e21f13373bae6bf3306dbae40af3c (patch)
tree981864ddb1ab9749d3e10a81edc782311826e101 /src/cache
parentda9bddc70ff8544f3294b880d719c4605e87ad97 (diff)
downloadcamu-6094c907b26e21f13373bae6bf3306dbae40af3c.tar.gz
camu-6094c907b26e21f13373bae6bf3306dbae40af3c.tar.bz2
camu-6094c907b26e21f13373bae6bf3306dbae40af3c.zip
Update deps, small changes and cleanup
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/cache')
-rw-r--r--src/cache/backings/memory.c6
-rw-r--r--src/cache/handlers/file.c8
-rw-r--r--src/cache/meson.build8
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