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

Function MMapTest

cr3gui/src/cr3win.cpp:335–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333
334#ifdef _DEBUG
335void MMapTest()
336{
337 // write
338 {
339 LVStreamRef stream = LVMapFileStream( "c:\\cr3\\mapfile.dat", LVOM_APPEND, 1000000 );
340 LVStreamBufferRef buf = stream->GetWriteBuffer( 0, stream->GetSize() );
341 lUInt32 * p = (lUInt32*)buf->getReadWrite();
342 for ( lUInt32 i=0; i<1000000/4; i++ ) {
343 p[i] = i;
344 }
345 }
346 // read
347 {
348 LVStreamRef stream = LVMapFileStream( "c:\\cr3\\mapfile.dat", LVOM_READ, 1000000 );
349 LVStreamBufferRef buf = stream->GetReadBuffer( 0, stream->GetSize() );
350 const lUInt32 * p = (const lUInt32*)buf->getReadOnly();
351 for ( lUInt32 i=0; i<1000000/4; i++ ) {
352 if ( p[i]!=i ) {
353 CRLog::error("MMapTest failed!!!");
354 break;
355 }
356 }
357 }
358}
359#endif
360
361int APIENTRY WinMain(HINSTANCE hInstance,

Callers 1

WinMainFunction · 0.85

Calls 6

LVMapFileStreamFunction · 0.85
GetWriteBufferMethod · 0.45
GetSizeMethod · 0.45
getReadWriteMethod · 0.45
GetReadBufferMethod · 0.45
getReadOnlyMethod · 0.45

Tested by

no test coverage detected