本文整理汇总了C++中ReadShort函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadShort函数的具体用法?C++ ReadShort怎么用?C++ ReadShort使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadShort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WTRACE
// TMsgCommPingReply::unpack
// Virtual method from TMessage. Extracts data from message buffer.
void
TMsgCommQueryOptReply::Unpack(void)
{
WTRACE("TMsgCommQueryOptReply::Unpack");
mOptionMap.clear();
TMessage::Unpack();
if ((GetServiceType() != WONMsg::CommonService) ||
(GetMessageType() != WONMsg::CommQueryOptionsReply))
{
WDBG_AH("TMsgCommQueryOptReply::Unpack Not a CommQueryOptionsReply message!");
throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
"Not a CommQueryOptionsReply message.");
}
unsigned short aCt = ReadShort();
WDBG_LL("TMsgCommQueryOptReply::Unpack reading " << aCt << " entries");
for (int i=0; i < aCt; i++)
{
OptionDef aDef;
string anOpt;
ReadString(anOpt);
aDef.first = static_cast<OptionStatus>(ReadByte());
ReadWString(aDef.second);
mOptionMap[anOpt] = aDef;
}
if (BytesLeftToRead() >= 2)
mStatus = static_cast<WONMsg::ServerStatus>(static_cast<short>(ReadShort()));
}
示例2: MDReadAudibleCommonHeader
static AudErrorCode MDReadAudibleCommonHeader( IAudibleInputStream *pFile, CAudibleCommonHeader *pCommonHead, long sectionSize )
{ if ( sectionSize != 24 )
{ return AUD_AA_FILE_BAD_FORMAT;
}
//-------------- Now read.
{ BOOL readRes =
ReadShort( pFile, &pCommonHead->versionNumber ) &&
ReadShort( pFile, &pCommonHead->minVersionNumber ) &&
ReadLong ( pFile, &pCommonHead->magicNumber ) &&
//------------ Read information if this is partial file from larger one.
ReadLong( pFile, &pCommonHead->IsPartialFile ) &&
ReadLong( pFile, &pCommonHead->sizeOfOriginalAudio ) &&
ReadLong( pFile, &pCommonHead->segmentStart ) &&
ReadLong( pFile, &pCommonHead->segmentEnd );
//----------------
if ( !readRes )
{ return AUD_FILE_READ_FAIL;
}
if ( pCommonHead->magicNumber != 0x57907536 || pCommonHead->minVersionNumber != 0 )
{ return AUD_AA_FILE_BAD_FORMAT;
}
//----------- If version more than 1 - means some new future format
if ( pCommonHead->versionNumber > 1 || pCommonHead->versionNumber < 0 )
{ return AUD_AA_FILE_UNSOPPORTED_FORMAT;
}
return AUD_NO_ERROR;
}
}
示例3: ReadShort
void VFSPlugin_LWO::read_layr(long length)
{
// Read the layer number
short layernumber = ReadShort();
length-=sizeof(layernumber);
// Read the layer flags
short layerflags = ReadShort();
length-=sizeof(layerflags);
// Read the layer pivot axis
Vertex3f *v = ReadVertex();
length-=sizeof(Vertex3f);
// Read the layer name
long stringlength;
char *layername = ReadString(&stringlength);
length-=stringlength;
// Read the parent layer number
short parentid = -1;
if(length>=sizeof(parentid)) parentid = ReadShort();
// Clean up any temporary memory
delete v;
delete layername;
}
示例4: WTRACE
void MMsgRoutingModifyDataObject::Unpack(void)
{
WTRACE("MMsgRoutingModifyDataObject::Unpack");
RoutingServerMessage::Unpack();
if (GetServiceType() != WONMsg::MiniRoutingServer ||
GetMessageType() != WONMsg::RoutingModifyDataObject)
{
WDBG_AH("MMsgRoutingModifyDataObject::Unpack Not a RoutingModifyDataObject message!");
throw WONMsg::BadMsgException(*this, __LINE__, __FILE__, "Not a RoutingModifyDataObject message.");
}
// read in the client/group id
mLinkId = ReadClientOrGroupId();
// read in the datatype size and then the datatype itself
unsigned char aDataTypeSize = ReadByte();
mDataType.assign((unsigned char*)ReadBytes(aDataTypeSize), aDataTypeSize);
// read in the offset
mOffset = ReadShort();
// read in the IsInsert flag
mIsInsert = ReadBool();
// read in the data length followed by the data itself
unsigned short aDataSize = ReadShort();
mData.assign((unsigned char*)ReadBytes(aDataSize), aDataSize);
WDBG_LL("MMsgRoutingModifyDataObject::Unpack Reading message data");
}
示例5: BuildAndWriteHints
void BuildAndWriteHints(void)
{
char * iWalker;
unsigned int blkcount,elcnt,ityp,i,j,offset,tlength;
iWalker = BufferIndex;
blkcount = ReadShort(iWalker);
WriteFile(iWalker,2);
iWalker += 2;
for (i=0; i < blkcount; i++) {
// number of elements in this block
elcnt = ReadShort(iWalker);
WriteFile(iWalker,2);
iWalker += 2;
ityp = ReadShort(iWalker);
WriteFile(iWalker,2);
iWalker += 2;
for (j=0; j < elcnt; j++) {
offset = ReadShort(iWalker);
iWalker += 2;
tlength = ReadShort( BufferTxt+offset );
WriteFile(BufferTxt+offset,2);
WriteFile(BufferTxt+offset+2,tlength);
}
if ( ityp == 1 ) {
WriteFile(iWalker, elcnt*2);
iWalker += elcnt*2;
}
WriteFile(iWalker, 2);
iWalker += 2;
}
}
示例6: WTRACE
// TMsgDirGetDirContents::Unpack
// Virtual method from TMessage. Extracts data from message buffer.
void
TMsgDirGetDirContentsReply::Unpack(void)
{
WTRACE("TMsgDirGetDirContentsReply::Unpack");
TMessage::Unpack();
if ((GetServiceType() != WONMsg::DirServer) ||
(GetMessageType() != WONMsg::DirGetDirContentsReply))
{
WDBG_AH("TMsgDirGetDirContentsReply::Unpack Not a DirGetDirContentsReply message!");
throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
"Not a DirGetDirContentsReply message.");
}
WDBG_LL("TMsgDirGetDirContentsReply::Unpack Reading message data");
mStatus = static_cast<ServerStatus>(static_cast<short>(ReadShort()));
unsigned short anEntryCt = ReadShort();
WDBG_LL("TMsgDirGetDirContentsReply::Unpack Reading " << anEntryCt << "entries.");
mEntries.clear();
for (int i=0; i < anEntryCt; i++)
{
DirServerEntry anEntry;
UnpackEntry(anEntry);
mEntries.push_back(anEntry);
}
}
示例7: ReadShort
int Compressor::LoadDecompressionTable(void * comp){
unsigned short * compressed = (unsigned short *)comp;
// load number of table entries
table_entries = ReadShort(compressed)+1;
// load the values the entries decode to
for ( int a=0;a<table_entries;a++){
decoder_table[a].decoded_value = ReadShort(compressed+a+1);
}
if ( table_entries == 1){
return 2*sizeof(unsigned short);
}
// store the probability of each entry
ProbabilityCoder prob(&compressed[table_entries+1],FRACTIONAL_BITS);
int cp=0;
for (int a=0;a<table_entries;a++){
decoder_table[a].cprobability = cp;
int v = prob.ReadSymbol();
assert(v);
if ( v == 0 )
return -1;
cp += v;
}
assert(cp==(1<<FRACTIONAL_BITS));
if ( cp != (1<<FRACTIONAL_BITS)){
return -1;
}
decoder_table[table_entries].cprobability = 1<<FRACTIONAL_BITS;
return (table_entries+1)*sizeof(unsigned short)+prob.GetBytesUsed();
}
示例8: WTRACE
// SMsgDirG2GetNumEntitiesReply::Unpack
// Virtual method from SmallMessage. Extracts data from message buffer.
void
SMsgDirG2GetNumEntitiesReply::Unpack(void)
{
WTRACE("SMsgDirG2GetNumEntitiesReply::Unpack");
SmallMessage::Unpack();
if ((GetServiceType() != WONMsg::SmallDirServerG2) ||
(GetMessageType() != WONMsg::DirG2GetNumEntitiesReply))
{
WDBG_AH("SMsgDirG2GetNumEntitiesReply::Unpack Not a DirG2GetNumEntitiesReply message!");
throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
"Not a DirG2GetNumEntitiesReply message.");
}
WDBG_LL("SMsgDirG2GetNumEntitiesReply::Unpack Reading message data");
unsigned short anEntryCt = ReadShort();
WDBG_LL("SMsgDirG2GetNumEntitiesReply::Unpack Reading " << anEntryCt << " entries.");
mEntries.clear();
for (int i=0; i < anEntryCt; i++)
{
NumEntriesData anEntry;
mEntries.push_back(anEntry);
mEntries.back().first = static_cast<short>(ReadShort());
mEntries.back().second = ReadShort();
}
}
示例9: WTRACE
// TMsgDirFindServiceReply::Unpack
// Virtual method from TMessage. Extracts data from message buffer.
void
TMsgDirFindServiceReply::Unpack(void)
{
WTRACE("TMsgDirFindServiceReply::Unpack");
TMessage::Unpack();
if ((GetServiceType() != WONMsg::DirServer) ||
(GetMessageType() != WONMsg::DirFindServiceReply))
{
WDBG_AH("TMsgDirFindServiceReply::Unpack Not a DirFindServiceReply message!");
throw WONMsg::BadMsgException(*this, __LINE__, __FILE__,
"Not a DirFindServiceReply message.");
}
WDBG_LL("TMsgDirFindServiceReply::Unpack Reading message data");
mStatus = static_cast<ServerStatus>(static_cast<short>(ReadShort()));
// Service data only present if status is success
if (mStatus == WONMsg::StatusCommon_Success)
{
mService.mType = DirServerEntry::EntryTypeService;
ReadWString(mService.mPath);
ReadWString(mService.mName);
ReadWString(mService.mDisplayName);
ReadWString(mService.mVersion);
ReadWString(mService.mProtoName);
ReadWString(mService.mProtoVersion);
ReadWString(mService.mNetAddress);
mService.mLifespan = ReadLong();
mService.mCreated = ReadLong();
unsigned short aLen = ReadShort();
mService.SetBlob(ReadBytes(aLen), aLen);
}
}
示例10: NifStream
//short
void NifStream( short & val, istream& in, const NifInfo & info ) {
if ( info.endian == sys_endian ) {
val = ReadShort( in );
} else {
val = SwapEndian( ReadShort( in ) );
}
}
示例11: WTRACE
void MMsgRoutingGetUserListReply::Unpack(void)
{
WTRACE("MMsgRoutingGetUserListReply::Unpack");
RoutingServerMessage::Unpack();
if (GetServiceType() != WONMsg::MiniRoutingServer ||
GetMessageType() != WONMsg::RoutingGetUserListReply)
{
WDBG_AH("MMsgRoutingGetUserListReply::Unpack Not a RoutingGetUserListReply message!");
throw WONMsg::BadMsgException(*this, __LINE__, __FILE__, "Not a RoutingGetUserListReply message.");
}
WDBG_LL("MMsgRoutingGetUserListReply::Unpack Reading message data");
// read in the status
mStatus = ReadShort();
// read in the user count
unsigned short aNumUsers = ReadShort();
// read in the user list
mUserList.clear();
for (int iUser = 0; iUser < aNumUsers; iUser++)
{
UserData aUser;
ReadUserName(aUser.mUserName);
mUserList.push_back(aUser);
}
}
示例12: LoadCPU
void LoadCPU(SAVESTATE_t* save, CPU_t* cpu) {
CHUNK_t* chunk = FindChunk(save, CPU_tag);
chunk->pnt = 0;
cpu->a = ReadChar(chunk);
cpu->f = ReadChar(chunk);
cpu->b = ReadChar(chunk);
cpu->c = ReadChar(chunk);
cpu->d = ReadChar(chunk);
cpu->e = ReadChar(chunk);
cpu->h = ReadChar(chunk);
cpu->l = ReadChar(chunk);
cpu->ap = ReadChar(chunk);
cpu->fp = ReadChar(chunk);
cpu->bp = ReadChar(chunk);
cpu->cp = ReadChar(chunk);
cpu->dp = ReadChar(chunk);
cpu->ep = ReadChar(chunk);
cpu->hp = ReadChar(chunk);
cpu->lp = ReadChar(chunk);
cpu->ixl = ReadChar(chunk);
cpu->ixh = ReadChar(chunk);
cpu->iyl = ReadChar(chunk);
cpu->iyh = ReadChar(chunk);
cpu->pc = ReadShort(chunk);
cpu->sp = ReadShort(chunk);
cpu->i = ReadChar(chunk);
cpu->r = ReadChar(chunk);
cpu->bus = ReadChar(chunk);
cpu->imode = ReadInt(chunk);
cpu->interrupt = ReadInt(chunk);
cpu->ei_block = ReadInt(chunk);
cpu->iff1 = ReadInt(chunk);
cpu->iff2 = ReadInt(chunk);
cpu->halt = ReadInt(chunk);
cpu->read = ReadInt(chunk);
cpu->write = ReadInt(chunk);
cpu->output = ReadInt(chunk);
cpu->input = ReadInt(chunk);
cpu->prefix = ReadInt(chunk);
int i;
for(i = 0; i < 256; i++) {
interrupt_t *val = &cpu->pio.interrupt[i];
val->interrupt_val = ReadInt(chunk);
val->skip_factor = ReadInt(chunk);
val->skip_count = ReadInt(chunk);
}
}
示例13: ReadShort
XString ReadStream::ReadString()
{
int len = ReadShort();
XString s;
s.SetLen(len, 0);
for(int i = 0; i < len; i++)
{
s.SetChar(i, (TCHAR)ReadShort());
}
return s;
}
示例14: WTRACE
void
SMsgDirG2UpdateExtendBase::UnpackExtended(void)
{
WTRACE("SMsgDirG2UpdateExtendBase::UnpackExtended");
WDBG_LL("SMsgDirG2UpdateExtendBase::UnpackExtended enableDataObjects=" << mEnableDataObjects << " enableACLs=" << mEnableACLs);
mDataObjects.clear();
mACLs.clear();
if (mEnableDataObjects)
{
unsigned short aCt = ReadShort();
WDBG_LL("SMsgDirG2UpdateExtendBase::UnpackExtended Reading " << aCt << " data objects.");
for (int i=0; i < aCt; i++)
{
DataObject anObj;
unsigned char aTypeLen = ReadByte();
if (aTypeLen > 0)
anObj.GetDataType().assign(reinterpret_cast<const unsigned char*>(ReadBytes(aTypeLen)), aTypeLen);
unsigned short aDataLen = ReadShort();
if (aDataLen > 0)
anObj.GetData().assign(reinterpret_cast<const unsigned char*>(ReadBytes(aDataLen)), aDataLen);
mDataObjects.insert(anObj);
}
}
if (mEnableACLs)
{
unsigned short aCt = ReadShort();
WDBG_LL("SMsgDirG2UpdateExtendBase::UnpackExtended Reading " << aCt << " ACLs.");
for (int i=0; i < aCt; i++)
{
DirACL anACL;
anACL.mType = static_cast<WONMsg::DirG2ACLType>(ReadByte());
unsigned short aPermCt = ReadShort();
for (int j=0; j < aPermCt; j++)
{
Permission aPerm;
aPerm.mUserId = ReadLong();
aPerm.mCommunityId = ReadLong();
aPerm.mTrustLevel = ReadShort();
anACL.mACL.insert(aPerm);
}
mACLs.push_back(anACL);
}
}
}
示例15: ReadByte
/*
=================
idRestoreGame::ReadUsercmd
=================
*/
void idRestoreGame::ReadUsercmd( usercmd_t& usercmd )
{
ReadByte( usercmd.buttons );
ReadSignedChar( usercmd.forwardmove );
ReadSignedChar( usercmd.rightmove );
ReadShort( usercmd.angles[0] );
ReadShort( usercmd.angles[1] );
ReadShort( usercmd.angles[2] );
ReadShort( usercmd.mx );
ReadShort( usercmd.my );
ReadByte( usercmd.impulse );
ReadByte( usercmd.impulseSequence );
}