Skip to content

Commit

Permalink
Добавил метод stBlockHeader::create
Browse files Browse the repository at this point in the history
  • Loading branch information
ava57r committed Feb 24, 2018
1 parent d9ae0b2 commit 1e6c070
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/tool1cd/cfapi/APIcfBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,20 @@ int32_t stBlockHeader::next_page_addr() const {

return std::stoi(hex, nullptr, 16);
}

stBlockHeader stBlockHeader::create(uint32_t block_data_size, uint32_t page_size, uint32_t next_page_addr)
{
stBlockHeader BlockHeader;
char buf[9];

sprintf(buf, "%08x", block_data_size);
strncpy(BlockHeader.data_size_hex, buf, 8);

sprintf(buf, "%08x", page_size);
strncpy(BlockHeader.page_size_hex, buf, 8);

sprintf(buf, "%08x", next_page_addr);
strncpy(BlockHeader.next_page_addr_hex, buf, 8);

return BlockHeader;
}

0 comments on commit 1e6c070

Please sign in to comment.