Пример #1
0
/*
 * The ebscClass class contructor (EBSC table)
 */
ebscClass *New_ebscClass( tsiMemObject *mem, InputStream *in )
{
	F16Dot16 version;
	register int i, j;
	ebscClass *t = NULL;
	
	version			= ReadInt32(in);
	
	/* Assume we understand this version number range. */
	if ( version >= 0x00020000 && version < 0x00030000 ) {
		t 				= (ebscClass *) tsi_AllocMem( mem, sizeof( ebscClass ) );
		t->mem			= mem;

		t->version		= version;
		t->numSizes		= (tt_uint32)ReadInt32(in);
		
        t->table = (bitmapScaleEntry *) tsi_AllocArray(mem, t->numSizes, sizeof(bitmapScaleEntry));
		for ( i = 0; i < (int)t->numSizes; i++ ) {
			for ( j = 0; j < NUM_SBIT_METRICS_BYTES; j++ ) {
				t->table[i].hori[j] = ReadUnsignedByteMacro( in );
			}
			for ( j = 0; j < NUM_SBIT_METRICS_BYTES; j++ ) {
				t->table[i].vert[j] = ReadUnsignedByteMacro( in );
			}
			t->table[i].ppemX			= ReadUnsignedByteMacro( in );
			t->table[i].ppemY			= ReadUnsignedByteMacro( in );
			t->table[i].substitutePpemX	= ReadUnsignedByteMacro( in );
			t->table[i].substitutePpemY	= ReadUnsignedByteMacro( in );
		}
	}
	return t; /*****/
}
  uint64_t StormMessageReaderCursor::ReadInt64()
  {
    if (m_DataLength < 8)
    {
      throw std::runtime_error("Read buffer underflow");
    }

    if (m_ReadOffset + 8 > m_FixedBlockSize)
    {
      uint64_t v1 = ReadInt32();
      uint64_t v2 = ReadInt32();

      return (uint64_t)((v2 << 32) | v1);
    }

    uint64_t v = Marshal::ReadInt64(m_CurBlock, m_ReadOffset);

    m_ReadOffset += 8;
    m_DataLength -= 8;

    if (m_ReadOffset >= m_FixedBlockSize)
    {
      m_CurBlock = m_Allocator->GetNextBlock(m_CurBlock);
      m_ReadOffset = 0;
    }

    return v;
  }
Пример #3
0
/*
 * Read the PACK directory into memory.  The optional offset to the
 * start of the PACK file is given in "offset".  The number of files in
 * the directory is returned in *dirsize_r.
 */
PACKDirPtr ReadPACKDirectory(FILE *packfile, UInt32 offset, UInt16 *dirsize_r)
{
  PACKDirPtr dir;
  UInt32     pos, size;
  UInt16     max, i;

  *dirsize_r = 0;
  if (packfile == NULL)
    return NULL;
  if ((fseek(packfile, offset, SEEK_SET) < 0)
      || (ReadMagic(packfile) != FTYPE_PACK)
      || (ReadInt32(packfile, &pos) == FALSE)
      || (ReadInt32(packfile, &size) == FALSE)
      || (size == 0L)
      || (size / sizeof(struct PACKDirectory) > 65535L)
      || (fseek(packfile, offset + pos, SEEK_SET) < 0))
    return NULL;
  dir = (PACKDirPtr)__qmalloc(size);
  max = (UInt16)(size / sizeof(struct PACKDirectory));
  for (i = 0; i < max; i++)
    {
      if (ReadBytes(packfile, &dir[i], sizeof(struct PACKDirectory)) == FALSE)
	{
	  free(dir);
	  return NULL;
	}
      ConvertFilePath(dir[i].name);
      dir[i].offset = SwapInt32(dir[i].offset);
      dir[i].size = SwapInt32(dir[i].size);
    }
  *dirsize_r = max;
  return dir;
}
Пример #4
0
bool VCFont::ParseKerning(std::ifstream& f)
{
	char blockType = ReadInt8(f);
	int blockSize = ReadInt32(f);

	int kerningCount = blockSize / 10;

	// Pre-Buffer data ( Used to be a bottleneck - Profiled )
	KerningPairIMR* pairsIMR = (KerningPairIMR*) malloc (sizeof(KerningPairIMR) * kerningCount);
	int size = sizeof(KerningPairIMR);
	//f.read((char*)pairsIMR, sizeof(KerningPairIMR) * kerningCount);

	for ( int i = 0; i < kerningCount; i++ )
	{
		// Truncated Endian swap ( Truncated to 8 bits, hopefully enough )
		//KerningPairIMR p = pairsIMR[i];
		//p.first = p.first >> 28;
		//p.second = p.second >> 28;
		//p.ammount = p.ammount >> 8;
		//
		//Charaters[p.second].KerningPairs[p.first] = p.ammount;
		unsigned int first = ReadInt32(f);
		unsigned int second = ReadInt32(f);
		short ammount = ReadInt16(f);
		//Int8 sh = 0;

		Charaters[second].KerningPairs[first] = ammount;

	}

	free(pairsIMR);

	return true;
}
Пример #5
0
// -------------------------------------
// Initialization functions
//
bool QTAtom_ctts::Initialize()
{
	// Temporary vars
	UInt32      tempInt32;


	//
	// Parse this atom's fields.
	ReadInt32(cttsPos_VersionFlags, &tempInt32);
	fVersion = (UInt8)((tempInt32 >> 24) & 0x000000ff);
	fFlags = tempInt32 & 0x00ffffff;

	ReadInt32(cttsPos_NumEntries, &fNumEntries);

	//
	// Validate the size of the sample table.
	if ((UInt32)(fNumEntries * 8) != (fTOCEntry.AtomDataLength - 8))
		return false;

	//
	// Read in the time-to-sample table.
	fTimeToSampleTable = new char[fNumEntries * 8];
	if (fTimeToSampleTable == NULL)
		return false;

	ReadBytes(cttsPos_SampleTable, fTimeToSampleTable, fNumEntries * 8);

	//
	// This atom has been successfully read in.
	return true;
}
Пример #6
0
/* Parse and store the dump time range from a dump header */
static afs_uint32
parse_dumptimes(XFILE * X, unsigned char *tag, tagged_field * field,
		afs_uint32 value, tag_parse_info * pi, void *g_refcon,
		void *l_refcon)
{
    dump_parser *p = (dump_parser *) g_refcon;
    afs_dump_header *hdr = (afs_dump_header *) l_refcon;
    afs_uint16 count;
    afs_uint32 r;

    if ((r = ReadInt16(X, &count)))
	return r;
    if (count != 2) {
	if (p->cb_error)
	    (p->cb_error) (DSERR_FMT, 1, p->err_refcon,
			   "Incorrect array count (%d) in dump times", count);
	return DSERR_FMT;
    }
    if ((r = ReadInt32(X, &hdr->from_date)))
	return r;
    if ((r = ReadInt32(X, &hdr->to_date)))
	return r;
    hdr->field_mask |= (F_DUMPHDR_FROM | F_DUMPHDR_TO);
    if (p->print_flags & DSPRINT_DUMPHDR)
	printf("%s%d => %d\n", field->label, hdr->from_date, hdr->to_date);

    return ReadByte(X, tag);
}
Пример #7
0
/* Parse a dump header, including its tagged attributes, and call the
 * dump-header callback, if one is defined.
 */
