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

C++ readU32函数代码示例

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

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



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

示例1: readU8

void ToolCapabilities::deSerialize(std::istream &is)
{
	int version = readU8(is);
	if(version != 1 && version != 2) throw SerializationError(
			"unsupported ToolCapabilities version");
	full_punch_interval = readF1000(is);
	max_drop_level = readS16(is);
	groupcaps.clear();
	u32 groupcaps_size = readU32(is);
	for(u32 i=0; i<groupcaps_size; i++){
		std::string name = deSerializeString(is);
		ToolGroupCap cap;
		cap.uses = readS16(is);
		cap.maxlevel = readS16(is);
		u32 times_size = readU32(is);
		for(u32 i=0; i<times_size; i++){
			int level = readS16(is);
			float time = readF1000(is);
			cap.times[level] = time;
		}
		groupcaps[name] = cap;
	}
	if(version == 2)
	{
		u32 damage_groups_size = readU32(is);
		for(u32 i=0; i<damage_groups_size; i++){
			std::string name = deSerializeString(is);
			s16 rating = readS16(is);
			damageGroups[name] = rating;
		}
	}
}
开发者ID:0gb-us,项目名称:minetest,代码行数:32,代码来源:tool.cpp


示例2: readU32

void libvisio::VSDMetaData::readPropertySetStream(librevenge::RVNGInputStream *input)
{
  // ByteOrder
  input->seek(2, librevenge::RVNG_SEEK_CUR);
  // Version
  input->seek(2, librevenge::RVNG_SEEK_CUR);
  // SystemIdentifier
  input->seek(4, librevenge::RVNG_SEEK_CUR);
  // CLSID
  input->seek(16, librevenge::RVNG_SEEK_CUR);
  // NumPropertySets
  input->seek(4, librevenge::RVNG_SEEK_CUR);
  // FMTID0
  //input->seek(16, librevenge::RVNG_SEEK_CUR);
  uint32_t data1 = readU32(input);
  uint16_t data2 = readU16(input);
  uint16_t data3 = readU16(input);
  uint8_t data4[8];
  for (int i = 0; i < 8; i++)
  {
    data4[i] = readU8(input);
  }
  char FMTID0[36];
  sprintf(FMTID0, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", data1, data2, data3,
          data4[0], data4[1], data4[2], data4[3], data4[4], data4[5], data4[6], data4[7]);

  uint32_t offset0 = readU32(input);
  readPropertySet(input, offset0, FMTID0);
}
开发者ID:androidfan0,项目名称:libvisio,代码行数:29,代码来源:VSDMetaData.cpp


示例3: readU32

void libvisio::VSDMetaData::readPropertySetStream(librevenge::RVNGInputStream *input)
{
  // ByteOrder
  input->seek(2, librevenge::RVNG_SEEK_CUR);
  // Version
  input->seek(2, librevenge::RVNG_SEEK_CUR);
  // SystemIdentifier
  input->seek(4, librevenge::RVNG_SEEK_CUR);
  // CLSID
  input->seek(16, librevenge::RVNG_SEEK_CUR);
  // NumPropertySets
  input->seek(4, librevenge::RVNG_SEEK_CUR);
  // FMTID0
  //input->seek(16, librevenge::RVNG_SEEK_CUR);
  uint32_t data1 = readU32(input);
  uint16_t data2 = readU16(input);
  uint16_t data3 = readU16(input);
  uint8_t data4[8];
  for (unsigned char &i : data4)
  {
    i = readU8(input);
  }
  // Pretty-printed GUID is 36 bytes + the terminating null-character.
  char FMTID0[37];
  sprintf(FMTID0, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", data1, data2, data3,
          data4[0], data4[1], data4[2], data4[3], data4[4], data4[5], data4[6], data4[7]);

  uint32_t offset0 = readU32(input);
  readPropertySet(input, offset0, FMTID0);
}
开发者ID:LibreOffice,项目名称:libvisio,代码行数:30,代码来源:VSDMetaData.cpp


