Пример #1
0
unsigned int DocFloatImageReader::readSpContainter(FSPContainer &item, unsigned int length, shared_ptr<OleStream> stream) {
	//OfficeArtSpContainter structure is described at p.53-55 [MS-ODRAW]
	RecordHeader header;
	unsigned int count = 0;
	while (count < length) {
		count += readRecordHeader(header, stream);
		switch (header.type) {
			case 0xF009: //skip OfficeArtFSPGR record, p.74 [MS-ODRAW]
				stream->seek(16, false);
				count += 16;
				break;
			case 0xF00A:
				count += readFSP(item.fsp, stream);
				break;
			case 0xF00B:
				count += readArrayFOPTE(item.fopte, header.length, stream);
				break;
			case 0xF00E: //OfficeArtAnchor
			case 0xF00F: //OfficeArtChildAnchor, p.75 [MS-ODRAW]
			case 0xF010: //OfficeArtClientAnchor
				stream->seek(4, false);
				count += 4;
				break;
			case 0xF00C:
			case 0xF11F:
			case 0xF11D:
				break;
			default:
				count += skipRecord(header, stream);
				break;
		}
	}
	return count;
}
Пример #2
0
unsigned int DocFloatImageReader::readDgContainer(OfficeArtContent &item, unsigned int length, shared_ptr<OleStream> stream) {
	//OfficeArtDgContainer structure is described at p.52 [MS-ODRAW]
	unsigned int count = 0;

	RecordHeader header;
	while (count < length) {
		count += readRecordHeader(header, stream);
		switch (header.type) {
			case 0xF008: //skip OfficeArtFDG record, p. 82 [MS-ODRAW]
				stream->seek(8, false);
				count += 8;
				break;
			case 0xF003:
				count += readSpgrContainer(item, header.length, stream);
				break;
			case 0xF004:
				{
					FSPContainer fspContainer;
					count += readSpContainter(fspContainer, header.length, stream);
					item.FSPs.push_back(fspContainer);
				}
				break;
			default:
				count += skipRecord(header, stream);
				break;
		}
	}
	return count;
}
Пример #3
0
unsigned int DocFloatImageReader::readBStoreContainerFileBlock(Blip &blip, shared_ptr<OleStream> stream, shared_ptr<OleStream> mainStream) {
	//OfficeArtBStoreContainerFileBlock structure is described at p.59 [MS-ODRAW]
	unsigned int count = readFBSE(blip.storeEntry, stream);
	if (blip.storeEntry.offsetInDelay != (unsigned int)-1) {
		if (mainStream->seek(blip.storeEntry.offsetInDelay, true)) { //see p.70 [MS-ODRAW]
			//TODO maybe we should stop reading float images here
			ZLLogger::Instance().println("DocPlugin", "DocFloatImageReader: problems with seeking for offset");
			return count;
		}
	}
	RecordHeader header;
	unsigned int count2 = readRecordHeader(header, mainStream);
	switch (header.type) {
		case OleMainStream::IMAGE_WMF:
		case OleMainStream::IMAGE_EMF:
		case OleMainStream::IMAGE_PICT:
			count2 += skipRecord(header, mainStream);
			break;
		case OleMainStream::IMAGE_JPEG:
		case OleMainStream::IMAGE_JPEG2:
		case OleMainStream::IMAGE_PNG:
		case OleMainStream::IMAGE_DIB:
		case OleMainStream::IMAGE_TIFF:
			count2 += readBlip(blip, header, mainStream);
			break;
	}
	blip.type = header.type;
	return count;
}
int ESMReaderFinderReferences::readNextRecord(std::ifstream& in_File, const uint32_t recName, const bool localized, const StringTable& table)
{
  SimplifiedReferenceRecord * recPtr;
  switch (recName)
  {
    case cCELL:
         {
           CellRecord recC;
           if (!recC.loadFromStream(in_File, localized, table))
             return -1;
           if (!reIndex(recC.headerFormID))
             return -1;
           Cells::getSingleton().addRecord(recC);
           return 1;
         }
         break;
    case cWRLD:
         {
           WorldSpaceRecord recW;
           if (!recW.loadFromStream(in_File, localized, table))
             return -1;
           if (!reIndex(recW.headerFormID))
             return -1;
           WorldSpaces::getSingleton().addRecord(recW);
           return 1;
         }
         break;
    case cREFR:
    case cACHR:
         recPtr = new SimplifiedReferenceRecord;
         break;
    default:
         return skipRecord(in_File);
         break;
  }//swi
  if (!recPtr->loadFromStream(in_File, localized, table))
  {
    delete recPtr;
    std::cout << "ESMReaderFinderReferences::readNextRecord: Error while reading reference record!\n";
    return -1;
  }
  //re-index record's form ID and ID of object
  if ((!reIndex(recPtr->headerFormID)) or (!reIndex(recPtr->baseObjectFormID)))
  {
    delete recPtr;
    return -1;
  }
  //save form IDs in refMap
  refMap[recPtr->baseObjectFormID].push_back(CellRefIDPair(m_CellStack.back(), recPtr->headerFormID));
  delete recPtr;
  return 1;
}
Пример #5
0
static void logmerge::outputLogfiles(log_queue& queue)
{
    int entries=0;

    while(!queue.empty()) {
        entries++;

        LogFile *lf=queue.top();
        assert(lf);
        lf->writeLine();
        skipRecord(queue);
    }

    std::cerr << "Read " << entries << " entries" << std::endl;
}
Пример #6
0
unsigned int DocFloatImageReader::readBStoreContainer(OfficeArtContent &item, unsigned int length, shared_ptr<OleStream> stream, shared_ptr<OleStream> mainStream) {
	//OfficeArtBStoreContainer structure is described at p.58 [MS-ODRAW]
	RecordHeader header;
	unsigned int count = 0;
	while (count < length) {
		count += readRecordHeader(header, stream);
		switch (header.type) {
			case 0xF007:
				{
					Blip blip;
					count += readBStoreContainerFileBlock(blip, stream, mainStream);
					item.blips.push_back(blip);
				}
				break;
			default:
				count += skipRecord(header, stream);
				break;
		}
	}
	return count;
}
Пример #7
0
unsigned int DocFloatImageReader::readDggContainer(OfficeArtContent &item, unsigned int length,  shared_ptr<OleStream> stream, shared_ptr<OleStream> mainStream) {
	//OfficeArtDggContainer structure is described at p.50 [MS-ODRAW]
	RecordHeader header;
	unsigned int count = 0;

	while (count < length) {
		count += readRecordHeader(header, stream);
		switch (header.type) {
			case 0xF001:
				count += readBStoreContainer(item, header.length, stream, mainStream);
				break;
			default:
				count += skipRecord(header, stream);
				break;
		}
	}

	stream->seek(1, false); //skipping dgglbl (see p.406 [MS-DOC])
	++count;

	return count;
}
Пример #8
0
		const char *skipRecord(const char *s, int *maxLength)
		{
			return reinterpret_cast<const char *>(skipRecord(reinterpret_cast<const uchar *>(s),
															 maxLength));
		}