예제 #1
0
void FileReading::SkipBytes( RageFileBasic &f, int iBytes, RString &sError )
{
	if( sError.size() != 0 )
		return;

	iBytes += f.Tell();
	FileReading::Seek( f, iBytes, sError );
}
예제 #2
0
static bool GetSha1ForFile( RageFileBasic &f, unsigned char *szHash )
{
	hash_state sha1e;
	sha1_init(&sha1e);

	int origpos = f.Tell();
	f.Seek(0);
	unsigned char buf[4096];
	int got = f.Read(buf, 4096);
	if ( got == -1 )
		return false;
	while (got > 0)
	{
		sha1_process(&sha1e, buf, got);
		got = f.Read(buf, 4096);
		if ( got == -1 )
			return false;
	}
	sha1_done(&sha1e, szHash);
	f.Seek(origpos);
	return true;
}
static long OggRageFile_tell_func( void *datasource )
{
	RageFileBasic *f = (RageFileBasic *) datasource;
	return f->Tell();
}