示例4: assert

/*
	Parse voice header chunk.
*/
status IFFFile::parseVHDR(const Tag &type, size_t size)
{
	assert(type == "VHDR");

	Track *track = getTrack();

	uint32_t oneShotSamples, repeatSamples, samplesPerRepeat;
	uint16_t sampleRate;
	uint8_t octaves, compression;
	uint32_t volume;

	readU32(&oneShotSamples);
	readU32(&repeatSamples);
	readU32(&samplesPerRepeat);
	readU16(&sampleRate);
	readU8(&octaves);
	readU8(&compression);
	readU32(&volume);

	track->f.sampleWidth = 8; 
	track->f.sampleRate = sampleRate;
	track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP;
	track->f.compressionType = AF_COMPRESSION_NONE;
	track->f.byteOrder = AF_BYTEORDER_BIGENDIAN;
	track->f.channelCount = 1;

	track->f.framesPerPacket = 1;
	track->f.computeBytesPerPacketPCM();

	_af_set_sample_format(&track->f, track->f.sampleFormat, track->f.sampleWidth);

	return AF_SUCCEED;
}
开发者ID:Distrotech,项目名称:audiofile,代码行数:36,代码来源:IFF.cpp


示例5: getTrack

/* Parse an adtl sub-chunk within a LIST chunk. */
status WAVEFile::parseADTLSubChunk(const Tag &id, uint32_t size)
{
	Track *track = getTrack();

	AFfileoffset endPos = fh->tell() + size;

	while (fh->tell() < endPos)
	{
		Tag chunkID;
		uint32_t chunkSize;

		readTag(&chunkID);
		readU32(&chunkSize);

		if (chunkID == "labl" || chunkID == "note")
		{
			uint32_t id;
			long length=chunkSize-4;
			char *p = (char *) _af_malloc(length);

			readU32(&id);
			fh->read(p, length);

			Marker *marker = track->getMarker(id);

			if (marker)
			{
				if (chunkID == "labl")
				{
					free(marker->name);
					marker->name = p;
				}
				else if (chunkID == "note")
				{
					free(marker->comment);
					marker->comment = p;
				}
				else
					free(p);
			}
			else
				free(p);

			/*
				If chunkSize is odd, skip an extra byte
				at the end of the chunk.
			*/
			if ((chunkSize % 2) != 0)
				fh->seek(1, File::SeekFromCurrent);
		}
		else
		{
			/* If chunkSize is odd, skip an extra byte. */
			fh->seek(chunkSize + (chunkSize % 2), File::SeekFromCurrent);
		}
	}
	return AF_SUCCEED;
}
开发者ID:matthiasr,项目名称:audiofile,代码行数:59,代码来源:WAVE.cpp


示例6: readU32

status SampleVisionFile::parseLoops()
{
	for (int i=0; i<8; i++)
	{
		uint32_t startFrame, endFrame;
		uint8_t type;
		uint16_t count;
		readU32(&startFrame);
		readU32(&endFrame);
		readU8(&type);
		readU16(&count);
	}
	return AF_SUCCEED;
}
开发者ID:RedDwarf69,项目名称:audiofile,代码行数:14,代码来源:SampleVision.cpp


示例7: readString

static plString readString(const unsigned char*& buffer, size_t& size) {
    size_t len = readU32(buffer, size);
    plString v = plString((pl_wchar_t*)buffer, (len-1) / sizeof(pl_wchar_t));
    buffer += len;
    size -= len;
    return v;
}
开发者ID:GPNMilano,项目名称:libhsplasma,代码行数:7,代码来源:pnVaultNode.cpp


示例8: readU32

