Major const cleanup.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4748 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder 2003-09-18 07:29:31 +00:00
parent 3013100fff
commit d5366ff7e1
4 changed files with 71 additions and 65 deletions

View File

@ -24,7 +24,7 @@ namespace Udf {
template<typename DataType, uint32 arrayLength>
struct array {
public:
void dump() {
void dump() const {
for (uint32 i = 0; i < arrayLength; i++)
data[i].print();
}
@ -42,7 +42,7 @@ public:
*/
template<uint32 arrayLength>
struct array<uint8, arrayLength> {
void dump()
void dump() const
{
const uint8 bytesPerRow = 8;
char classname[40];
@ -65,7 +65,7 @@ struct array<uint8, arrayLength> {
*/
template<uint32 arrayLength>
struct array<char, arrayLength> {
void dump()
void dump() const
{
const uint8 bytesPerRow = 8;
char classname[40];

View File

@ -27,15 +27,15 @@ public:
CS0String();
CS0String(const char *cs0, uint32 length);
template <uint32 length>
CS0String(array<char, length> &cs0);
CS0String(const array<char, length> &cs0);
~CS0String();
void SetTo(const char *cs0, uint32 length);
template <uint32 length>
void SetTo(array<char, length> &cs0);
void SetTo(const array<char, length> &cs0);
template <uint32 length>
CS0String& operator=(array<char, length> &cs0);
CS0String& operator=(const array<char, length> &cs0);
const char* String() const { return fUtf8String; }
uint32 Length() const { return fUtf8String ? strlen(fUtf8String) : 0; }
@ -49,7 +49,7 @@ private:
void unicode_to_utf8(uint32 c, char **out);
template <uint32 length>
CS0String::CS0String(array<char, length> &cs0)
CS0String::CS0String(const array<char, length> &cs0)
: fUtf8String(NULL)
{
DEBUG_INIT(CF_HELPER | CF_HIGH_VOLUME, "CS0String");
@ -59,14 +59,14 @@ CS0String::CS0String(array<char, length> &cs0)
template <uint32 length>
void
CS0String::SetTo(array<char, length> &cs0)
CS0String::SetTo(const array<char, length> &cs0)
{
SetTo(reinterpret_cast<char*>(cs0.data), length);
SetTo(reinterpret_cast<const char*>(cs0.data), length);
}
template <uint32 length>
CS0String&
CS0String::operator=(array<char, length> &cs0)
CS0String::operator=(const array<char, length> &cs0)
{
SetTo(cs0);
return *this;

View File

@ -55,7 +55,7 @@ udf_volume_structure_descriptor_header::id_matches(const char *id)
//----------------------------------------------------------------------
void
udf_charspec::dump()
udf_charspec::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_charspec");
PRINT(("character_set_type: %d\n", character_set_type()));
@ -68,7 +68,7 @@ udf_charspec::dump()
//----------------------------------------------------------------------
void
udf_timestamp::dump()
udf_timestamp::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_timestamp");
PRINT(("type: %d\n", type()));
@ -89,7 +89,7 @@ udf_timestamp::dump()
//----------------------------------------------------------------------
void
udf_entity_id::dump()
udf_entity_id::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_entity_id");
PRINT(("flags: %d\n", flags()));
@ -103,7 +103,7 @@ udf_entity_id::dump()
//----------------------------------------------------------------------
void
udf_extent_address::dump()
udf_extent_address::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_extent_address");
PRINT(("length: %ld\n", length()));
@ -111,7 +111,7 @@ udf_extent_address::dump()
}
void
udf_logical_block_address::dump()
udf_logical_block_address::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_logical_block_address");
PRINT(("block: %ld\n", block()));
@ -119,7 +119,7 @@ udf_logical_block_address::dump()
}
void
udf_long_address::dump()
udf_long_address::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_long_address");
PRINT(("length: %ld\n", length()));
@ -134,7 +134,7 @@ udf_long_address::dump()
//----------------------------------------------------------------------
void
udf_tag::dump()
udf_tag::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_descriptor_tag");
PRINT(("id: %d\n", id()));
@ -156,8 +156,8 @@ status_t
udf_tag::init_check(uint32 diskBlock)
{
DEBUG_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_HIGH_VOLUME, "udf_descriptor_tag");
PRINT(("diskLocation == %ld\n", diskBlock));
PRINT(("location() == %ld\n", location()));
PRINT(("location (paramater) == %ld\n", diskBlock));
PRINT(("location (in structure) == %ld\n", location()));
status_t err = (diskBlock == location()) ? B_OK : B_NO_INIT;
// checksum
if (!err) {
@ -179,7 +179,7 @@ udf_tag::init_check(uint32 diskBlock)
//----------------------------------------------------------------------
void
udf_primary_descriptor::dump()
udf_primary_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_primary_descriptor");
@ -223,7 +223,7 @@ udf_primary_descriptor::dump()
//----------------------------------------------------------------------
void
udf_anchor_descriptor::dump()
udf_anchor_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_anchor_descriptor");
PRINT(("tag:\n"));
@ -240,7 +240,7 @@ udf_anchor_descriptor::dump()
//----------------------------------------------------------------------
void
udf_implementation_use_descriptor::dump()
udf_implementation_use_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_implementation_use_descriptor");
PRINT(("tag:\n"));
@ -258,7 +258,7 @@ udf_implementation_use_descriptor::dump()
//----------------------------------------------------------------------
void
udf_partition_descriptor::dump()
udf_partition_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_partition_descriptor");
PRINT(("tag:\n"));
@ -285,7 +285,7 @@ udf_partition_descriptor::dump()
//----------------------------------------------------------------------
void
udf_logical_descriptor::dump()
udf_logical_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_logical_descriptor");
PRINT(("tag:\n"));
@ -319,7 +319,7 @@ udf_logical_descriptor::dump()
//----------------------------------------------------------------------
void
udf_unallocated_space_descriptor::dump()
udf_unallocated_space_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_unallocated_space_descriptor");
PRINT(("tag:\n"));
@ -335,7 +335,7 @@ udf_unallocated_space_descriptor::dump()
//----------------------------------------------------------------------
void
udf_terminating_descriptor::dump()
udf_terminating_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_terminating_descriptor");
PRINT(("tag:\n"));
@ -347,7 +347,7 @@ udf_terminating_descriptor::dump()
//----------------------------------------------------------------------
void
udf_file_set_descriptor::dump()
udf_file_set_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_DUMP, "udf_file_set_descriptor");
PRINT(("tag:\n"));
@ -383,7 +383,7 @@ udf_file_set_descriptor::dump()
}
void
udf_file_id_descriptor::dump()
udf_file_id_descriptor::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_VOLUME_OPS, "udf_file_id_descriptor");
PRINT(("tag:\n"));
@ -405,7 +405,7 @@ udf_file_id_descriptor::dump()
}
void
udf_icb_entry_tag::dump()
udf_icb_entry_tag::dump() const
{
DUMP_INIT(CF_PUBLIC, "udf_icb_entry_tag");
PRINT(("prior_entries: %ld\n", prior_recorded_number_of_direct_entries()));
@ -450,7 +450,7 @@ udf_icb_entry_tag::dump()
}
void
udf_icb_header::dump()
udf_icb_header::dump() const
{
DUMP_INIT(CF_PUBLIC | CF_DUMP, "udf_icb_header");

View File

@ -57,7 +57,7 @@ namespace Udf {
*/
struct udf_charspec {
public:
void dump();
void dump() const;
uint8 character_set_type() const { return _character_set_type; }
const char* character_set_info() const { return _character_set_info; }
@ -88,7 +88,7 @@ private:
};
public:
void dump();
void dump() const;
// Get functions
uint16 type_and_timezone() const { return B_LENDIAN_TO_HOST_INT16(_type_and_timezone); }
@ -157,7 +157,7 @@ private:
*/
struct udf_entity_id {
public:
void dump();
void dump() const;
// Get functions
uint8 flags() const { return _flags; }
@ -237,10 +237,10 @@ extern const char* kVSDID_ECMA168;
*/
struct udf_extent_address {
public:
void dump();
void dump() const;
uint32 length() { return B_LENDIAN_TO_HOST_INT32(_length); }
uint32 location() { return B_LENDIAN_TO_HOST_INT32(_location); }
uint32 length() const { return B_LENDIAN_TO_HOST_INT32(_length); }
uint32 location() const { return B_LENDIAN_TO_HOST_INT32(_location); }
void set_length(int32 length) { _length = B_HOST_TO_LENDIAN_INT32(length); }
void set_location(int32 location) { _location = B_HOST_TO_LENDIAN_INT32(location); }
@ -256,7 +256,7 @@ private:
*/
struct udf_logical_block_address {
public:
void dump();
void dump() const;
uint32 block() const { return B_LENDIAN_TO_HOST_INT32(_block); }
uint16 partition() const { return B_LENDIAN_TO_HOST_INT16(_partition); }
@ -299,7 +299,7 @@ private:
};
public:
void dump();
void dump() const;
uint8 type() const {
type_and_length_accessor t;
@ -350,7 +350,7 @@ private:
};
public:
void dump();
void dump() const;
uint8 type() const {
type_and_length_accessor t;
@ -413,17 +413,17 @@ private:
*/
struct udf_tag {
public:
void dump();
void dump() const;
status_t init_check(uint32 diskBlock);
uint16 id() { return B_LENDIAN_TO_HOST_INT16(_id); }
uint16 version() { return B_LENDIAN_TO_HOST_INT16(_version); }
uint8 checksum() { return _checksum; }
uint16 serial_number() { return B_LENDIAN_TO_HOST_INT16(_serial_number); }
uint16 crc() { return B_LENDIAN_TO_HOST_INT16(_crc); }
uint16 crc_length() { return B_LENDIAN_TO_HOST_INT16(_crc_length); }
uint32 location() { return B_LENDIAN_TO_HOST_INT32(_location); }
uint16 id() const { return B_LENDIAN_TO_HOST_INT16(_id); }
uint16 version() const { return B_LENDIAN_TO_HOST_INT16(_version); }
uint8 checksum() const { return _checksum; }
uint16 serial_number() const { return B_LENDIAN_TO_HOST_INT16(_serial_number); }
uint16 crc() const { return B_LENDIAN_TO_HOST_INT16(_crc); }
uint16 crc_length() const { return B_LENDIAN_TO_HOST_INT16(_crc_length); }
uint32 location() const { return B_LENDIAN_TO_HOST_INT32(_location); }
void set_id(uint16 id) { _id = B_HOST_TO_LENDIAN_INT16(id); }
void set_version(uint16 version) { _version = B_HOST_TO_LENDIAN_INT16(version); }
@ -497,7 +497,7 @@ enum udf_tag_id {
*/
struct udf_primary_descriptor {
public:
void dump();
void dump() const;
// Get functions
const udf_tag& tag() const { return _tag; }
@ -625,11 +625,16 @@ private:
*/
struct udf_anchor_descriptor {
public:
void dump();
void dump() const;
udf_tag& tag() { return _tag; }
const udf_tag& tag() const { return _tag; }
udf_extent_address& main_vds() { return _main_vds; }
const udf_extent_address& main_vds() const { return _main_vds; }
udf_extent_address& reserve_vds() { return _reserve_vds; }
const udf_extent_address& reserve_vds() const { return _reserve_vds; }
private:
udf_tag _tag;
udf_extent_address _main_vds; //!< min length of 16 sectors
@ -657,7 +662,7 @@ struct udf_descriptor_pointer {
*/
struct udf_implementation_use_descriptor {
public:
void dump();
void dump() const;
// Get functions
const udf_tag& tag() const { return _tag; }
@ -696,7 +701,7 @@ private:
};
public:
void dump();
void dump() const;
// Get functions
const udf_tag& tag() const { return _tag; }
@ -783,7 +788,7 @@ enum partition_access_type {
See also: ECMA 167 3/10.6, UDF-2.01 2.2.4
*/
struct udf_logical_descriptor {
void dump();
void dump() const;
// Get functions
const udf_tag& tag() const { return _tag; }
@ -936,7 +941,7 @@ struct udf_virtual_partition_map {
See also: ECMA-167 3/10.8
*/
struct udf_unallocated_space_descriptor {
void dump();
void dump() const;
// Get functions
const udf_tag& tag() const { return _tag; }
@ -961,7 +966,7 @@ private:
See also: ECMA-167 3/10.9
*/
struct udf_terminating_descriptor {
void dump();
void dump() const;
// Get functions
const udf_tag& tag() const { return _tag; }
@ -1021,7 +1026,7 @@ enum {
reference actual file data extents that are also referenced by other file sets.
*/
struct udf_file_set_descriptor {
void dump();
void dump() const;
// Get functions
const udf_tag& tag() const { return _tag; }
@ -1136,7 +1141,7 @@ struct udf_partition_header_descriptor {
*/
struct udf_file_id_descriptor {
public:
void dump();
void dump() const;
udf_tag& tag() { return _tag; }
const udf_tag& tag() const { return _tag; }
@ -1189,10 +1194,11 @@ public:
*/
uint8* implementation_use() { return ((uint8*)this)+38; }
char* id() { return ((char*)this)+38+implementation_use_length(); }
const char* id() const { return ((const char*)this)+38+implementation_use_length(); }
uint16 structure_length() { return 38 + id_length() + implementation_use_length(); }
uint16 padding_length() { return ((structure_length()+3)/4)*4 - structure_length(); }
uint16 total_length() { return structure_length() + padding_length(); }
uint16 structure_length() const { return 38 + id_length() + implementation_use_length(); }
uint16 padding_length() const { return ((structure_length()+3)/4)*4 - structure_length(); }
uint16 total_length() const { return structure_length() + padding_length(); }
// Set functions
void set_version_number(uint16 number) { _version_number = B_HOST_TO_LENDIAN_INT16(number); }
@ -1349,16 +1355,16 @@ private:
};
public:
void dump();
void dump() const;
uint32 prior_recorded_number_of_direct_entries() { return B_LENDIAN_TO_HOST_INT32(_prior_recorded_number_of_direct_entries); }
uint16 strategy_type() { return B_LENDIAN_TO_HOST_INT16(_strategy_type); }
uint32 prior_recorded_number_of_direct_entries() const { return B_LENDIAN_TO_HOST_INT32(_prior_recorded_number_of_direct_entries); }
uint16 strategy_type() const { return B_LENDIAN_TO_HOST_INT16(_strategy_type); }
array<uint8, 2>& strategy_parameters() { return _strategy_parameters; }
const array<uint8, 2>& strategy_parameters() const { return _strategy_parameters; }
uint16 entry_count() { return B_LENDIAN_TO_HOST_INT16(_entry_count); }
uint8 file_type() { return _file_type; }
uint16 entry_count() const { return B_LENDIAN_TO_HOST_INT16(_entry_count); }
uint8 file_type() const { return _file_type; }
udf_logical_block_address& parent_icb_location() { return _parent_icb_location; }
const udf_logical_block_address& parent_icb_location() const { return _parent_icb_location; }
@ -1399,7 +1405,7 @@ private:
*/
struct udf_icb_header {
public:
void dump();
void dump() const;
udf_tag &tag() { return _tag; }
const udf_tag &tag() const { return _tag; }