Minor cleanup, I hope I'm not interfering, Korli :-)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18762 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-09-05 15:27:21 +00:00
parent d69e258f4c
commit 242dab1257
@@ -135,6 +135,10 @@ typedef struct iso9660_directory_record {
uint16 volume_space_le;
} __attribute__((packed)) iso9660_directory_record;
static void dump_directory_record(iso9660_directory_record *record, const char *indent);
//----------------------------------------------------------------------------
// iso9660_info
//----------------------------------------------------------------------------
@@ -232,9 +236,9 @@ iso9660_info::set_string(char **string, const char *new_string, uint32 new_lengt
}
}
//----------------------------------------------------------------------------
// C functions
//----------------------------------------------------------------------------
// #pragma mark - C functions
/*! \brief Converts the given unicode character to utf8.
@@ -243,8 +247,7 @@ iso9660_info::set_string(char **string, const char *new_string, uint32 new_lengt
\todo Once OpenTracker's locale kit is done, perhaps that functionality
should be used rather than outright stealing the code.
*/
static
void
static void
unicode_to_utf8(uint32 c, char **out)
{
char *s = *out;
@@ -267,8 +270,8 @@ unicode_to_utf8(uint32 c, char **out)
*out = s;
}
static
const char*
static const char*
volume_descriptor_type_to_string(iso9660_volume_descriptor_type type)
{
switch (type) {
@@ -281,10 +284,10 @@ volume_descriptor_type_to_string(iso9660_volume_descriptor_type type)
}
}
static
void
dump_common_volume_descriptor(iso9660_common_volume_descriptor *common, const char *indent,
bool print_header)
static void
dump_common_volume_descriptor(iso9660_common_volume_descriptor *common,
const char *indent, bool print_header)
{
if (print_header)
TRACE(("%siso9660_common_volume_descriptor:\n", indent));
@@ -297,14 +300,10 @@ dump_common_volume_descriptor(iso9660_common_volume_descriptor *common, const ch
TRACE(("%s volume descriptor version == %d\n", indent, common->volume_descriptor_version));
}
static
void
dump_directory_record(iso9660_directory_record *record, const char *indent);
static
void
dump_primary_volume_descriptor(iso9660_primary_volume_descriptor *primary, const char *indent,
bool print_header)
static void
dump_primary_volume_descriptor(iso9660_primary_volume_descriptor *primary,
const char *indent, bool print_header)
{
if (print_header)
TRACE(("%siso9660_primary_volume_descriptor:\n", indent));
@@ -327,15 +326,16 @@ dump_primary_volume_descriptor(iso9660_primary_volume_descriptor *primary, const
dump_directory_record((iso9660_directory_record*)primary->root_directory_record, indent);
}
static
void
dump_supplementary_volume_descriptor(iso9660_supplementary_volume_descriptor *supplementary, const char *indent,
bool print_header)
static void
dump_supplementary_volume_descriptor(iso9660_supplementary_volume_descriptor *supplementary,
const char *indent, bool print_header)
{
if (print_header)
TRACE(("%siso9660_supplementary_volume_descriptor:\n", indent));
dump_primary_volume_descriptor((iso9660_primary_volume_descriptor*)supplementary, indent, false);
dump_primary_volume_descriptor((iso9660_primary_volume_descriptor*)supplementary,
indent, false);
TRACE(("%s escape sequences ==", indent));
for (int i = 0; i < ISO9660_ESCAPE_SEQUENCE_LENGTH; i++) {
TRACE((" %2x", supplementary->escape_sequences[i]));
@@ -345,8 +345,8 @@ dump_supplementary_volume_descriptor(iso9660_supplementary_volume_descriptor *su
TRACE(("\n"));
}
static
void
static void
dump_directory_record(iso9660_directory_record *record, const char *indent)
{
TRACE(("%s root directory record:\n", indent));
@@ -356,19 +356,22 @@ dump_directory_record(iso9660_directory_record *record, const char *indent)
TRACE(("%s volume sequence number == %d\n", indent, record->volume_space_le));
}
static
status_t
static status_t
check_common_volume_descriptor(iso9660_common_volume_descriptor *common)
{
status_t error = common ? B_OK : B_BAD_VALUE;
if (!error) {
error = strncmp(common->standard_identifier, kISO9660Signature,
5) == 0 ? B_OK : B_BAD_DATA;
error = strncmp(common->standard_identifier, kISO9660Signature, 5) == 0
? B_OK : B_BAD_DATA;
}
return error;
}
// #pragma mark - Public functions
// iso9660_fs_identify
/*! \brief Returns true if the given partition is a valid iso9660 partition.
@@ -388,9 +391,8 @@ iso9660_fs_identify(int deviceFD, iso9660_info *info)
off_t offset = 0x8000;
vol = (nspace *)calloc(sizeof(nspace), 1);
if (vol == NULL) {
if (vol == NULL)
return ENOMEM;
}
vol->fd = deviceFD;
@@ -403,9 +405,8 @@ iso9660_fs_identify(int deviceFD, iso9660_info *info)
// Read the block containing the current descriptor
error = read_pos (vol->fd, offset, (void *)&buffer, ISO_PVD_SIZE);
offset += ISO_PVD_SIZE;
if (error < ISO_PVD_SIZE) {
if (error < ISO_PVD_SIZE)
break;
}
common = (iso9660_common_volume_descriptor*)buffer;
error = check_common_volume_descriptor(common);