bool WPGHeader::load(WPXInputStream *input)
{
	input->seek(0, WPX_SEEK_SET);
	
	size_t n = 0;
	unsigned char * prefix = (unsigned char *) input->read(26, n);
	if(n < 26)
        return false;
	
	m_identifier[0] = prefix[0];  
	m_identifier[1] = prefix[1];  
	m_identifier[2] = prefix[2];  
	m_identifier[3] = prefix[3];  
	m_startOfDocument = readU32(prefix+4);
	m_productType = prefix[8];
	m_fileType = prefix[9];
	m_majorVersion = prefix[10];
	m_minorVersion = prefix[11];
	m_encryptionKey = readU16(prefix+12);
	m_startOfPacketData = readU16(prefix+14);
	
	WPG_DEBUG_MSG(("Header Identifier  = %c%c%c\n", m_identifier[1], 
	m_identifier[2], m_identifier[3]));
	WPG_DEBUG_MSG(("Product type       = 0x%x\n",  m_productType));
	WPG_DEBUG_MSG(("File type          = 0x%x\n",  m_fileType));
	WPG_DEBUG_MSG(("Major version      = 0x%x\n",  m_majorVersion));
	WPG_DEBUG_MSG(("Minor version      = 0x%x\n",  m_minorVersion));
	WPG_DEBUG_MSG(("Encryption key     = 0x%x\n",  m_encryptionKey));
	
	return true;
}
开发者ID:JLuc,项目名称:scribus,代码行数:31,代码来源:WPGHeader.cpp


示例9: gethostid

int FClient::requestID(const char *desc)
{
	int socketfd;
	unsigned char buf[128];
	int i;
	unsigned int uret;
	FILE *f;
	int hid;

	hid = gethostid();

	/* connect to the server */
	socketfd = connectServer();
	if (socketfd<0) {
		return 0;
	}
	
	/* send the request */
	sendMessage(socketfd,"",FGETMACHINEID);

	/* read the id */
	uret = readU32(socketfd);

	/* close the socket */
	close(socketfd);

	return uret;
}
开发者ID:roeland-frans,项目名称:q-rap,代码行数:28,代码来源:fclient.cpp


示例10: is

bool DecoSchematic::loadSchematicFile() {
	std::ifstream is(filename.c_str(), std::ios_base::binary);

	u32 signature = readU32(is);
	if (signature != MTSCHEM_FILE_SIGNATURE) {
		errorstream << "loadSchematicFile: invalid schematic "
			"file" << std::endl;
		return false;
	}
	
	u16 version = readU16(is);
	if (version != 1) {
		errorstream << "loadSchematicFile: unsupported schematic "
			"file version" << std::endl;
		return false;
	}

	size = readV3S16(is);
	int nodecount = size.X * size.Y * size.Z;
	
	u16 nidmapcount = readU16(is);
	
	node_names = new std::vector<std::string>;
	for (int i = 0; i != nidmapcount; i++) {
		std::string name = deSerializeString(is);
		node_names->push_back(name);
	}

	delete schematic;
	schematic = new MapNode[nodecount];
	MapNode::deSerializeBulk(is, SER_FMT_VER_HIGHEST, schematic,
				nodecount, 2, 2, true);
				
	return true;
}
开发者ID:MasterCrank,项目名称:minetest,代码行数:35,代码来源:mapgen.cpp


示例11: readU32

/**
Analyzes the content of an input stream to see if it can be parsed
\param input The input stream
\return A value that indicates whether the content from the input
stream is a Corel Draw Document that libcdr is able to parse
*/
CDRAPI bool libcdr::CMXDocument::isSupported(librevenge::RVNGInputStream *input)
try
{
  if (!input)
    return false;

  input->seek(0, librevenge::RVNG_SEEK_SET);
  unsigned riff = readU32(input);
  if (riff != CDR_FOURCC_RIFF && riff != CDR_FOURCC_RIFX)
    return false;
  input->seek(4, librevenge::RVNG_SEEK_CUR);
  char signature_c = (char)readU8(input);
  if (signature_c != 'C' && signature_c != 'c')
    return false;
  char signature_d = (char)readU8(input);
  if (signature_d != 'M' && signature_d != 'm')
    return false;
  char signature_r = (char)readU8(input);
  if (signature_r != 'X' && signature_r != 'x')
    return false;
  return true;
}
catch (...)
{
  return false;
}
开发者ID:androidfan0,项目名称:libcdr,代码行数:32,代码来源:CMXDocument.cpp


