summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/fsblk_vec.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2021-12-31 13:27:44 -0500
committer AJR <ajrhacker@users.noreply.github.com>2021-12-31 13:28:25 -0500
commitf6f77bf6398cd6b06ce6778fafc772ed42261a3e (patch)
treec4da0575a94f49f3399d4754cac951d26837f573 /src/lib/formats/fsblk_vec.cpp
parent54899379258a7266db8d5bc6cda8b48169e67503 (diff)
Move filesystem library into separate namespace and use shorter uX type names there
Diffstat (limited to 'src/lib/formats/fsblk_vec.cpp')
-rw-r--r--src/lib/formats/fsblk_vec.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lib/formats/fsblk_vec.cpp b/src/lib/formats/fsblk_vec.cpp
index ff66b2b20ed..e80cad8c51c 100644
--- a/src/lib/formats/fsblk_vec.cpp
+++ b/src/lib/formats/fsblk_vec.cpp
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-// Block device on vector<uint8_t>
+// Block device on vector<u8>
#include "fsblk_vec.h"
@@ -10,12 +10,14 @@
#include <algorithm>
#include <stdexcept>
-const uint8_t *fsblk_vec_t::blk_t::rodata()
+namespace fs {
+
+const u8 *fsblk_vec_t::blk_t::rodata()
{
return m_data;
}
-uint8_t *fsblk_vec_t::blk_t::data()
+u8 *fsblk_vec_t::blk_t::data()
{
return m_data;
}
@@ -24,20 +26,21 @@ void fsblk_vec_t::blk_t::drop_weak_references()
{
}
-uint32_t fsblk_vec_t::block_count() const
+u32 fsblk_vec_t::block_count() const
{
return m_data.size() / m_block_size;
}
-fsblk_t::block_t fsblk_vec_t::get(uint32_t id)
+fsblk_t::block_t fsblk_vec_t::get(u32 id)
{
if(id >= block_count())
throw std::out_of_range(util::string_format("Block number overflow: requiring block %d on device of size %d (%d bytes, block size %d)", id, block_count(), m_data.size(), m_block_size));
return block_t(new blk_t(m_data.data() + m_block_size*id, m_block_size));
}
-void fsblk_vec_t::fill(uint8_t data)
+void fsblk_vec_t::fill(u8 data)
{
std::fill(m_data.begin(), m_data.end(), data);
}
+} // namespace fs