static afs_uint32
parse_dumphdr(XFILE * X, unsigned char *tag, tagged_field * field,
	      afs_uint32 value, tag_parse_info * pi, void *g_refcon,
	      void *l_refcon)
{
    dump_parser *p = (dump_parser *) g_refcon;
    afs_dump_header hdr;
    dt_uint64 where;
    afs_uint32 r;

    memset(&hdr, 0, sizeof(hdr));
    if ((r = xftell(X, &where)))
	return r;
    sub64_32(hdr.offset, where, 1);

    if ((r = ReadInt32(X, &hdr.magic)))
	return r;
    if ((r = ReadInt32(X, &hdr.version)))
	return r;

    if (hdr.magic != DUMPBEGINMAGIC) {
	if (p->cb_error)
	    (p->cb_error) (DSERR_MAGIC, 1, p->err_refcon,
			   "Invalid magic number (0x%08x) in dump header",
			   hdr.magic);
	return DSERR_MAGIC;
    }
    if (hdr.version != DUMPVERSION) {
	if (p->cb_error)
	    (p->cb_error) (DSERR_MAGIC, 1, p->err_refcon,
			   "Unknown dump format version (%d) in dump header",
			   hdr.version);
	return DSERR_MAGIC;
    }

    if (p->print_flags & DSPRINT_DUMPHDR)
	printf("%s [%s = 0x%s]\n", field->label,
	       decimate_int64(&hdr.offset, 0), hexify_int64(&hdr.offset, 0));
    if (p->print_flags & DSPRINT_DUMPHDR) {
	printf(" Magic number: 0x%08x\n", hdr.magic);
	printf(" Version:      %d\n", hdr.version);
    }
    r = ParseTaggedData(X, dumphdr_fields, tag, pi, g_refcon, (void *)&hdr);

    if (!r && p->cb_dumphdr) {
	r = xftell(X, &where);
	if (!r)
	    r = (p->cb_dumphdr) (&hdr, X, p->refcon);
	if (p->flags & DSFLAG_SEEK) {
	    if (!r)
		r = xfseek(X, &where);
	    else
		xfseek(X, &where);
	}
    }
    if (hdr.field_mask & F_DUMPHDR_VOLNAME)
	free(hdr.volname);
    return r;
}
Пример #8
0
sRect cBinaryFile::ReadSRect() {
    sRect tmpRect;
    tmpRect.x = ReadInt32();
    tmpRect.y = ReadInt32();
    tmpRect.w = ReadInt32();
    tmpRect.h = ReadInt32();
    return tmpRect;
}
size_t AttachEntity::deserialize(const Buffer& _src, size_t _offset)
{
	_offset = _pm_checkPacketId(_src, _offset);

	_offset = ReadInt32(_src, _offset, _pf_entityId);
	_offset = ReadInt32(_src, _offset, _pf_vehicleId);
	_pf_initialized = true;
	return _offset;
}
Пример #10
0
// -------------------------------------
// Initialization functions
//
Bool16 QTAtom_mdhd::Initialize()
{
    // Temporary vars
    UInt32      tempInt32;

    //
    // Parse this atom's fields.
    ReadInt32(mdhdPos_VersionFlags, &tempInt32);
    fVersion = (UInt8)((tempInt32 >> 24) & 0x000000ff);
    fFlags = tempInt32 & 0x00ffffff;

    if (0 == fVersion)
    {
        // Verify that this atom is the correct length.
        if( fTOCEntry.AtomDataLength != 24 )
        {
            DEEP_DEBUG_PRINT(("QTAtom_mdhd::Initialize failed. Expected AtomDataLength == 24 version: %d AtomDataLength: %" _64BITARG_ "u\n",fVersion, fTOCEntry.AtomDataLength));
            return false;
        }

        ReadInt32To64(mdhdPos_CreationTime, &fCreationTime);
        ReadInt32To64(mdhdPos_ModificationTime, &fModificationTime);
        ReadInt32(mdhdPos_TimeScale, &fTimeScale);
        ReadInt32To64(mdhdPos_Duration, &fDuration);
        ReadInt16(mdhdPos_Language, &fLanguage);
        ReadInt16(mdhdPos_Quality, &fQuality);
    }
    else if (1 == fVersion)
    {
        // Verify that this atom is the correct length.
        if( fTOCEntry.AtomDataLength != 36 )
        {
            DEEP_DEBUG_PRINT(("QTAtom_mdhd::Initialize failed. Expected AtomDataLength == 36 version: %d AtomDataLength: %" _64BITARG_ "u\n",fVersion, fTOCEntry.AtomDataLength));
            return false;
        }

        ReadInt64(mdhdPosV1_CreationTime, &fCreationTime);
        ReadInt64(mdhdPosV1_ModificationTime, &fModificationTime);
        ReadInt32(mdhdPosV1_TimeScale, &fTimeScale);
        ReadInt64(mdhdPosV1_Duration, &fDuration);
        ReadInt16(mdhdPosV1_Language, &fLanguage);
        ReadInt16(mdhdPosV1_Quality, &fQuality);
    }
    else
    {
        DEEP_DEBUG_PRINT(("QTAtom_mdhd::Initialize  failed. Version unsupported: %d\n",fVersion));
        return false;
    }

    //
    // Compute the reciprocal of the timescale.
    fTimeScaleRecip = 1 / (Float64)fTimeScale;
    
    //
    // This atom has been successfully read in.
    return true;
}
Пример #11
0
size_t CollectItem::deserialize(const Buffer& _src, size_t _offset)
{
	_offset = _pm_checkPacketId(_src, _offset);

	_offset = ReadInt32(_src, _offset, _pf_collectedEID);
	_offset = ReadInt32(_src, _offset, _pf_collectorEID);
	_pf_initialized = true;
	return _offset;
}
size_t RemoveEntityEffect::deserialize(const Buffer& _src, size_t _offset)
{
	_offset = _pm_checkPacketId(_src, _offset);

	_offset = ReadInt32(_src, _offset, _pf_entityId);
	_offset = ReadInt32(_src, _offset, _pf_effectId);
	_pf_initialized = true;
	return _offset;
}
Пример #13
0
// -------------------------------------
// Initialization functions
//
Bool16 QTAtom_stsd::Initialize(void)
{
    // Temporary vars
    UInt32      tempInt32;

    // General vars
    char        *pSampleDescriptionTable;


    //
    // Parse this atom's fields.
    ReadInt32(stsdPos_VersionFlags, &tempInt32);
    fVersion = (UInt8)((tempInt32 >> 24) & 0x000000ff);
    fFlags = tempInt32 & 0x00ffffff;

    ReadInt32(stsdPos_NumEntries, &fNumEntries);

    //
    // Read in all of the sample descriptions.
    if( fNumEntries > 0 ) {
        //
        // Allocate our description tables.
        UInt64 tableSize = fTOCEntry.AtomDataLength - 8;
		Assert(tableSize < kSInt32_Max);
        fSampleDescriptionTable = NEW char[ (SInt32) tableSize];
        if( fSampleDescriptionTable == NULL )
            return false;
        
        fTable = NEW char *[fNumEntries];
        if( fTable == NULL )
            return false;
        
        //
        // Read in the sample description table.
        ReadBytes(stsdPos_SampleTable, fSampleDescriptionTable, (UInt32) tableSize);

        //
        // Read them all in..
        pSampleDescriptionTable = fSampleDescriptionTable;
        char        *maxSampleDescriptionPtr = pSampleDescriptionTable + tableSize;
        for( UInt32 CurDesc = 0; CurDesc < fNumEntries; CurDesc++ ) {
            //
            // Associate this entry in our Table with the actual location of
            // this sample description.
            fTable[CurDesc] = pSampleDescriptionTable;
            
            //
            // Skip over this mini-atom.
            memcpy(&tempInt32, pSampleDescriptionTable, 4);
            pSampleDescriptionTable += ntohl(tempInt32);
            if (pSampleDescriptionTable > maxSampleDescriptionPtr)
            {   return false;
            }
        }
    }
Пример #14
0
  uint64_t StormHttpBodyReader::ReadInt64()
  {
    if (m_Reader.GetRemainingLength() < 8)
    {
      uint64_t v1 = ReadInt32() & 0xFFFFFFFF;
      uint64_t v2 = ReadInt32() & 0xFFFFFFFF;

      return (uint64_t)((v2 << 32) | v1);
    }

    return m_Reader.ReadInt64();
  }
size_t SpawnGlobalEntity::deserialize(const Buffer& _src, size_t _offset)
{
	_offset = _pm_checkPacketId(_src, _offset);

	_offset = ReadInt32(_src, _offset, _pf_entityId);
	_offset = ReadInt8(_src, _offset, _pf_type);
	_offset = ReadInt32(_src, _offset, _pf_x);
	_offset = ReadInt32(_src, _offset, _pf_y);
	_offset = ReadInt32(_src, _offset, _pf_z);
	_pf_initialized = true;
	return _offset;
}
Пример #16
0
bool VCFont::ParseCharacters(std::ifstream& f)
{
	char blockType = ReadInt8(f);
	int blockSize = ReadInt32(f);

	int charCount = blockSize / 20;

	for ( int i = 0; i < charCount; i++ )
	{
		unsigned int id = ReadInt32(f);
		f.read((char*) &Charaters[id], 16);
	}

	return true;
}
Пример #17
0
void FSEQFile::Load(const std::string& filename)
{
    Close();

    _fh = new wxFile(filename);

    if (_fh->IsOpened())
    {
        char tag[5];
        memset(tag, 0x00, sizeof(tag));
        _fh->Read(tag, sizeof(tag)-1);
        if (std::string(tag) == "PSEQ")
        {
            _frame0Offset = ReadInt16(_fh);
            _fh->Read(&_minorVersion, sizeof(_minorVersion));
            _fh->Read(&_majorVersion, sizeof(_majorVersion));
            ReadInt16(_fh); // fixed header length
            _channelsPerFrame = ReadInt32(_fh);
            _frames = ReadInt32(_fh);
            _frameMS = ReadInt16(_fh);
            ReadInt16(_fh); // universes
            ReadInt16(_fh); // universe size
            _gamma = _fh->Read(&_gamma, sizeof(_gamma));
            _fh->Read(&_colourEncoding, sizeof(_colourEncoding));
            ReadInt16(_fh); // fill
            int mediafilenamelength = ReadInt16(_fh);
            if (mediafilenamelength > 0)
            {
                char* buf = (char*)malloc(mediafilenamelength + 1);
                memset(buf, 0x00, mediafilenamelength + 1);
                ReadInt16(_fh); // mf
                _fh->Read(buf, mediafilenamelength);
                _audiofilename = std::string(buf);
                free(buf);
            }
            _currentFrame = 0;
            _frameBuffer = (wxByte*)malloc(_channelsPerFrame);
        }
        else
        {
            Close();
        }
    }
    else
    {
        Close();
    }
}
Пример #18
0
uint32 nf_getparameter(int i)
{
	if (i < 0)
		return 0;

	return ReadInt32(context + i*4);
}
Пример #19
0
// Reads the manifest of what types are contained in this XNB file.
void ContentReader::ReadTypeManifest()
{
    Log.WriteLine("Type readers:");
    Log.Indent();

    // How many type readers does this .xnb use?
    uint32_t typeReaderCount = Read7BitEncodedInt();

    typeReaders.clear();

    for (uint32_t i = 0; i < typeReaderCount; i++)
    {
        // Read the type reader metadata.
        wstring readerName = ReadString();
        int32_t readerVersion = ReadInt32();

        Log.WriteLine("%S (version %d)", readerName.c_str(), readerVersion);

        // Look up and store this type reader implementation class.
        TypeReader* reader = typeReaderManager->GetByReaderName(readerName);

        typeReaders.push_back(reader);
    }

    // Initialize the readers in a separate pass after they are all registered, in case there are
    // circular dependencies between them (eg. an array of classes which themselves contain arrays).
    for (vector<TypeReader*>::iterator iter = typeReaders.begin(); iter != typeReaders.end(); iter++)
    {
    	TypeReader* reader = *iter;
        reader->Initialize(typeReaderManager);
    }

    Log.Unindent();
}
Пример #20
0
/* Parse and store the week use data from a volume header */
static afs_uint32
parse_weekuse(XFILE * X, unsigned char *tag, tagged_field * field,
	      afs_uint32 value, tag_parse_info * pi, void *g_refcon,
	      void *l_refcon)
{
    dump_parser *p = (dump_parser *) g_refcon;
    afs_vol_header *hdr = (afs_vol_header *) l_refcon;
    afs_uint16 count;
    afs_uint32 r;
    unsigned int i;

    if (r = ReadInt16(X, &count))
	return r;
    if (count != 7) {
	if (p->cb_error)
	    (p->cb_error) (DSERR_FMT, 1, p->err_refcon,
			   "Incorrect array count (%d) in weekuse data",
			   count);
	return DSERR_FMT;
    }
    for (i = 0; i < count; i++)
	if (r = ReadInt32(X, hdr->weekuse + i))
	    return r;
    hdr->field_mask |= F_VOLHDR_WEEKUSE;
    if (p->print_flags & DSPRINT_VOLHDR) {
	printf("%s%10d %10d %10d %10d\n", field->label, hdr->weekuse[0],
	       hdr->weekuse[1], hdr->weekuse[2], hdr->weekuse[3]);
	printf("%s%10d %10d %10d\n", field->label, hdr->weekuse[4],
	       hdr->weekuse[5], hdr->weekuse[6]);
    }
    return ReadByte(X, tag);
}
Пример #21
0
bool AtomMFHD::ReadData() {
	if (!ReadInt32(_sequenceNumber)) {
		FATAL("Unable to read creation time");
		return false;
	}
	return true;
}
Пример #22
0
//General "Network" / Gamemode AMX Code
void CNetwork::OnServerChangeMap() {
	printf("OnServerChangeMap() has been called.\n");
	int idx;
	cell ret = 0;
	CBaseEntity *entity = new CBaseEntity;
	Precache *precache = new Precache;

	CBasePlayer *pPlayer = new CBasePlayer();
	//Dump all the clients from the table because the map was changed..
	for(size_t i=0; i<ReadInt32(SVS_MAXCLIENTS); i++) {
		if(pPlayer->IsClientConnected(i)) {
			if(pPlayer->IsClientOnTable(i)) {
				OnClientDisconnect(i, REASON_MAPCHANGE);
			}
		}
	}
	delete pPlayer;
	//amx push would go below here.. (So we can push the OnServerChangeMap data to the loaded AMX script later)
	if (!amx_FindPublic(&inimod_amx, "OnServerChangeMap", &idx)) {
		amx_Exec(&inimod_amx, &ret, idx);
		precache->PreloadCached(false); //Don't delete anything the users precached..
	}
	if((long)ret == 1) {
		printf("ret returned %d\n", ret);
	}
	entity->OnServerChangeMap();
	delete entity;
	delete precache;
}
Пример #23
0
float ReadStream::ReadFloat()
{
	int32 value;
	ASSERT(sizeof(float) == sizeof(value));
	value = ReadInt32();
	return *(float*)&value;
}
Пример #24
0
bool DataIndex::DecodeFromString(const std::string &str) {
    if (!StringStartsWith(str, kIndexBlockMagic)) {
        LOG(ERROR)<< "invalid data index header";
        return false;
    }
    block_info_.clear();
    const char *begin = str.c_str() + kIndexBlockMagic.size();
    const char *end = str.c_str() + str.size();
    while (begin < end) {
        DataBlockInfo info;
        info.offset = ReadInt64(&begin);
        info.data_size = ReadInt32(&begin);
        int key_len = ReadVint(&begin, end);
        info.key = std::string(begin, key_len);
        begin += key_len;
        block_info_.push_back(info);
    }
    // Check if the content is overflow
    if (begin > end) {
        LOG(ERROR) << "incomplete file, "
        << StringPrint("begin: %p, end: %p", begin, end);
        return false;
    }
    return true;
}
Пример #25
0
size_t SpawnObject::deserialize(const Buffer& _src, size_t _offset)
{
	_offset = _pm_checkPacketId(_src, _offset);

	_offset = ReadInt32(_src, _offset, _pf_entityId);
	_offset = ReadInt8(_src, _offset, _pf_type);
	_offset = ReadInt32(_src, _offset, _pf_x);
	_offset = ReadInt32(_src, _offset, _pf_y);
	_offset = ReadInt32(_src, _offset, _pf_z);
	_offset = ReadInt8(_src, _offset, _pf_pitch);
	_offset = ReadInt8(_src, _offset, _pf_yaw);
	_offset = _pf_objectData.deserialize(_src, _offset);

	_pf_initialized = true;
	return _offset;
}
Пример #26
0
static void CAL_SetupAudioFile()
{
	int handle;
	long length;
	char fname[13];
	int i;
	
	strcpy(fname, aheadname);
	strcat(fname, extension);

	handle = OpenRead(fname);
	if (handle == -1)
		CA_CannotOpen(fname);
	
	length = ReadLength(handle);
	
	MM_GetPtr((memptr)&audiostarts, length);
	
	for (i = 0; i < (length/4); i++)
		audiostarts[i] = ReadInt32(handle);

	CloseRead(handle);	

/* open the data file */

	strcpy(fname, afilename);
	strcat(fname, extension);

	audiohandle = OpenRead(fname);
	if (audiohandle == -1)
		CA_CannotOpen(fname);
}
Пример #27
0
// -------------------------------------
// Initialization functions
//
Bool16 QTAtom_stsz::Initialize(void)
{
    // Temporary vars
    UInt32      tempInt32;


    //
    // Parse this atom's fields.
    ReadInt32(stszPos_VersionFlags, &tempInt32);
    fVersion = (UInt8)((tempInt32 >> 24) & 0x000000ff);
    fFlags = tempInt32 & 0x00ffffff;

    ReadInt32(stszPos_SampleSize, &fCommonSampleSize);
    
    //
    // We don't need to read in the table (it doesn't exist anyway) if the
    // SampleSize field is non-zero.
    if( fCommonSampleSize != 0 )
        return true;


    //
    // Build the table..
    ReadInt32(stszPos_NumEntries, &fNumEntries);

    //
    // Validate the size of the sample table.
    if( (UInt32)(fNumEntries * 4) != (fTOCEntry.AtomDataLength - 12) )
        return false;

    //
    // Read in the sample size table.
    fSampleSizeTable = NEW char[(fNumEntries * 4) + 1];
    if( fSampleSizeTable == NULL )
        return false;
    
    if( ((PointerSizedInt)fSampleSizeTable & (PointerSizedInt)0x3) == 0)
        fTable = (UInt32 *)fSampleSizeTable;
    else
        fTable = (UInt32 *)(((PointerSizedInt)fSampleSizeTable + 4) & ~((PointerSizedInt)0x3));
    
    ReadBytes(stszPos_SampleTable, (char *)fTable, fNumEntries * 4);

    //
    // This atom has been successfully read in.
    return true;
}
Пример #28
0
float InteropInputStream::ReadFloat()
{
    BinaryInt32Float u;

    u.i = ReadInt32();

    return u.f;
}
Пример #29
0
size_t EntityStatus::deserialize(const Buffer& _src, size_t _offset)
{
	_offset = _pm_checkPacketId(_src, _offset);

	_offset = ReadInt32(_src, _offset, _pf_entityId);
	_offset = ReadInt8(_src, _offset, _pf_entityStatus);
	_pf_initialized = true;
	return _offset;
}
Пример #30
0
bool VCFont::ParseCommon(std::ifstream& f)
{
	char blockType = ReadInt8(f);
	int blockSize = ReadInt32(f);

	f.read((char*) &Common, 15);
	
	return true;
}