示例12: readU8

void ContentFeatures::deSerialize(std::istream &is)
{
	int version = readU8(is);
	if(version != 5)
		throw SerializationError("unsupported ContentFeatures version");
	name = deSerializeString(is);
	groups.clear();
	u32 groups_size = readU16(is);
	for(u32 i=0; i<groups_size; i++){
		std::string name = deSerializeString(is);
		int value = readS16(is);
		groups[name] = value;
	}
	drawtype = (enum NodeDrawType)readU8(is);
	visual_scale = readF1000(is);
	if(readU8(is) != 6)
		throw SerializationError("unsupported tile count");
	for(u32 i=0; i<6; i++)
		tiledef[i].deSerialize(is);
	if(readU8(is) != CF_SPECIAL_COUNT)
		throw SerializationError("unsupported CF_SPECIAL_COUNT");
	for(u32 i=0; i<CF_SPECIAL_COUNT; i++)
		tiledef_special[i].deSerialize(is);
	alpha = readU8(is);
	post_effect_color.setAlpha(readU8(is));
	post_effect_color.setRed(readU8(is));
	post_effect_color.setGreen(readU8(is));
	post_effect_color.setBlue(readU8(is));
	param_type = (enum ContentParamType)readU8(is);
	param_type_2 = (enum ContentParamType2)readU8(is);
	is_ground_content = readU8(is);
	light_propagates = readU8(is);
	sunlight_propagates = readU8(is);
	walkable = readU8(is);
	pointable = readU8(is);
	diggable = readU8(is);
	climbable = readU8(is);
	buildable_to = readU8(is);
	deSerializeString(is); // legacy: used to be metadata_name
	liquid_type = (enum LiquidType)readU8(is);
	liquid_alternative_flowing = deSerializeString(is);
	liquid_alternative_source = deSerializeString(is);
	liquid_viscosity = readU8(is);
	light_source = readU8(is);
	damage_per_second = readU32(is);
	node_box.deSerialize(is);
	selection_box.deSerialize(is);
	legacy_facedir_simple = readU8(is);
	legacy_wallmounted = readU8(is);
	deSerializeSimpleSoundSpec(sound_footstep, is);
	deSerializeSimpleSoundSpec(sound_dig, is);
	deSerializeSimpleSoundSpec(sound_dug, is);
	// If you add anything here, insert it primarily inside the try-catch
	// block to not need to increase the version.
	try{
		// Stuff below should be moved to correct place in a version that
		// otherwise changes the protocol version
		liquid_renewable = readU8(is);
	}catch(SerializationError &e) {};
}
开发者ID:derekdreery,项目名称:minetest,代码行数:60,代码来源:nodedef.cpp


示例13: SerializationError

void ClientMediaDownloader::deSerializeHashSet(const std::string &data,
		std::set<std::string> &result)
{
	if (data.size() < 6 || data.size() % 20 != 6) {
		throw SerializationError(
				"ClientMediaDownloader::deSerializeHashSet: "
				"invalid hash set file size");
	}

	const u8 *data_cstr = (const u8*) data.c_str();

	u32 signature = readU32(&data_cstr[0]);
	if (signature != MTHASHSET_FILE_SIGNATURE) {
		throw SerializationError(
				"ClientMediaDownloader::deSerializeHashSet: "
				"invalid hash set file signature");
	}

	u16 version = readU16(&data_cstr[4]);
	if (version != 1) {
		throw SerializationError(
				"ClientMediaDownloader::deSerializeHashSet: "
				"unsupported hash set file version");
	}

	for (u32 pos = 6; pos < data.size(); pos += 20) {
		result.insert(data.substr(pos, 20));
	}
}
开发者ID:CharlieJiang,项目名称:minetest,代码行数:29,代码来源:clientmedia.cpp


示例14: readU32

