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

@@ -46,7 +46,7 @@ development.''
@titlepage @titlepage
@title GNU libcdio library @title GNU libcdio library
@subtitle $Id: libcdio.texi,v 1.50 2006/04/12 10:17:49 rocky Exp $ @subtitle $Id: libcdio.texi,v 1.51 2006/04/16 02:34:08 rocky Exp $
@author Rocky Bernstein et al. @author Rocky Bernstein et al.
@page @page
@@ -1732,14 +1732,14 @@ is and what CD drives are available.
A program eject a CD from a CD-ROM drive and then close the door again. A program eject a CD from a CD-ROM drive and then close the door again.
@item @code{iso1.c} @item @code{isolist.c}
A program to show using @code{libiso9660} to list files in a A program to show using @code{libiso9660} to list files in a
directory of an ISO-9660 image. directory of an ISO-9660 image.
@item @code{C++/iso1.cpp} @item @code{C++/isolist.cpp}
The same program as @code{iso1.c} written in C++. The same program as @code{isolist.c} written in C++.
@item @code{iso2.c} @item @code{iso2.c}

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.35 2006/04/15 16:18:33 rocky Exp $ # $Id: Makefile.am,v 1.36 2006/04/16 02:34:09 rocky Exp $
# #
# Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> # Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
# #
@@ -29,7 +29,7 @@ endif
noinst_PROGRAMS = audio cdchange cdtext device drives eject \ noinst_PROGRAMS = audio cdchange cdtext device drives eject \
isofile isofile2 isofuzzy isolist \ isofile isofile2 isofuzzy isolist \
mmc1 mmc2 mmc2a $(paranoia_progs) tracks \ mmc1 mmc2 mmc2a $(paranoia_progs) tracks \
sample3 sample4 udf1 udf2 sample3 sample4 udf1 udffile
INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS)
@@ -81,8 +81,8 @@ tracks_LDADD = $(LIBCDIO_LIBS)
udf1_DEPENDENCIES = $(LIBUDF_LIBS) $(LIBCDIO_DEPS) udf1_DEPENDENCIES = $(LIBUDF_LIBS) $(LIBCDIO_DEPS)
udf1_LDADD = $(LIBUDF_LIBS) $(LIBCDIO_LIBS) udf1_LDADD = $(LIBUDF_LIBS) $(LIBCDIO_LIBS)
udf2_DEPENDENCIES = $(LIBUDF_LIBS) $(LIBCDIO_DEPS) udffile_DEPENDENCIES = $(LIBUDF_LIBS) $(LIBCDIO_DEPS)
udf2_LDADD = $(LIBUDF_LIBS) $(LIBCDIO_LIBS) udffile_LDADD = $(LIBUDF_LIBS) $(LIBCDIO_LIBS)
# iso programs create file "copying" # iso programs create file "copying"

View File

