summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/playlist.c4
-rw-r--r--apps/tagcache.c4
-rw-r--r--firmware/common/dircache.c9
-rw-r--r--firmware/include/dircache.h2
4 files changed, 11 insertions, 8 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 62f85eab40..dcf2fe1118 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1353,8 +1353,8 @@ static int get_filename(struct playlist_info* playlist, int index, int seek,
1353 { 1353 {
1354 if (playlist->filenames[index] != NULL) 1354 if (playlist->filenames[index] != NULL)
1355 { 1355 {
1356 dircache_copy_path(playlist->filenames[index], tmp_buf, sizeof(tmp_buf)-1); 1356 max = dircache_copy_path(playlist->filenames[index],
1357 max = strlen(tmp_buf); 1357 tmp_buf, sizeof(tmp_buf)-1);
1358 } 1358 }
1359 } 1359 }
1360#else 1360#else
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 0c85fc5957..080f4198c3 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -1481,10 +1481,10 @@ static bool get_next(struct tagcache_search *tcs)
1481 if (tcs->type == tag_filename && (flag & FLAG_DIRCACHE) 1481 if (tcs->type == tag_filename && (flag & FLAG_DIRCACHE)
1482 && is_dircache_intact()) 1482 && is_dircache_intact())
1483 { 1483 {
1484 dircache_copy_path((struct dircache_entry *)tcs->position, 1484 size_t len = dircache_copy_path((struct dircache_entry *)tcs->position,
1485 buf, sizeof buf); 1485 buf, sizeof buf);
1486 tcs->result_len = len + 1;
1486 tcs->result = buf; 1487 tcs->result = buf;
1487 tcs->result_len = strlen(buf) + 1;
1488 tcs->ramresult = false; 1488 tcs->ramresult = false;
1489 1489
1490 return true; 1490 return true;
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index dc662bb9cd..3eae85ee3b 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -932,16 +932,19 @@ static size_t copy_path_helper(const struct dircache_entry *entry, char *buf, si
932/** 932/**
933 * Function to copy the full absolute path from dircache to the given buffer 933 * Function to copy the full absolute path from dircache to the given buffer
934 * using the given dircache_entry pointer. 934 * using the given dircache_entry pointer.
935 *
936 * Returns the size of the resulting string, or 0 if an error occured
935 */ 937 */
936void dircache_copy_path(const struct dircache_entry *entry, char *buf, int size) 938size_t dircache_copy_path(const struct dircache_entry *entry, char *buf, size_t size)
937{ 939{
938 if (size <= 0 || !buf) 940 if (!size || !buf)
939 return ; 941 return 0;
940 942
941 buf[0] = '/'; 943 buf[0] = '/';
942 size_t res = copy_path_helper(entry, buf, size); 944 size_t res = copy_path_helper(entry, buf, size);
943 /* fixup trailing '/' */ 945 /* fixup trailing '/' */
944 buf[res] = '\0'; 946 buf[res] = '\0';
947 return res;
945} 948}
946 949
947/* --- Directory cache live updating functions --- */ 950/* --- Directory cache live updating functions --- */
diff --git a/firmware/include/dircache.h b/firmware/include/dircache.h
index 49e804c7f1..716d1fbed2 100644
--- a/firmware/include/dircache.h
+++ b/firmware/include/dircache.h
@@ -100,7 +100,7 @@ int dircache_get_reserve_used(void);
100int dircache_get_build_ticks(void); 100int dircache_get_build_ticks(void);
101void dircache_disable(void); 101void dircache_disable(void);
102const struct dircache_entry *dircache_get_entry_ptr(const char *filename); 102const struct dircache_entry *dircache_get_entry_ptr(const char *filename);
103void dircache_copy_path(const struct dircache_entry *entry, char *buf, int size); 103size_t dircache_copy_path(const struct dircache_entry *entry, char *buf, size_t size);
104 104
105void dircache_bind(int fd, const char *path); 105void dircache_bind(int fd, const char *path);
106void dircache_update_filesize(int fd, long newsize, long startcluster); 106void dircache_update_filesize(int fd, long newsize, long startcluster);