bool FlcPlayer::isValidFrame(Uint8 *frameHeader, Uint32 &frameSize, Uint16 &frameType)
{
	readU32(frameSize, frameHeader);
	readU16(frameType, frameHeader + 4);

	return (frameType == FRAME_TYPE || frameType == AUDIO_CHUNK || frameType == PREFIX_CHUNK);
} 
开发者ID:JonnyH,项目名称:shoes-diary,代码行数:7,代码来源:FlcPlayer.cpp


示例15: readU32

U32		PGRFAttrSetResPkt::deserialize( const S8 * buf, S32 offset )
{
	U32 cur_pos = PPacketBase::deserialize(buf, offset);
	const S8 * buff = buf + offset;

	readU32(buff + cur_pos, m_event);
	cur_pos += sizeof(U32);

	readU32(buff + cur_pos, m_iHandle);
	cur_pos += sizeof(U32);

	m_bOk = readB8(buff + cur_pos);
	cur_pos += sizeof(B8);
	//cur_pos += m_oAddr.deserialize(buff + cur_pos,0);

	return cur_pos;
}
开发者ID:luluorta,项目名称:Giraffe,代码行数:17,代码来源:PGRFAttrSetResPkt.cpp


示例16: read_chunk_header

void read_chunk_header(unsigned char* input, size_t input_size, int* pos, int* id, int* options, unsigned long* size,
unsigned long* checksum, unsigned long* extra)
{
  unsigned char buffer[16];
  int c;
  for (c=0;c<16;c++)
  {
    buffer[c] = input[*pos];
    *pos = *pos + 1;
  }

  *id = readU16(buffer) & 0xffff;
  *options = readU16(buffer+2) & 0xffff;
  *size = readU32(buffer+4) & 0xffffffff;
  *checksum = readU32(buffer+8) & 0xffffffff;
  *extra = readU32(buffer+12) & 0xffffffff;
}
开发者ID:jordiclariana,项目名称:php-sixplz,代码行数:17,代码来源:6unpack.c


示例17: readU32

U32		PGRFCloseReqPkt::deserialize( const S8 * buf, S32 offset )
{
	U32 cur_pos = PPacketBase::deserialize(buf, offset);
	const S8 * buff = buf + offset;

	readU32(buff + cur_pos, m_event);
	cur_pos += sizeof(U32);

	readU32(buff + cur_pos, m_iSessionID);
	cur_pos += sizeof(U32);

	readU32(buff + cur_pos, m_iHandle);
	cur_pos += sizeof(U32);

	//cur_pos += m_oAddr.deserialize(buff + cur_pos,0);

	return cur_pos;
}
开发者ID:luluorta,项目名称:Giraffe,代码行数:18,代码来源:PGRFCloseReqPkt.cpp


示例18: deSerializeString

void ContentFeatures::deSerializeOld(std::istream &is, int version)
{
	if(version == 5) // In PROTOCOL_VERSION 13
	{
		name = deSerializeString(is);
		groups.clear();
		u32 groups_size = readU16(is);
		for(u32 i=0; i<groups_size; i++){
			std::string name = deSerializeString(is);
			int value = readS16(is);
			groups[name] = value;
		}
		drawtype = (enum NodeDrawType)readU8(is);
		visual_scale = readF1000(is);
		if(readU8(is) != 6)
			throw SerializationError("unsupported tile count");
		for(u32 i=0; i<6; i++)
			tiledef[i].deSerialize(is);
		if(readU8(is) != CF_SPECIAL_COUNT)
			throw SerializationError("unsupported CF_SPECIAL_COUNT");
		for(u32 i=0; i<CF_SPECIAL_COUNT; i++)
			tiledef_special[i].deSerialize(is);
		alpha = readU8(is);
		post_effect_color.setAlpha(readU8(is));
		post_effect_color.setRed(readU8(is));
		post_effect_color.setGreen(readU8(is));
		post_effect_color.setBlue(readU8(is));
		param_type = (enum ContentParamType)readU8(is);
		param_type_2 = (enum ContentParamType2)readU8(is);
		is_ground_content = readU8(is);
		light_propagates = readU8(is);
		sunlight_propagates = readU8(is);
		walkable = readU8(is);
		pointable = readU8(is);
		diggable = readU8(is);
		climbable = readU8(is);
		buildable_to = readU8(is);
		deSerializeString(is); // legacy: used to be metadata_name
		liquid_type = (enum LiquidType)readU8(is);
		liquid_alternative_flowing = deSerializeString(is);
		liquid_alternative_source = deSerializeString(is);
		liquid_viscosity = readU8(is);
		light_source = readU8(is);
		damage_per_second = readU32(is);
		node_box.deSerialize(is);
		selection_box.deSerialize(is);
		legacy_facedir_simple = readU8(is);
		legacy_wallmounted = readU8(is);
		deSerializeSimpleSoundSpec(sound_footstep, is);
		deSerializeSimpleSoundSpec(sound_dig, is);
		deSerializeSimpleSoundSpec(sound_dug, is);
	}
	else
	{
		throw SerializationError("unsupported ContentFeatures version");
	}
}
开发者ID:BobMikfillin,项目名称:minetest,代码行数:57,代码来源:nodedef.cpp


