Exemple #1
0
//Construct new heap from binary buffer data
EmuHeap::EmuHeap(Buffer &b) {
   unsigned int n;
   nextHeap = NULL;
   head = NULL;
   b.read((char*)&n, sizeof(n));
   
   //test for multi-heap
   if (n == HEAP_MAGIC) {
      unsigned int num_heaps;
      EmuHeap *p = NULL;
      b.read((char*)&num_heaps, sizeof(num_heaps));
      for (unsigned int i = 0; i < num_heaps; i++) {
         b.read((char*)&n, sizeof(n));
         if (p) {
            p->nextHeap = new EmuHeap(b, n);
            p = p->nextHeap;
         }
         else {
            readHeap(b, n);
            p = this;
         }
      }
   }
   else { //only a single heap, we already have n
      readHeap(b, n);
   }
}
Exemple #2
0
EmuHeap::EmuHeap(Buffer &b, unsigned int num_blocks) {
   nextHeap = NULL;
   readHeap(b, num_blocks);
   if (primaryHeap == NULL) {
      primaryHeap = this;
   }
}
Exemple #3
0
//Construct new heap from binary buffer data
EmuHeap::EmuHeap(Buffer &b) {
   unsigned int n;
   nextHeap = NULL;
   head = NULL;
   unsigned int num_heaps;
   b.read((char*)&num_heaps, sizeof(num_heaps));  //how many heaps
   
   EmuHeap *p = NULL;
   for (unsigned int i = 0; i < num_heaps; i++) {
      b.read((char*)&n, sizeof(n));
      if (p) {
         p->nextHeap = new EmuHeap(b, n);
         p = p->nextHeap;
      }
      else {
         readHeap(b, n);
      }
   }
}
Exemple #4
0
EmuHeap::EmuHeap(Buffer &b, unsigned int num_blocks) {
   nextHeap = NULL;
   readHeap(b, num_blocks);
}