Commit 32248ed8 authored by Petri Hintukainen's avatar Petri Hintukainen

C90 compat fixes

parent 50d41b17
......@@ -41,15 +41,24 @@ static int _lsdir(udfread *udf, const char *path)
if (!strcmp(dirent.d_name, ".") || !strcmp(dirent.d_name, "..")) continue;
if (dirent.d_type == UDF_DT_DIR) {
char *next_dir;
printf("\t\t %s%s\n", path, dirent.d_name);
char *next_dir = (char*)malloc(strlen(path) + strlen(dirent.d_name) + 2);
next_dir = (char*)malloc(strlen(path) + strlen(dirent.d_name) + 2);
sprintf(next_dir, "%s%s/", path, dirent.d_name);
_lsdir(udf, next_dir);
free(next_dir);
} else {
char *file = (char*)malloc(strlen(path) + strlen(dirent.d_name) + 1);
char *file;
UDFFILE *fp;
file = (char*)malloc(strlen(path) + strlen(dirent.d_name) + 1);
sprintf(file, "%s%s", path, dirent.d_name);
UDFFILE *fp = udfread_file_open(udf, file);
fp = udfread_file_open(udf, file);
printf("%16" PRId64 " %s%s\n", udfread_file_size(fp), path, dirent.d_name);
udfread_file_close(fp);
free(file);
......
......@@ -109,12 +109,12 @@ static uint32_t _def_size(udfread_block_input *p_gen)
static int _def_read(udfread_block_input *p_gen, uint32_t lba, void *buf, uint32_t nblocks, int flags)
{
(void)flags;
default_block_input *p = (default_block_input *)p_gen;
size_t bytes, got;
off_t pos;
(void)flags;
bytes = (size_t)nblocks * UDF_BLOCK_SIZE;
got = 0;
pos = (off_t)lba * UDF_BLOCK_SIZE;
......
......@@ -122,6 +122,8 @@ void decode_partition(const uint8_t *p, struct partition_descriptor *pd)
/* Logical Volume Descriptor (ECMA 167 3/10.6) */
void decode_logical_volume(const uint8_t *p, struct logical_volume_descriptor *lvd)
{
size_t map_size;
lvd->block_size = _get_u32(p + 212);
decode_entity_id(p + 216, &lvd->domain_id);
......@@ -132,7 +134,7 @@ void decode_logical_volume(const uint8_t *p, struct logical_volume_descriptor *l
lvd->num_partition_maps = _get_u32(p + 268);
/* XXX cut long maps */
uint32_t map_size = lvd->partition_map_lable_length;
map_size = lvd->partition_map_lable_length;
if (map_size > sizeof(lvd->partition_map_table)) {
map_size = sizeof(lvd->partition_map_table);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment