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; uint16 volume_space_le;
} __attribute__((packed)) iso9660_directory_record; } __attribute__((packed)) iso9660_directory_record;
static void dump_directory_record(iso9660_directory_record *record, const char *indent);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// iso9660_info // 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. /*! \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 \todo Once OpenTracker's locale kit is done, perhaps that functionality
should be used rather than outright stealing the code. should be used rather than outright stealing the code.
*/ */
static static void
void
unicode_to_utf8(uint32 c, char **out) unicode_to_utf8(uint32 c, char **out)
{ {
char *s = *out; char *s = *out;
@@ -267,8 +270,8 @@ unicode_to_utf8(uint32 c, char **out)
*out = s; *out = s;
} }
static
const char* static const char*
volume_descriptor_type_to_string(iso9660_volume_descriptor_type type) volume_descriptor_type_to_string(iso9660_volume_descriptor_type type)
{ {
switch (type) { switch (type) {
@@ -281,10 +284,10 @@ volume_descriptor_type_to_string(iso9660_volume_descriptor_type type)
} }
} }
static
void static void
dump_common_volume_descriptor(iso9660_common_volume_descriptor *common, const char *indent, dump_common_volume_descriptor(iso9660_common_volume_descriptor *common,
bool print_header) const char *indent, bool print_header)
{ {
if (print_header) if (print_header)
TRACE(("%siso9660_common_volume_descriptor:\n", indent)); 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)); 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 static void
void dump_primary_volume_descriptor(iso9660_primary_volume_descriptor *primary,
dump_primary_volume_descriptor(iso9660_primary_volume_descriptor *primary, const char *indent, const char *indent, bool print_header)
bool print_header)
{ {
if (print_header) if (print_header)
TRACE(("%siso9660_primary_volume_descriptor:\n", indent)); 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); dump_directory_record((iso9660_directory_record*)primary->root_directory_record, indent);
} }
static
void static void
dump_supplementary_volume_descriptor(iso9660_supplementary_volume_descriptor *supplementary, const char *indent, dump_supplementary_volume_descriptor(iso9660_supplementary_volume_descriptor *supplementary,
bool print_header) const char *indent, bool print_header)
{ {
if (print_header) if (print_header)
TRACE(("%siso9660_supplementary_volume_descriptor:\n", indent)); 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)); TRACE(("%s escape sequences ==", indent));
for (int i = 0; i < ISO9660_ESCAPE_SEQUENCE_LENGTH; i++) { for (int i = 0; i < ISO9660_ESCAPE_SEQUENCE_LENGTH; i++) {
TRACE((" %2x", supplementary->escape_sequences[i])); TRACE((" %2x", supplementary->escape_sequences[i]));
@@ -345,8 +345,8 @@ dump_supplementary_volume_descriptor(iso9660_supplementary_volume_descriptor *su
TRACE(("\n")); TRACE(("\n"));
} }
static
void static void
dump_directory_record(iso9660_directory_record *record, const char *indent) dump_directory_record(iso9660_directory_record *record, const char *indent)
{ {
TRACE(("%s root directory record:\n", 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)); 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) check_common_volume_descriptor(iso9660_common_volume_descriptor *common)
{ {
status_t error = common ? B_OK : B_BAD_VALUE; status_t error = common ? B_OK : B_BAD_VALUE;
if (!error) { if (!error) {
error = strncmp(common->standard_identifier, kISO9660Signature, error = strncmp(common->standard_identifier, kISO9660Signature, 5) == 0
5) == 0 ? B_OK : B_BAD_DATA; ? B_OK : B_BAD_DATA;
} }
return error; return error;
} }
// #pragma mark - Public functions
// iso9660_fs_identify // iso9660_fs_identify
/*! \brief Returns true if the given partition is a valid iso9660 partition. /*! \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; off_t offset = 0x8000;
vol = (nspace *)calloc(sizeof(nspace), 1); vol = (nspace *)calloc(sizeof(nspace), 1);
if (vol == NULL) { if (vol == NULL)
return ENOMEM; return ENOMEM;
}
vol->fd = deviceFD; vol->fd = deviceFD;
@@ -403,9 +405,8 @@ iso9660_fs_identify(int deviceFD, iso9660_info *info)
// Read the block containing the current descriptor // Read the block containing the current descriptor
error = read_pos (vol->fd, offset, (void *)&buffer, ISO_PVD_SIZE); error = read_pos (vol->fd, offset, (void *)&buffer, ISO_PVD_SIZE);
offset += ISO_PVD_SIZE; offset += ISO_PVD_SIZE;
if (error < ISO_PVD_SIZE) { if (error < ISO_PVD_SIZE)
break; break;
}
common = (iso9660_common_volume_descriptor*)buffer; common = (iso9660_common_volume_descriptor*)buffer;
error = check_common_volume_descriptor(common); error = check_common_volume_descriptor(common);