当前位置: 首页>>代码示例>>C++>>正文


C++ ReadInt32函数代码示例

本文整理汇总了C++中ReadInt32函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadInt32函数的具体用法?C++ ReadInt32怎么用?C++ ReadInt32使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ReadInt32函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ReadInt32

  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;
  }
开发者ID:hamfirst,项目名称:stormsockets,代码行数:28,代码来源:StormMessageReaderCursor.cpp

示例2: ReadPACKDirectory

/*
 * 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;
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:38,代码来源:pakstuff.cpp

示例3: ReadInt8

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;
}
开发者ID:AThilenius,项目名称:VoxelCraft,代码行数:34,代码来源:VCFont.cpp

示例4: ReadInt32

// -------------------------------------
// 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;
}
开发者ID:senlinms,项目名称:EasyDarwin,代码行数:34,代码来源:QTAtom_stts.cpp

示例5: parse_dumptimes

/* 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);
}
开发者ID:bagdxk,项目名称:openafs,代码行数:29,代码来源:parsedump.c

示例6: parse_dumphdr

/* 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;
}
开发者ID:bagdxk,项目名称:openafs,代码行数:62,代码来源:parsedump.c

示例7: ReadInt32

sRect cBinaryFile::ReadSRect() {
    sRect tmpRect;
    tmpRect.x = ReadInt32();
    tmpRect.y = ReadInt32();
    tmpRect.w = ReadInt32();
    tmpRect.h = ReadInt32();
    return tmpRect;
}
开发者ID:master312,项目名称:StormFramework2D,代码行数:8,代码来源:cBinaryFile.cpp

示例8: _pm_checkPacketId

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;
}
开发者ID:TRocket,项目名称:gnuCraft,代码行数:9,代码来源:msg_0x27_attachentity_stc.cpp

示例9: ReadInt32

// -------------------------------------
// 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;
}
开发者ID:DreamZoom,项目名称:EasyDarwin,代码行数:60,代码来源:QTAtom_mdhd.cpp

示例10: _pm_checkPacketId

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;
}
开发者ID:TRocket,项目名称:gnuCraft,代码行数:9,代码来源:msg_0x16_collectitem_stc.cpp

示例11: _pm_checkPacketId

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;
}
开发者ID:TRocket,项目名称:gnuCraft,代码行数:9,代码来源:msg_0x2a_removeentityeffect_stc.cpp

示例12: ReadInt32

// -------------------------------------
// 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;
            }
        }
    }
开发者ID:ACEZLY,项目名称:EasyDarwin,代码行数:58,代码来源:QTAtom_stsd.cpp

示例13: ReadInt32

  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();
  }
开发者ID:hamfirst,项目名称:stormsockets,代码行数:12,代码来源:StormHttpBodyReader.cpp

示例14: _pm_checkPacketId

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;
}
开发者ID:TRocket,项目名称:gnuCraft,代码行数:12,代码来源:msg_0x47_spawnglobalentity_stc.cpp

示例15: nf_getparameter

uint32 nf_getparameter(int i)
{
	if (i < 0)
		return 0;

	return ReadInt32(context + i*4);
}
开发者ID:bobek,项目名称:aranym-debian,代码行数:7,代码来源:natfeats.cpp


注:本文中的ReadInt32函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。