The small_data section now makes use of the const keyword :-)

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4649 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2003-09-12 07:19:50 +00:00
parent 8d86e5a30d
commit 0774a741c2
+11 -11
View File
@@ -139,11 +139,11 @@ struct small_data {
uint16 NameSize() const { return BFS_ENDIAN_TO_HOST_INT16(name_size); } uint16 NameSize() const { return BFS_ENDIAN_TO_HOST_INT16(name_size); }
uint16 DataSize() const { return BFS_ENDIAN_TO_HOST_INT16(data_size); } uint16 DataSize() const { return BFS_ENDIAN_TO_HOST_INT16(data_size); }
inline char *Name(); inline char *Name() const;
inline uint8 *Data(); inline uint8 *Data() const;
inline uint32 Size(); inline uint32 Size() const;
inline small_data *Next(); inline small_data *Next() const;
inline bool IsLast(bfs_inode *inode); inline bool IsLast(const bfs_inode *inode) const;
}; };
// the file name is part of the small_data structure // the file name is part of the small_data structure
@@ -325,35 +325,35 @@ block_run::Run(int32 group, uint16 start, uint16 length)
inline char * inline char *
small_data::Name() small_data::Name() const
{ {
return name; return const_cast<char *>(name);
} }
inline uint8 * inline uint8 *
small_data::Data() small_data::Data() const
{ {
return (uint8 *)name + NameSize() + 3; return (uint8 *)name + NameSize() + 3;
} }
inline uint32 inline uint32
small_data::Size() small_data::Size() const
{ {
return sizeof(small_data) + NameSize() + 3 + DataSize() + 1; return sizeof(small_data) + NameSize() + 3 + DataSize() + 1;
} }
inline small_data * inline small_data *
small_data::Next() small_data::Next() const
{ {
return (small_data *)((uint8 *)this + Size()); return (small_data *)((uint8 *)this + Size());
} }
inline bool inline bool
small_data::IsLast(bfs_inode *inode) small_data::IsLast(const bfs_inode *inode) const
{ {
// we need to check the location first, because if name_size is already beyond // we need to check the location first, because if name_size is already beyond
// the block, we would touch invalid memory (although that can't cause wrong // the block, we would touch invalid memory (although that can't cause wrong