本文整理汇总了C++中ReadHeader函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadHeader函数的具体用法?C++ ReadHeader怎么用?C++ ReadHeader使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadHeader函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: free
BMMRES
BitmapIO_EPS::GetImageInfoDlg (HWND hWnd, BitmapInfo *info,
const TCHAR *filename)
{
free (iFilename);
iFilename = NULL;
if (filename) {
iFilename = (TCHAR *) malloc ((_tcslen(filename)+1)*sizeof(TCHAR));
if (iFilename)
_tcscpy (iFilename, filename);
ReadHeader (iFilename);
} else if (info->Name ()) {
iFilename = (TCHAR *)
malloc ((_tcslen(info->Name ())+1)*sizeof(TCHAR));
if (iFilename)
_tcscpy (iFilename, info->Name ());
ReadHeader (iFilename);
} else {
MessageBox (hWnd, _T("EPS GetImageInfoDlg called with no file name"),
_T("EPS Plugin"), MB_ICONINFORMATION);
return BMMRES_FILENOTFOUND;
}
DialogBoxParam (hResource,
MAKEINTRESOURCE (IDD_INFO_DIALOG),
hWnd,
ImageInfoDlg,
(LPARAM) this);
return BMMRES_SUCCESS;
}
示例2: ksiazek
static PSBOOK *ReadAllOldAtoms(char *bok_filename,int *NumOfWav)
{ /* Wczytanie wszystkich zestawow ksiazek (usredniona mapa Wignera) */
extern unsigned long NumberOfAllWaveForms;
int i,k,NumberOfBloks,j,num_of_wav;
PSBOOK *book=NULL;
FILE *plik=NULL;
HEADER head; /* Funkcja zwraca globalna liczbe atomow */
ATOM atom;
float df;
if((NumberOfBloks=LicznikKsiazek(bok_filename))==-1)
ERROR("Problemy z odczytem struktury ksiazki !");
num_of_wav=(int)NumberOfAllWaveForms;
if((book=(PSBOOK *)malloc((unsigned)num_of_wav*sizeof(PSBOOK)))==NULL)
ERROR("Brak pamieci (ReadAllAtoms) !");
if((plik=fopen(bok_filename,"rb"))==NULL)
ERROR("Problemy przy otwarciu zbioru !\n");
if(ReadHeader(&head,plik)==-1)
ERROR("Blad czytania naglowka (ReadAllAtoms) !");
fseek(plik,0L,SEEK_SET);
df=2.0F*M_PI/(float)(head.signal_size);
Ec=E0=0.0F;
for(i=0,k=0 ; i<NumberOfBloks ; i++)
{
if(ReadHeader(&head,plik)==-1)
ERROR("Blad czytania naglowka (ReadAllAtoms) !");
if(head.signal_size!=DimBase) /* W przypadku niezgodnosci */
if(prn==ON)
fprintf(stderr,"UWAGA ! Niezgodnosc rozmiaru bazy (%d)"
" i analizowanego naglowka (%d)\n",
DimBase,head.signal_size);
E0+=head.signal_energy;
for(j=0 ; j<head.book_size ; j++)
{
if(ReadAtom(&atom,plik)==-1)
ERROR("Blad czytania atomu (ReadAllAtoms) !");
book[k].s=(float)(1<<(atom.octave));
book[k].t=(float)atom.position;
book[k].w=atom.modulus;
book[k].f=df*(float)atom.frequency;
book[k].amplitude=atom.amplitude;
Ec+=SQR(atom.modulus);
k++;
}
}
fclose(plik);
*NumOfWav=num_of_wav;
return book;
}
示例3: ReadSkinnedAnimationFromFile
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void CSAnimProvider::ReadSkinnedAnimationFromFile(StorageLocation in_location, const std::string& in_filePath, const ResourceProvider::AsyncLoadDelegate& in_delegate, const SkinnedAnimationSPtr& out_resource) const
{
IBinaryInputStreamUPtr stream = Application::Get()->GetFileSystem()->CreateBinaryInputStream(in_location, in_filePath);
u32 numFrames = 0;
s32 numSkeletonNodes = 0;
if(ReadHeader(stream, in_filePath, out_resource, numFrames, numSkeletonNodes) == false)
{
CS_LOG_ERROR("Failed to read header in anim: " + in_filePath);
out_resource->SetLoadState(Resource::LoadState::k_failed);
if(in_delegate != nullptr)
{
Application::Get()->GetTaskScheduler()->ScheduleTask(TaskType::k_mainThread, [=](const TaskContext&) noexcept
{
in_delegate(out_resource);
});
}
return;
}
ReadAnimationData(stream, numFrames, numSkeletonNodes, out_resource);
out_resource->SetLoadState(Resource::LoadState::k_loaded);
if(in_delegate != nullptr)
{
Application::Get()->GetTaskScheduler()->ScheduleTask(TaskType::k_mainThread, [=](const TaskContext&) noexcept
{
in_delegate(out_resource);
});
}
}
示例4: ReadHeader
// Parses the entire contents of an XNB file.
void ContentReader::ReadXnb()
{
// Read the XNB header.
uint32_t endPosition = ReadHeader();
ReadTypeManifest();
uint32_t sharedResourceCount = Read7BitEncodedInt();
// Read the primary asset data.
Log.WriteLine("Asset:");
ReadObject();
// Read any shared resource instances.
for (uint32_t i = 0 ; i < sharedResourceCount; i++)
{
Log.WriteLine("Shared resource %d:", i);
ReadObject();
}
// Make sure we read the amount of data that the file header said we should.
if (FilePosition() != endPosition)
{
throw app_exception("End position does not match XNB header: unexpected amount of data was read.");
}
}
示例5: Decompress
void Decompress(char* source, char* dest) {
assert(source != nullptr);
assert(dest != nullptr);
BinaryReader reader(source);
BinaryWriter writer(dest);
ReadHeader(reader);
maxDictSize_ = 1 << indexBits_;
AllocateDictionary();
TrieNode* previousNode = nullptr;
unsigned char firstChar;
unsigned char lastChar;
while(reader.IsEOF() == false) {
int index = reader.ReadBits(IndexBits());
if(index == maxDictSize_ -1) break;
if(index >= dictSize_) {
firstChar = WriteString(previousNode, writer);
writer.WriteByte(lastChar);
}
else {
firstChar = WriteString(nodes_[index], writer);
}
if(previousNode) {
InsertValue(firstChar, previousNode);
}
lastChar = firstChar;
previousNode = nodes_[index];
}
}
示例6: Drawable
Mesh::Mesh(Program &program, const char *filename)
: Drawable(program)
, vbuffer(-1)
, nbuffer(-1)
, tbuffer(-1)
, fbuffer(-1)
, texture(NULL)
{
FILE *fp = fopen(filename, "r");
if(!fp)
{
std::cout << "Could not open file: " << filename << " :" << strerror(errno) << std::endl;
exit(-1);
}
int num_vertices, num_faces;
bool have_normals = false;
bool have_tex = false;
//Read the header
ReadHeader(fp, num_vertices, num_faces, have_normals, have_tex);
ReadVertexData(fp, num_vertices, have_normals, have_tex);
ReadFaceData(fp, num_faces);
InitBuffers();
}
示例7: Decompress
void Decompress(char* source, char* dest) {
BinaryReader reader(source);
ReadHeader(reader);
BinaryWriter writer(dest);
SlidingWindow window(nullptr, bufferSize_, MaxOffset(), MaxLength() - 1);
window.Initialize();
while(reader.IsEOF() == false) {
int length = reader.ReadBits(lengthBits_);
int value;
if(length == MaxLength()) {
break;
}
if(length == 0) {
value = reader.ReadByte();
}
else {
int offset = reader.ReadBits(offsetBits_);
value = reader.ReadByte();
for(int i = 0; i < length; i++) {
int temp = window.CurrentByte(-offset - 1);
writer.WriteByte(temp);
window.WriteByte(temp);
window.AdvanceWindow(1);
}
}
writer.WriteByte(value);
window.WriteByte(value);
window.AdvanceWindow(1);
}
}
示例8: ReadHeader
u64 Movie::GetMovieProgramID(const std::string& movie_file) const {
auto header = ReadHeader(movie_file);
if (header == boost::none)
return 0;
return static_cast<u64>(header.value().program_id);
}
示例9: ReadHeader
/* Moves the cursor past the chunk header, which is six bytes. */
void t3DSParser::EnterChunk()
{
if(m_xFile == 0 || !m_xFile->isOpen())
return;
ReadHeader();
}
示例10: log_trace
bool Client::GetPostResult(Value& result)
{
log_trace();
gettimeofday( &startTime_, 0 );
result.SetInvalid();
if (responseProcessed_)
{
PreserveReceiveBuffer();
ResetTransaction();
}
if (socket_.IsConnected(0) &&
ReadHeader(result) &&
ReadResponse(result))
{
switch (ProcessResponse(result))
{
case ProcessResponseSuccess : return true;
case ProcessResponseErrorKeepOpen : return false;
}
}
Reset();
return false;
}
示例11: ReadSectionLocators
int CADFile::ParseFile( enum OpenOptions eOptions, bool bReadUnsupportedGeometries )
{
if( nullptr == pFileIO )
return CADErrorCodes::FILE_OPEN_FAILED;
if( !pFileIO->IsOpened() )
{
if( !pFileIO->Open( CADFileIO::read | CADFileIO::binary ) )
return CADErrorCodes::FILE_OPEN_FAILED;
}
// Set flag which will tell CADLayer to skip/not skip unsupported geoms
bReadingUnsupportedGeometries = bReadUnsupportedGeometries;
int nResultCode;
nResultCode = ReadSectionLocators();
if( nResultCode != CADErrorCodes::SUCCESS )
return nResultCode;
nResultCode = ReadHeader( eOptions );
if( nResultCode != CADErrorCodes::SUCCESS )
return nResultCode;
nResultCode = ReadClasses( eOptions );
if( nResultCode != CADErrorCodes::SUCCESS )
return nResultCode;
nResultCode = CreateFileMap();
if( nResultCode != CADErrorCodes::SUCCESS )
return nResultCode;
nResultCode = ReadTables( eOptions );
if( nResultCode != CADErrorCodes::SUCCESS )
return nResultCode;
return CADErrorCodes::SUCCESS;
}
示例12: ReadData
/*********************************************************************
*
* ReceiveBytes()
*
********************************************************************/
int CConsolePort::ReceiveBytes( char* aBuff, int *aSize)
{
int ret = 0;
// If we are just the data part of the frame iReadingFlag is true
if( iReadingData == 1 )
{
ret = ReadData( aBuff, aSize );
if ( ret != 0 )
return -1;
}
else
{
// Else we are reading the header - so get the next command
ret = ReadHeader( aBuff, aSize );
if ( ret != 0 )
return -1;
// Set the flag to true now that we have read the header,
// so that the data part is read in the next iteration.
iReadingData = 1;
}
// Return
return ret;
}
示例13: _Read
bool RINEX_NavigationMessage::_Read(std::ifstream &ifs)
{
std::string buf;
if (ifs == 0)
{
return false;
}
else
{
// Do nothing
}
if (false == ReadHeader(ifs, leapSecond))
{
return false;
}
else
{
// Do nothing
}
if (false == ReadBody(ifs, leapSecond))
{
return false;
}
else
{
// Do nothing
}
return true;
}
示例14: Open
static int Open(void *context, SYS_FILEHANDLE file, V3XA_HANDLE *info)
{
OGG_context *ctx = (OGG_context*)context;
ReadHeader(ctx, file);
if (info)
{
int playLength, fileSize;
info->samplingRate = ctx->vi.rate;
#ifdef SUPPORT_IEEE_AUDIO
info->sampleFormat = V3XA_FMTIEEE;
#else
info->sampleFormat = V3XA_FMT16BIT;
#endif
if (ctx->vi.channels >= 2)
info->sampleFormat|= V3XA_FMTSTEREO;
fileSize = FIO_cur->fsize(file);
playLength = (fileSize * 8) / ctx->vi.bitrate_nominal;
info->length = playLength * ctx->vi.rate << 1;
info->loopend = 0;
info->loopstart = 0;
info->codec = &V3XA_Codec_OGG;
}
return 1;
}
示例15: switch
void CLoader7Z::ReadBloc(const std::streampos offset, const std::size_t size)
{
#ifdef T_DEBUG
CApplication::getApp()->log(CString("Lecture de %1 octets depuis l'offset %2").arg(size).arg(offset), ILogger::Debug);
#endif
if (size == 0)
return;
char * header = new char[size];
m_file.seekg(offset, std::ios_base::beg);
m_file.read(header, size);
try
{
switch (header[0])
{
case kHeader:
ReadHeader(header);
break;
case kEncodedHeader:
ReadEncodedHeader(header);
break;
}
}
catch (...)
{
//...
}
delete[] header;
return;
}