示例19: readU32

/************************************************************************************
 *
* ***********************************************************************************/
bool ScopeDome::SetupParms()
{
    targetAz = 0;

    readU32(GetImpPerTurn, stepsPerTurn);
    LOGF_INFO("Steps per turn read as %d", stepsPerTurn);
    StepsPerRevolutionN[0].value = stepsPerTurn;
    StepsPerRevolutionNP.s       = IPS_OK;
    IDSetNumber(&StepsPerRevolutionNP, nullptr);

    readS32(GetHomeSensorPosition, homePosition);
    LOGF_INFO("Home position read as %d", homePosition);

    if (UpdatePosition())
        IDSetNumber(&DomeAbsPosNP, nullptr);

    if (UpdateShutterStatus())
        IDSetSwitch(&DomeShutterSP, nullptr);

    UpdateSensorStatus();
    UpdateRelayStatus();

    if (InitPark())
    {
        // If loading parking data is successful, we just set the default parking
        // values.
        SetAxis1ParkDefault(0);
    }
    else
    {
        // Otherwise, we set all parking data to default in case no parking data is
        // found.
        SetAxis1Park(0);
        SetAxis1ParkDefault(0);
    }

    uint8_t calibrationNeeded = false;
    readU8(IsFullSystemCalReq, calibrationNeeded);
    CalibrationNeededS[0].s = calibrationNeeded ? ISS_ON : ISS_OFF;
    CalibrationNeededSP.s   = IPS_OK;
    IDSetSwitch(&CalibrationNeededSP, nullptr);

    uint16_t fwVersion;
    readU16(GetVersionFirmware, fwVersion);
    FirmwareVersionsN[0].value = fwVersion / 100.0;

    uint8_t fwVersionRotary;
    readU8(GetVersionFirmwareRotary, fwVersionRotary);
    FirmwareVersionsN[1].value = (fwVersionRotary + 9) / 10.0;
    FirmwareVersionsNP.s       = IPS_OK;
    IDSetNumber(&FirmwareVersionsNP, nullptr);
    return true;
}
开发者ID:sterne-jaeger,项目名称:indi,代码行数:56,代码来源:scopedome_dome.cpp


示例20: readU32

void NodeMetadata::deSerialize(std::istream &is)
{
	m_stringvars.clear();
	int num_vars = readU32(is);
	for(int i=0; i<num_vars; i++){
		std::string name = deSerializeString(is);
		std::string var = deSerializeLongString(is);
		m_stringvars[name] = var;
	}

	m_inventory->deSerialize(is);
}
开发者ID:hondalyfe88,项目名称:MultiCraft,代码行数:12,代码来源:nodemetadata.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ readU8函数代码示例发布时间:2022-05-30
下一篇:
C++ readU16函数代码示例发布时间: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