DEADSOFTWARE

fix gcc 4.0
[odcread.git] / reader / readAlien.cc
1 #include "reader/module.ih"
3 namespace odc {
5 void Reader::readAlien(Alien *alien, std::streampos down, std::streampos end) {
6 std::streampos next = down;
7 if (next == (std::streampos)0) {
8 next = end;
9 }
10 while (d_rider.tellg() < end) {
11 if (d_rider.tellg() < next) { // for some reason, this means its a piece (unstructured)
12 size_t len = next - d_rider.tellg();
13 char *buf = new char[len];
14 d_rider.read(buf, len);
15 AlienComponent *comp = new AlienPiece(buf, len);
16 alien->getComponents().push_back(comp);
17 } else { // that means we've got a store
18 d_rider.seekg(next);
19 AlienComponent *comp = new AlienPart(readStore());
20 alien->getComponents().push_back(comp);
21 next = d_state->next > 0 ? d_state->next : end;
22 }
23 }
24 }
26 } // namespace odc