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;
}
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++;
*/
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) {
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,
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
}
};
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
}
};
.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
}
};
break;
p[len - 1] = '\0';
ret = get_attribute_bitnum_by_name(p, &bitnum);
- if (ret < 0)
+ if (ret < 0) {
+ para_printf(&cad.pb, "attribute not found: %s\n", p);
goto out;
+ }
if (c == '+')
cad.add_mask |= (1UL << bitnum);
else
if (!cad.add_mask && !cad.del_mask)
goto out;
pmd.patterns.data = p;
- assert(p < (char *)query->data + query->size);
+ if (p >= (char *)query->data + query->size)
+ goto out;
pmd.patterns.size = (char *)query->data + query->size - p;
ret = for_each_matching_row(&pmd);
if (ret < 0)
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;
}