@@ -67,12 +67,6 @@ typedef enum {
UDF_VOLSET_ID_SIZE = 128 UDF_VOLSET_ID_SIZE = 128
} ecma_167_enum1_t ; } ecma_167_enum1_t ;
/** This variable is trickery to force the above enum symbol values to
be recorded in debug symbol tables. It is used to allow one refer
to above enumeration values in a debugger and debugger
expressions */
extern ecma_167_enum1_t debug_ecma_167_enums1;
/** Tag Identifier (ECMA 167r3 3/7.2.1) */ /** Tag Identifier (ECMA 167r3 3/7.2.1) */
typedef enum { typedef enum {
@@ -161,12 +155,6 @@ typedef enum {
TIMESTAMP_TIMEZONE_MASK = 0x0FFF, TIMESTAMP_TIMEZONE_MASK = 0x0FFF,
} ecma_167_timezone_enum_t ; } ecma_167_timezone_enum_t ;
/** This variable is trickery to force the above enum symbol values to
be recorded in debug symbol tables. It is used to allow one refer
to above enumeration values in a debugger and debugger
expressions */
extern ecma_167_timezone_enum_t debug_ecma_167_timezone_enum;
#define TIMESTAMP_TYPE_MASK 0xF000 #define TIMESTAMP_TYPE_MASK 0xF000
#define TIMESTAMP_TYPE_CUT 0x0000 #define TIMESTAMP_TYPE_CUT 0x0000
@@ -990,9 +978,15 @@ PRAGMA_END_PACKED
allow one refer to the enumeration value names in the typedefs allow one refer to the enumeration value names in the typedefs
above in a debugger and in debugger expressions. above in a debugger and in debugger expressions.
*/ */
extern file_characteristics_t debug_file_characteristics; typedef union
extern tag_id_t debug_tagid; {
extern icbtag_file_type_enum_t debug_icbtag_file_type_enum; tag_id_t debug_tagid;
extern icbtag_flag_enum_t debug_flag_enum; file_characteristics_t debug_file_characteristics;
icbtag_file_type_enum_t debug_icbtag_file_type_enum;
icbtag_flag_enum_t debug_flag_enum;
ecma_167_enum1_t debug_ecma_167_enum1;
ecma_167_timezone_enum_t debug_ecma_167_timezone_enum;
} debug_ecma167_t;
extern debug_ecma167_t debug_ecma_167;
#endif /* _ECMA_167_H */ #endif /* _ECMA_167_H */

View File

@@ -1,5 +1,5 @@
/* /*
$Id: udf.h,v 1.20 2006/01/14 09:44:53 rocky Exp $ $Id: udf.h,v 1.21 2006/04/16 02:34:10 rocky Exp $
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@@ -51,7 +51,7 @@ typedef enum {
be recorded in debug symbol tables. It is used to allow one refer be recorded in debug symbol tables. It is used to allow one refer
to above enumeration values in a debugger and debugger to above enumeration values in a debugger and debugger
expressions */ expressions */
extern udf_enum1_t debug_udf_enums1; extern udf_enum1_t debug_udf_enum1;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

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> Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -35,13 +35,10 @@
to the enumeration value names in the typedefs above in a debugger to the enumeration value names in the typedefs above in a debugger
and debugger expressions and debugger expressions
*/ */
tag_id_t debug_tagid; extern debug_ecma167_t debug_ecma_167;
file_characteristics_t debug_file_characteristics;
udf_enum1_t debug_udf_enum1; 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. 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> Copyright (C) 2005, 2006 Rocky Bernstein <rockyb@users.sourceforge.net>
@@ -29,7 +29,7 @@
#include <stdio.h> /* Remove when adding cdio/logging.h */ #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 * const char *
udf_get_filename(const udf_dirent_t *p_udf_dirent) 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; if (count == 0) return 0;
else { else {
/* FIXME this code seems a bit convoluted. */
udf_t *p_udf = p_udf_dirent->p_udf; 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 *) p_udf_dirent->data;
const udf_file_entry_t *p_udf_fe = (udf_file_entry_t *) data;
driver_return_code_t ret; driver_return_code_t ret;
const unsigned long int i_file_length = udf_get_file_length(p_udf_dirent); 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 (0 == p_udf->i_position) {
if (ret == DRIVER_OP_SUCCESS) { 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)) { if (!udf_checktag(&p_udf_fe->tag, TAGID_FILE_ENTRY)) {
uint32_t i_lba_start, i_lba_end; uint32_t i_lba_start, i_lba_end;
udf_get_lba( p_udf_fe, &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; return i_read_len;
} }
} }
} else {
return DRIVER_OP_ERROR;
} }
} }
return ret; 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> Copyright (C) 2005, 2006 Rocky Bernstein <rockyb@users.sourceforge.net>
@@ -60,6 +60,7 @@ struct udf_dirent_s
uint8_t *sector; uint8_t *sector;
udf_file_entry_t fe; udf_file_entry_t fe;
udf_fileid_desc_t *fid; udf_fileid_desc_t *fid;
uint8_t data[UDF_BLOCKSIZE];
}; };
bool udf_get_lba(const udf_file_entry_t *p_udf_fe, bool udf_get_lba(const udf_file_entry_t *p_udf_fe,