File: phoenix_flm.cpp

package info (click to toggle)
uefitool 0.28.0%2BA73-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 7,728 kB
  • sloc: ansic: 55,322; cpp: 23,375; sh: 43; xml: 23; makefile: 5
file content (68 lines) | stat: -rw-r--r-- 1,997 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

#include "phoenix_flm.h"

phoenix_flm_t::phoenix_flm_t(kaitai::kstream* p__io, kaitai::kstruct* p__parent, phoenix_flm_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root ? p__root : this;
    m_entries = nullptr;
    f_len_flm_entry = false;
    f_len_flm_store_header = false;
    _read();
}

void phoenix_flm_t::_read() {
    m_signature = m__io->read_bytes(10);
    m_num_entries = m__io->read_u2le();
    m_reserved = m__io->read_u4le();
    m_entries = std::unique_ptr<std::vector<std::unique_ptr<flm_entry_t>>>(new std::vector<std::unique_ptr<flm_entry_t>>());
    const int l_entries = num_entries();
    for (int i = 0; i < l_entries; i++) {
        m_entries->push_back(std::move(std::unique_ptr<flm_entry_t>(new flm_entry_t(m__io, this, m__root))));
    }
}

phoenix_flm_t::~phoenix_flm_t() {
    _clean_up();
}

void phoenix_flm_t::_clean_up() {
}

phoenix_flm_t::flm_entry_t::flm_entry_t(kaitai::kstream* p__io, phoenix_flm_t* p__parent, phoenix_flm_t* p__root) : kaitai::kstruct(p__io) {
    m__parent = p__parent;
    m__root = p__root;
    _read();
}

void phoenix_flm_t::flm_entry_t::_read() {
    m_guid = m__io->read_bytes(16);
    m_data_type = m__io->read_u2le();
    m_entry_type = m__io->read_u2le();
    m_physical_address = m__io->read_u8le();
    m_size = m__io->read_u4le();
    m_offset = m__io->read_u4le();
}

phoenix_flm_t::flm_entry_t::~flm_entry_t() {
    _clean_up();
}

void phoenix_flm_t::flm_entry_t::_clean_up() {
}

int8_t phoenix_flm_t::len_flm_entry() {
    if (f_len_flm_entry)
        return m_len_flm_entry;
    f_len_flm_entry = true;
    m_len_flm_entry = 36;
    return m_len_flm_entry;
}

int8_t phoenix_flm_t::len_flm_store_header() {
    if (f_len_flm_store_header)
        return m_len_flm_store_header;
    f_len_flm_store_header = true;
    m_len_flm_store_header = 16;
    return m_len_flm_store_header;
}