MCPcopy Create free account
hub / github.com/buggins/coolreader / find

Method find

crengine/src/lvstring.cpp:1234–1253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1232}
1233
1234size_t lString16HashedCollection::find( const lChar16 * s )
1235{
1236 if ( !hash || !length() )
1237 return (size_t)-1;
1238 lUInt32 h = calcStringHash( s );
1239 lUInt32 n = h % hashSize;
1240 if ( hash[n].index!=-1 )
1241 {
1242 const lString16 & str = at( hash[n].index );
1243 if ( str == s )
1244 return hash[n].index;
1245 HashPair * p = hash[n].next;
1246 for ( ;p ;p = p->next ) {
1247 const lString16 & str = at( p->index );
1248 if ( str==s )
1249 return p->index;
1250 }
1251 }
1252 return (size_t)-1;
1253}
1254
1255void lString16HashedCollection::reHash( int newSize )
1256{

Callers

nothing calls this directly

Calls 1

calcStringHashFunction · 0.85

Tested by

no test coverage detected