uint32_t ElfGNUSymbolVersionDefinition::size() const
{
    if (nextOffset())
        return nextOffset();
    return section()->size() - (reinterpret_cast<const unsigned char*>(m_verDef) - section()->rawData());
}
Esempio n. 2
0
AttributeAttributeList::AttributeAttributeList(VFile *vFile, Attribute &parent)
{
  _attributeHeader = new AttributeHeader(*(parent.attributeHeader()));

  _readBuffer = parent.readBuffer();
  _attributeOffset = parent.attributeOffset();
  _bufferOffset = parent.bufferOffset();
  _offsetInRun = 0;
  _offsetRunIndex = 0;
  _currentEntry = 0;
  _vfile = vFile;
  _clusterSize = parent.clusterSize();

  _baseOffset = 0;
  _bufferOffset = parent.bufferOffset();
  _offsetListSize = 0;
  _mftIndex = 0;

  _mftEntrySize = parent.mftEntrySize();
  _indexRecordSize = parent.indexRecordSize();
  _sectorSize = parent.sectorSize();
  _clusterSize = parent.clusterSize();
  _currentRunIndex = 0;

  if (_attributeHeader->nonResidentFlag) {
    _attributeNonResidentDataHeader = new AttributeNonResidentDataHeader(*(parent.nonResidentDataHeader()));
    setRunList();
    size(_attributeNonResidentDataHeader->attributeContentActualSize);

    _contentBuffer = new uint8_t[_size];
    uint64_t	readOffset;
    uint64_t	readPos = 0;
    uint64_t	readSize = _size;
    uint64_t	readed = 0;

    while ((readOffset = nextOffset())) 
   {
      readed = _vfile->seek(readOffset);
      if (readSize > _clusterSize) 
      {
	readed = _vfile->read(_contentBuffer + readPos, _clusterSize); //XXX
	if (readed == 0)
	  break;
	readPos += readed;
	readSize -= readed;
      }
      else 
      {
	readed = _vfile->read(_contentBuffer + readPos, readSize); //XXX
	if (readed == 0)
	  break;
	readPos += readed;
	readSize = 0;
      }
    }
    _dataOffset = 0;
  }
  else {
    uint8_t	i;
    _attributeResidentDataHeader = new AttributeResidentDataHeader(*(parent.residentDataHeader()));
    size(_attributeResidentDataHeader->contentSize);
    offset(_attributeResidentDataHeader->contentOffset);
    _fixupIndexesSize = parent.fixupIndexesSize();
    _fixupIndexes = new uint64_t[_fixupIndexesSize];
    for (i = 0; i < _fixupIndexesSize; i++) {
      _fixupIndexes[i] = parent.fixupIndexes()[i];
    }

    _dataOffset = _attributeResidentDataHeader->contentOffset;
  }
  //  content();
}