本文整理汇总了C++中LVStreamRef::crc32方法的典型用法代码示例。如果您正苦于以下问题:C++ LVStreamRef::crc32方法的具体用法?C++ LVStreamRef::crc32怎么用?C++ LVStreamRef::crc32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LVStreamRef
的用法示例。
在下文中一共展示了LVStreamRef::crc32方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
bool TexHyph::load( LVStreamRef stream )
{
int w = isCorrectHyphFile(stream.get());
int patternCount = 0;
if (w) {
_hash = stream->crc32();
int i;
lvsize_t dw;
lvByteOrderConv cnv;
int hyph_count = w;
thyph hyph;
lvpos_t p = 78 + (hyph_count * 8 + 2);
stream->SetPos(p);
if ( stream->SetPos(p)!=p )
return false;
lChar16 charMap[256];
unsigned char buf[0x10000];
memset( charMap, 0, sizeof( charMap ) );
// make char map table
for (i=0; i<hyph_count; i++)
{
if ( stream->Read( &hyph, 522, &dw )!=LVERR_OK || dw!=522 )
return false;
cnv.msf( &hyph.len ); //rword(_main_hyph[i].len);
lvpos_t newPos;
if ( stream->Seek( hyph.len, LVSEEK_CUR, &newPos )!=LVERR_OK )
return false;
cnv.msf( hyph.wl );
cnv.msf( hyph.wu );
charMap[ (unsigned char)hyph.al ] = hyph.wl;
charMap[ (unsigned char)hyph.au ] = hyph.wu;
// lChar16 ch = hyph.wl;
// CRLog::debug("wl=%s mask=%c%c", LCSTR(lString16(&ch, 1)), hyph.mask0[0], hyph.mask0[1]);
if (hyph.mask0[0]!='0'||hyph.mask0[1]!='0') {
unsigned char pat[4];
pat[0] = hyph.al;
pat[1] = hyph.mask0[0];
pat[2] = hyph.mask0[1];
pat[3] = 0;
TexPattern * pattern = new TexPattern(pat, 1, charMap);
#if DUMP_PATTERNS==1
CRLog::debug("Pattern: '%s' - %s", LCSTR(lString16(pattern->word)), pattern->attr );
#endif
addPattern( pattern );
patternCount++;
}
}
if ( stream->SetPos(p)!=p )
return false;
for (i=0; i<hyph_count; i++)
{
stream->Read( &hyph, 522, &dw );
if (dw!=522)
return false;
cnv.msf( &hyph.len );
stream->Read(buf, hyph.len, &dw);
if (dw!=hyph.len)
return false;
unsigned char * p = buf;
unsigned char * end_p = p + hyph.len;
while ( p < end_p ) {
lUInt8 sz = *p++;
if ( p + sz > end_p )
break;
TexPattern * pattern = new TexPattern( p, sz, charMap );
#if DUMP_PATTERNS==1
CRLog::debug("Pattern: '%s' - %s", LCSTR(lString16(pattern->word)), pattern->attr);
#endif
addPattern( pattern );
patternCount++;
p += sz + sz + 1;
}
}
return patternCount>0;
} else {
// tex xml format as for FBReader
lString16Collection data;
HyphPatternReader reader( data );
LVXMLParser parser( stream, &reader );
if ( !parser.CheckFormat() )
return false;
if ( !parser.Parse() )
return false;
if ( !data.length() )
return false;
for ( int i=0; i<(int)data.length(); i++ ) {
data[i].lowercase();
TexPattern * pattern = new TexPattern( data[i] );
#if DUMP_PATTERNS==1
CRLog::debug("Pattern: (%s) '%s' - %s", LCSTR(data[i]), LCSTR(lString16(pattern->word)), pattern->attr);
#endif
//.........这里部分代码省略.........