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

Method allocText

crengine/src/lvtinydom.cpp:2155–2176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2153
2154#if BUILD_LITE!=1
2155lUInt32 ldomDataStorageManager::allocText( lUInt32 dataIndex, lUInt32 parentIndex, const lString8 & text )
2156{
2157 if ( !_activeChunk ) {
2158 _activeChunk = new ldomTextStorageChunk(this, _chunks.length());
2159 _chunks.add( _activeChunk );
2160 getChunk( (_chunks.length()-1)<<16 );
2161 compact( 0 );
2162 }
2163 int offset = _activeChunk->addText( dataIndex, parentIndex, text );
2164 if ( offset<0 ) {
2165 // no space in current chunk, add one more chunk
2166 //_activeChunk->compact();
2167 _activeChunk = new ldomTextStorageChunk(this, _chunks.length());
2168 _chunks.add( _activeChunk );
2169 getChunk( (_chunks.length()-1)<<16 );
2170 compact( 0 );
2171 offset = _activeChunk->addText( dataIndex, parentIndex, text );
2172 if ( offset<0 )
2173 crFatalError(1001, "Unexpected error while allocation of text");
2174 }
2175 return offset | (_activeChunk->getIndex()<<16);
2176}
2177
2178lUInt32 ldomDataStorageManager::allocElem( lUInt32 dataIndex, lUInt32 parentIndex, int childCount, int attrCount )
2179{

Callers 2

insertChildTextMethod · 0.80
persistMethod · 0.80

Calls 5

addTextMethod · 0.80
crFatalErrorFunction · 0.70
lengthMethod · 0.45
addMethod · 0.45
getIndexMethod · 0.45

Tested by

no test coverage detected