MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / writeDirectory

Function writeDirectory

tools/brother120tool.cc:67–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void writeDirectory()
68{
69 Bytes buffer(2048);
70 ByteWriter bw(buffer);
71
72 int count = 0;
73 for (const auto& it : directory)
74 {
75 const auto& dirent = it.second;
76
77 if (count == DIRECTORY_SIZE)
78 error("too many files on disk");
79
80 bw.append(dirent->filename);
81 for (int i = dirent->filename.size(); i < 8; i++)
82 bw.write_8(' ');
83
84 bw.write_8(dirent->type);
85 bw.write_be16(dirent->startSector);
86 bw.write_8(dirent->sectorCount);
87 bw.write_be32(0); /* unknown */
88 count++;
89 }
90
91 static const Bytes padding(15);
92 while (count < DIRECTORY_SIZE)
93 {
94 bw.write_8(0xf0);
95 bw.append(padding);
96 count++;
97 }
98
99 file.seekp(0, std::ifstream::beg);
100 buffer.writeTo(file);
101}
102
103void writeBootSector(const Dirent& dirent, uint16_t checksum)
104{

Callers 1

doCreateFunction · 0.85

Calls 3

errorFunction · 0.85
writeToMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected