• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ReadInt32函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Read7BitEncodedInt

// 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();
}
开发者ID:jlyonsmith,项目名称:ParseXnb,代码行数:35,代码来源:ContentReader.cpp


示例17: parse_weekuse

/* 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);
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:33,代码来源:parsevol.c


示例18: ReadData

bool AtomMFHD::ReadData() {
	if (!ReadInt32(_sequenceNumber)) {
		FATAL("Unable to read creation time");
		return false;
	}
	return true;
}
开发者ID:OpenQCam,项目名称:qcam,代码行数:7,代码来源:atommfhd.cpp


示例19: printf

//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;
}
开发者ID:colistro123,项目名称:Nightfire-iniMod,代码行数:30,代码来源:gamemodes.cpp


示例20: ASSERT

float ReadStream::ReadFloat()
{
	int32 value;
	ASSERT(sizeof(float) == sizeof(value));
	value = ReadInt32();
	return *(float*)&value;
}
开发者ID:Kurukshetran,项目名称:monsterhome,代码行数:7,代码来源:RWStreams.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ReadKey函数代码示例发布时间:2022-05-30
下一篇:
C++ ReadInt16LE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap