X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=aft.c;h=a9bc006e110570a9e3551609f619e2062b24df73;hp=fb0d4fd252b6091c2c7a3ae280d2746cc3519a36;hb=a3edba783bb81e6032a50f059b6263caa02a2150;hpb=f3623744f5b28e0df91323cf5069f1932df7848d diff --git a/aft.c b/aft.c index fb0d4fd2..a9bc006e 100644 --- a/aft.c +++ b/aft.c @@ -669,16 +669,13 @@ err: int load_afd(int shmid, struct audio_file_data *afd) { void *shm_afd; - char *buf; int ret; ret = shm_attach(shmid, ATTACH_RO, &shm_afd); if (ret < 0) return ret; *afd = *(struct audio_file_data *)shm_afd; - buf = shm_afd; - buf += sizeof(*afd); - load_chunk_table(&afd->afhi, buf); + load_chunk_table(&afd->afhi, shm_afd + sizeof(*afd)); shm_detach(shm_afd); return 1; } @@ -1121,13 +1118,13 @@ again: return ret; ret = mmap_full_file(d->path, O_RDONLY, &map.data, &map.size, &afd->fd); if (ret < 0) - goto err; + goto out; hash_function(map.data, map.size, file_hash); ret = hash_compare(file_hash, d->hash); para_munmap(map.data, map.size); if (ret) { ret = -E_HASH_MISMATCH; - goto err; + goto out; } new_afsi = d->afsi; new_afsi.num_played++; @@ -1144,7 +1141,7 @@ again: */ afs_event(AFSI_CHANGE, NULL, &aced); ret = save_afd(afd); -err: +out: free(afd->afhi.chunk_table); osl_close_disk_object(&chunk_table_obj); if (ret < 0) { @@ -1879,8 +1876,10 @@ static int add_one_audio_file(const char *path, void *private_data) unsigned char hash[HASH_SIZE]; ret = guess_audio_format(path); - if (ret < 0 && !(pad->flags & ADD_FLAG_ALL)) + if (ret < 0 && !(pad->flags & ADD_FLAG_ALL)) { + ret = 0; goto out_free; + } query.data = (char *)path; query.size = strlen(path) + 1; ret = send_callback_request(path_brother_callback, &query, @@ -2103,7 +2102,10 @@ static void com_touch_callback(int fd, const struct osl_object *query) struct touch_action_data tad = {.cto = query->data, .pb = { .max_size = shm_get_shmmax(), - .private_data = &fd, + .private_data = &(struct afs_max_size_handler_data) { + .fd = fd, + .band = SBD_OUTPUT + }, .max_size_handler = afs_max_size_handler } }; @@ -2244,7 +2246,10 @@ static void com_rm_callback(int fd, const struct osl_object *query) struct com_rm_action_data crd = {.flags = *(uint32_t *)query->data, .pb = { .max_size = shm_get_shmmax(), - .private_data = &fd, + .private_data = &(struct afs_max_size_handler_data) { + .fd = fd, + .band = SBD_OUTPUT + }, .max_size_handler = afs_max_size_handler } }; @@ -2386,7 +2391,10 @@ static void com_cpsi_callback(int fd, const struct osl_object *query) .flags = *(unsigned *)query->data, .pb = { .max_size = shm_get_shmmax(), - .private_data = &fd, + .private_data = &(struct afs_max_size_handler_data) { + .fd = fd, + .band = SBD_OUTPUT + }, .max_size_handler = afs_max_size_handler } }; @@ -2712,9 +2720,9 @@ static int aft_open(const char *dir) PARA_INFO_LOG("audio file table contains %d files\n", num); return ret; } - PARA_INFO_LOG("failed to open audio file table\n"); + PARA_NOTICE_LOG("failed to open audio file table\n"); audio_file_table = NULL; - if (ret >= 0 || ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_NOENT)) + if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_NOENT)) return 1; return ret; }