Remove some bugs in udf_file.c Others remain.

This commit is contained in:
rocky
2006-04-16 02:34:08 +00:00
parent f4438d5de5
commit 8a9128cf61
7 changed files with 38 additions and 45 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: udf.c,v 1.9 2006/04/11 00:26:54 rocky Exp $
$Id: udf.c,v 1.10 2006/04/16 02:34:10 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -35,13 +35,10 @@
to the enumeration value names in the typedefs above in a debugger
and debugger expressions
*/
tag_id_t debug_tagid;
file_characteristics_t debug_file_characteristics;
extern debug_ecma167_t debug_ecma_167;
udf_enum1_t debug_udf_enum1;
icbtag_file_type_enum_t debug_icbtag_file_type_enum;
icbtag_flag_enum_t debug_flag_enum;
ecma_167_enum1_t ecma167_enum1;
ecma_167_timezone_enum_t debug_ecma_167_timezone_enum;
/*!
Returns POSIX mode bitstring for a given file.

View File

@@ -1,5 +1,5 @@
/*
$Id: udf_file.c,v 1.10 2006/04/15 03:05:14 rocky Exp $
$Id: udf_file.c,v 1.11 2006/04/16 02:34:10 rocky Exp $
Copyright (C) 2005, 2006 Rocky Bernstein <rockyb@users.sourceforge.net>
@@ -29,7 +29,7 @@
#include <stdio.h> /* Remove when adding cdio/logging.h */
#define MIN(a, b) (a>b) ? (a) : (b)
#define MIN(a, b) (a<b) ? (a) : (b)
const char *
udf_get_filename(const udf_dirent_t *p_udf_dirent)
@@ -113,14 +113,18 @@ udf_read_block(const udf_dirent_t *p_udf_dirent, void * buf, size_t count)
{
if (count == 0) return 0;
else {
/* FIXME this code seems a bit convoluted. */
udf_t *p_udf = p_udf_dirent->p_udf;
uint8_t data[UDF_BLOCKSIZE];
const udf_file_entry_t *p_udf_fe = (udf_file_entry_t *) data;
const udf_file_entry_t *p_udf_fe = (udf_file_entry_t *) p_udf_dirent->data;
driver_return_code_t ret;
const unsigned long int i_file_length = udf_get_file_length(p_udf_dirent);
ret = udf_read_sectors(p_udf, data, p_udf_dirent->fe.unique_ID, 1);
if (ret == DRIVER_OP_SUCCESS) {
if (0 == p_udf->i_position) {
ret = udf_read_sectors(p_udf, p_udf_dirent->data,
p_udf_dirent->fe.unique_ID, 1);
if (ret != DRIVER_OP_SUCCESS) return DRIVER_OP_ERROR;
}
{
if (!udf_checktag(&p_udf_fe->tag, TAGID_FILE_ENTRY)) {
uint32_t i_lba_start, i_lba_end;
udf_get_lba( p_udf_fe, &i_lba_start, &i_lba_end);
@@ -140,9 +144,6 @@ udf_read_block(const udf_dirent_t *p_udf_dirent, void * buf, size_t count)
return i_read_len;
}
}
} else {
return DRIVER_OP_ERROR;
}
}
return ret;

View File

@@ -1,5 +1,5 @@
/*
$Id: udf_private.h,v 1.9 2006/04/15 03:05:14 rocky Exp $
$Id: udf_private.h,v 1.10 2006/04/16 02:34:10 rocky Exp $
Copyright (C) 2005, 2006 Rocky Bernstein <rockyb@users.sourceforge.net>
@@ -60,6 +60,7 @@ struct udf_dirent_s
uint8_t *sector;
udf_file_entry_t fe;
udf_fileid_desc_t *fid;
uint8_t data[UDF_BLOCKSIZE];
};
bool udf_get_lba(const udf_file_entry_t *p_udf_fe,