Global Metrics
path: .metrics.nexits.average
old: 1.5961538461538465
new: 1.6764705882352942
path: .metrics.nexits.sum
old: 166.0
new: 57.0
path: .metrics.loc.sloc
old: 1885.0
new: 645.0
path: .metrics.loc.blank
old: 296.0
new: 102.0
path: .metrics.loc.ploc
old: 1506.0
new: 481.0
path: .metrics.loc.lloc
old: 701.0
new: 221.0
path: .metrics.loc.cloc
old: 83.0
new: 62.0
path: .metrics.cognitive.average
old: 0.9807692307692308
new: 1.8235294117647056
path: .metrics.cognitive.sum
old: 102.0
new: 62.0
path: .metrics.cyclomatic.average
old: 3.7904761904761903
new: 2.4444444444444446
path: .metrics.cyclomatic.sum
old: 398.0
new: 88.0
path: .metrics.mi.mi_sei
old: -163.21791373141616
new: -49.49998607041337
path: .metrics.mi.mi_original
old: -99.82050732272867
new: -4.063219618674395
path: .metrics.nom.functions
old: 104.0
new: 34.0
path: .metrics.nom.total
old: 104.0
new: 34.0
path: .metrics.halstead.vocabulary
old: 449.0
new: 238.0
path: .metrics.halstead.level
old: 0.009170441424638067
new: 0.013375004200692271
path: .metrics.halstead.length
old: 6673.0
new: 1907.0
path: .metrics.halstead.effort
old: 6411135.712689868
new: 1125638.3361620924
path: .metrics.halstead.N1
old: 4171.0
new: 1144.0
path: .metrics.halstead.estimated_program_length
old: 3775.0864622481545
new: 1725.818986023814
path: .metrics.halstead.difficulty
old: 109.046004842615
new: 74.76633165829146
path: .metrics.halstead.n2
old: 413.0
new: 199.0
path: .metrics.halstead.purity_ratio
old: 0.5657255300836437
new: 0.90499160252953
path: .metrics.halstead.time
old: 356174.2062605482
new: 62535.46312011624
path: .metrics.halstead.bugs
old: 11.503642910077492
new: 3.606987708011563
path: .metrics.halstead.volume
old: 58792.94451862767
new: 15055.417474628248
path: .metrics.halstead.n1
old: 36.0
new: 39.0
path: .metrics.halstead.N2
old: 2502.0
new: 763.0
path: .metrics.nargs.average
old: 1.1730769230769231
new: 1.8235294117647056
path: .metrics.nargs.sum
old: 122.0
new: 62.0
Spaces Data
Minimal test - lines (269, 272)
path: .spaces[12].metrics.halstead.purity_ratio
old: 0.9694680336029704
new: 2.1333333333333333
path: .spaces[12].metrics.halstead.difficulty
old: 25.24390243902439
new: 5.0
path: .spaces[12].metrics.halstead.bugs
old: 0.4226171603689381
new: 0.013885962850227664
path: .spaces[12].metrics.halstead.length
old: 304.0
new: 15.0
path: .spaces[12].metrics.halstead.effort
old: 45144.26363539536
new: 268.87218755408674
path: .spaces[12].metrics.halstead.time
old: 2508.014646410853
new: 14.937343753004818
path: .spaces[12].metrics.halstead.volume
old: 1788.3234870059998
new: 53.77443751081734
path: .spaces[12].metrics.halstead.vocabulary
old: 59.0
new: 12.0
path: .spaces[12].metrics.halstead.n2
old: 41.0
new: 4.0
path: .spaces[12].metrics.halstead.level
old: 0.03961352657004831
new: 0.2
path: .spaces[12].metrics.halstead.N1
old: 189.0
new: 10.0
path: .spaces[12].metrics.halstead.N2
old: 115.0
new: 5.0
path: .spaces[12].metrics.halstead.n1
old: 18.0
new: 8.0
path: .spaces[12].metrics.halstead.estimated_program_length
old: 294.718282215303
new: 32.0
path: .spaces[12].metrics.loc.sloc
old: 60.0
new: 4.0
path: .spaces[12].metrics.loc.blank
old: 2.0
new: 0.0
path: .spaces[12].metrics.loc.lloc
old: 41.0
new: 2.0
path: .spaces[12].metrics.loc.ploc
old: 58.0
new: 4.0
path: .spaces[12].metrics.mi.mi_sei
old: 16.595533890757764
new: 108.4759871562677
path: .spaces[12].metrics.mi.mi_visual_studio
old: 36.95827018557415
new: 74.61466703602454
path: .spaces[12].metrics.mi.mi_original
old: 63.19864201733179
new: 127.59108063160195
path: .spaces[12].metrics.nexits.average
old: 2.0
new: 1.0
path: .spaces[12].metrics.nexits.sum
old: 2.0
new: 1.0
path: .spaces[12].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[12].metrics.nargs.average
old: 2.0
new: 1.0
path: .spaces[12].metrics.cognitive.average
old: 3.0
new: 0.0
path: .spaces[12].metrics.cognitive.sum
old: 3.0
new: 0.0
path: .spaces[12].metrics.cyclomatic.sum
old: 11.0
new: 1.0
path: .spaces[12].metrics.cyclomatic.average
old: 11.0
new: 1.0
Code
nsStorageStream::GetWriteInProgress(bool* aWriteInProgress) {
*aWriteInProgress = mWriteInProgress;
return NS_OK;
}
Minimal test - lines (69, 80)
path: .spaces[2].metrics.mi.mi_original
old: 124.68625431117268
new: 102.19868814350168
path: .spaces[2].metrics.mi.mi_sei
old: 104.2852086291407
new: 93.56707024447722
path: .spaces[2].metrics.mi.mi_visual_studio
old: 72.91593819366824
new: 59.76531470380215
path: .spaces[2].metrics.halstead.N2
old: 10.0
new: 18.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 52.529325012980806
new: 81.32499728470782
path: .spaces[2].metrics.halstead.N1
old: 13.0
new: 31.0
path: .spaces[2].metrics.halstead.time
old: 29.378639171486817
new: 144.07544830041584
path: .spaces[2].metrics.halstead.bugs
old: 0.021797910521911084
new: 0.06291976159671817
path: .spaces[2].metrics.halstead.purity_ratio
old: 2.2838836962165567
new: 1.6596938221368942
path: .spaces[2].metrics.halstead.volume
old: 94.0116453487578
new: 221.65453584679364
path: .spaces[2].metrics.halstead.n2
old: 8.0
new: 10.0
path: .spaces[2].metrics.halstead.difficulty
old: 5.625
new: 11.7
path: .spaces[2].metrics.halstead.level
old: 0.17777777777777778
new: 0.08547008547008547
path: .spaces[2].metrics.halstead.n1
old: 9.0
new: 13.0
path: .spaces[2].metrics.halstead.vocabulary
old: 17.0
new: 23.0
path: .spaces[2].metrics.halstead.effort
old: 528.8155050867626
new: 2593.3580694074853
path: .spaces[2].metrics.halstead.length
old: 23.0
new: 49.0
path: .spaces[2].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[2].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[2].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[2].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[2].metrics.loc.lloc
old: 1.0
new: 6.0
path: .spaces[2].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[2].metrics.loc.sloc
old: 4.0
new: 12.0
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[2].metrics.loc.ploc
old: 4.0
new: 9.0
path: .spaces[2].metrics.nexits.average
old: 1.0
new: 2.0
path: .spaces[2].metrics.nexits.sum
old: 1.0
new: 2.0
Code
nsStorageStream::Init(uint32_t aSegmentSize, uint32_t aMaxSize) {
mSegmentedBuffer = new nsSegmentedBuffer();
mSegmentSize = aSegmentSize;
mSegmentSizeLog2 = mozilla::FloorLog2(aSegmentSize);
// Segment size must be a power of two
if (mSegmentSize != ((uint32_t)1 << mSegmentSizeLog2)) {
return NS_ERROR_INVALID_ARG;
}
return mSegmentedBuffer->Init(aSegmentSize, aMaxSize);
}
Minimal test - lines (379, 395)
path: .spaces[15].metrics.mi.mi_original
old: 97.7036304632266
new: 94.70630883585642
path: .spaces[15].metrics.mi.mi_sei
old: 98.32081474848908
new: 61.23692968458931
path: .spaces[15].metrics.mi.mi_visual_studio
old: 57.1366260018869
new: 55.38380633675814
path: .spaces[15].metrics.loc.cloc
old: 3.0
new: 0.0
path: .spaces[15].metrics.loc.blank
old: 1.0
new: 3.0
path: .spaces[15].metrics.loc.lloc
old: 3.0
new: 6.0
path: .spaces[15].metrics.loc.ploc
old: 10.0
new: 14.0
path: .spaces[15].metrics.loc.sloc
old: 14.0
new: 17.0
path: .spaces[15].metrics.nargs.sum
old: 4.0
new: 2.0
path: .spaces[15].metrics.nargs.average
old: 4.0
new: 2.0
path: .spaces[15].metrics.cyclomatic.average
old: 2.0
new: 3.0
path: .spaces[15].metrics.cyclomatic.sum
old: 2.0
new: 3.0
path: .spaces[15].metrics.nexits.average
old: 2.0
new: 3.0
path: .spaces[15].metrics.nexits.sum
old: 2.0
new: 3.0
path: .spaces[15].metrics.halstead.n1
old: 12.0
new: 16.0
path: .spaces[15].metrics.halstead.purity_ratio
old: 1.679200273282233
new: 2.2247811383542624
path: .spaces[15].metrics.halstead.volume
old: 325.4847266735473
new: 302.6636471615072
path: .spaces[15].metrics.halstead.level
old: 0.10493827160493828
new: 0.08854166666666666
path: .spaces[15].metrics.halstead.bugs
old: 0.07089406571760533
new: 0.07564039548874765
path: .spaces[15].metrics.halstead.N1
old: 40.0
new: 36.0
path: .spaces[15].metrics.halstead.difficulty
old: 9.529411764705882
new: 11.294117647058824
path: .spaces[15].metrics.halstead.vocabulary
old: 29.0
new: 33.0
path: .spaces[15].metrics.halstead.estimated_program_length
old: 112.50641830990963
new: 133.48686830125575
path: .spaces[15].metrics.halstead.effort
old: 3101.67798359498
new: 3418.3188385299636
path: .spaces[15].metrics.halstead.length
old: 67.0
new: 60.0
path: .spaces[15].metrics.halstead.time
old: 172.31544353305446
new: 189.90660214055353
path: .spaces[15].metrics.halstead.N2
old: 27.0
new: 24.0
path: .spaces[15].metrics.cognitive.sum
old: 1.0
new: 2.0
path: .spaces[15].metrics.cognitive.average
old: 1.0
new: 2.0
Code
nsStorageStream::NewInputStream(int32_t aStartingOffset,
nsIInputStream** aInputStream) {
if (NS_WARN_IF(!mSegmentedBuffer)) {
return NS_ERROR_NOT_INITIALIZED;
}
RefPtr inputStream =
new nsStorageInputStream(this, mSegmentSize);
nsresult rv = inputStream->Seek(aStartingOffset);
if (NS_FAILED(rv)) {
return rv;
}
inputStream.forget(aInputStream);
return NS_OK;
}
Minimal test - lines (404, 411)
path: .spaces[17].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[17].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[17].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[17].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[17].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[17].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[17].metrics.loc.ploc
old: 3.0
new: 7.0
path: .spaces[17].metrics.loc.sloc
old: 3.0
new: 8.0
path: .spaces[17].metrics.loc.lloc
old: 1.0
new: 4.0
path: .spaces[17].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[17].metrics.halstead.vocabulary
old: 11.0
new: 19.0
path: .spaces[17].metrics.halstead.N2
old: 6.0
new: 10.0
path: .spaces[17].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 62.05374780501027
path: .spaces[17].metrics.halstead.purity_ratio
old: 1.5066341932646528
new: 2.2162052787503668
path: .spaces[17].metrics.halstead.level
old: 0.2777777777777778
new: 0.14545454545454545
path: .spaces[17].metrics.halstead.n2
old: 5.0
new: 8.0
path: .spaces[17].metrics.halstead.time
old: 12.45395382709427
new: 45.42922479654945
path: .spaces[17].metrics.halstead.N1
old: 12.0
new: 18.0
path: .spaces[17].metrics.halstead.volume
old: 62.26976913547135
new: 118.9419703764204
path: .spaces[17].metrics.halstead.n1
old: 6.0
new: 11.0
path: .spaces[17].metrics.halstead.length
old: 18.0
new: 28.0
path: .spaces[17].metrics.halstead.bugs
old: 0.012300759181837836
new: 0.029148573077026212
path: .spaces[17].metrics.halstead.difficulty
old: 3.6
new: 6.875
path: .spaces[17].metrics.halstead.effort
old: 224.1711688876969
new: 817.7260463378901
path: .spaces[17].metrics.mi.mi_visual_studio
old: 76.89403824812207
new: 65.49949779376381
path: .spaces[17].metrics.mi.mi_original
old: 131.48880540428874
new: 112.0041412273361
path: .spaces[17].metrics.mi.mi_sei
old: 114.099215356573
new: 86.0906068345011
Code
nsStorageInputStream::Available(uint64_t* aAvailable) {
if (NS_FAILED(mStatus)) {
return mStatus;
}
*aAvailable = mStorageStream->mLogicalLength - mLogicalCursor;
return NS_OK;
}
Minimal test - lines (148, 212)
path: .spaces[6].metrics.cognitive.average
old: 3.0
new: 11.0
path: .spaces[6].metrics.cognitive.sum
old: 3.0
new: 11.0
path: .spaces[6].metrics.loc.lloc
old: 30.0
new: 33.0
path: .spaces[6].metrics.loc.blank
old: 0.0
new: 6.0
path: .spaces[6].metrics.loc.cloc
old: 0.0
new: 6.0
path: .spaces[6].metrics.loc.ploc
old: 38.0
new: 53.0
path: .spaces[6].metrics.loc.sloc
old: 38.0
new: 65.0
path: .spaces[6].metrics.cyclomatic.average
old: 10.0
new: 8.0
path: .spaces[6].metrics.cyclomatic.sum
old: 10.0
new: 8.0
path: .spaces[6].metrics.mi.mi_visual_studio
old: 42.95925795821373
new: 37.51787029821227
path: .spaces[6].metrics.mi.mi_original
old: 73.46033110854549
new: 64.15555820994298
path: .spaces[6].metrics.mi.mi_sei
old: 31.29820199439172
new: 40.345178063586445
path: .spaces[6].metrics.nexits.sum
old: 10.0
new: 3.0
path: .spaces[6].metrics.nexits.average
old: 10.0
new: 3.0
path: .spaces[6].metrics.halstead.effort
old: 18017.607753270822
new: 34940.323454965095
path: .spaces[6].metrics.halstead.n2
old: 35.0
new: 37.0
path: .spaces[6].metrics.halstead.difficulty
old: 16.714285714285715
new: 26.39189189189189
path: .spaces[6].metrics.halstead.bugs
old: 0.2290921267423179
new: 0.3562569613614183
path: .spaces[6].metrics.halstead.N1
old: 113.0
new: 133.0
path: .spaces[6].metrics.halstead.level
old: 0.059829059829059825
new: 0.03789042498719918
path: .spaces[6].metrics.halstead.estimated_program_length
old: 238.1282645272016
new: 284.98844040662516
path: .spaces[6].metrics.halstead.purity_ratio
old: 1.2467448404565529
new: 1.2610107982594034
path: .spaces[6].metrics.halstead.n1
old: 15.0
new: 21.0
path: .spaces[6].metrics.halstead.length
old: 191.0
new: 226.0
path: .spaces[6].metrics.halstead.N2
old: 78.0
new: 93.0
path: .spaces[6].metrics.halstead.volume
old: 1077.9765322469725
new: 1323.9037048988312
path: .spaces[6].metrics.halstead.vocabulary
old: 50.0
new: 58.0
path: .spaces[6].metrics.halstead.time
old: 1000.9782085150456
new: 1941.1290808313945
path: .spaces[6].metrics.nargs.sum
old: 1.0
new: 3.0
path: .spaces[6].metrics.nargs.average
old: 1.0
new: 3.0
Code
nsStorageStream::Write(const char* aBuffer, uint32_t aCount,
uint32_t* aNumWritten) {
if (NS_WARN_IF(!aNumWritten) || NS_WARN_IF(!aBuffer)) {
return NS_ERROR_INVALID_ARG;
}
if (NS_WARN_IF(!mSegmentedBuffer)) {
return NS_ERROR_NOT_INITIALIZED;
}
const char* readCursor;
uint32_t count, availableInSegment, remaining;
nsresult rv = NS_OK;
LOG(("nsStorageStream [%p] Write mWriteCursor=%p mSegmentEnd=%p aCount=%d\n",
this, mWriteCursor, mSegmentEnd, aCount));
remaining = aCount;
readCursor = aBuffer;
// If no segments have been created yet, create one even if we don't have
// to write any data; this enables creating an input stream which reads from
// the very end of the data for any amount of data in the stream (i.e.
// this stream contains N bytes of data and newInputStream(N) is called),
// even for N=0 (with the caveat that we require .write("", 0) be called to
// initialize internal buffers).
bool firstTime = mSegmentedBuffer->GetSegmentCount() == 0;
while (remaining || MOZ_UNLIKELY(firstTime)) {
firstTime = false;
availableInSegment = mSegmentEnd - mWriteCursor;
if (!availableInSegment) {
mWriteCursor = mSegmentedBuffer->AppendNewSegment();
if (!mWriteCursor) {
mSegmentEnd = 0;
rv = NS_ERROR_OUT_OF_MEMORY;
goto out;
}
mLastSegmentNum++;
mSegmentEnd = mWriteCursor + mSegmentSize;
availableInSegment = mSegmentEnd - mWriteCursor;
LOG(
("nsStorageStream [%p] Write (new seg) mWriteCursor=%p "
"mSegmentEnd=%p\n",
this, mWriteCursor, mSegmentEnd));
}
count = XPCOM_MIN(availableInSegment, remaining);
memcpy(mWriteCursor, readCursor, count);
remaining -= count;
readCursor += count;
mWriteCursor += count;
LOG(
("nsStorageStream [%p] Writing mWriteCursor=%p mSegmentEnd=%p "
"count=%d\n",
this, mWriteCursor, mSegmentEnd, count));
}
out:
*aNumWritten = aCount - remaining;
mLogicalLength += *aNumWritten;
LOG(
("nsStorageStream [%p] Wrote mWriteCursor=%p mSegmentEnd=%p "
"numWritten=%d\n",
this, mWriteCursor, mSegmentEnd, *aNumWritten));
return rv;
}
Minimal test - lines (553, 558)
path: .spaces[25].metrics.halstead.volume
old: 51.89147427955946
new: 162.62707505625016
path: .spaces[25].metrics.halstead.N1
old: 9.0
new: 24.0
path: .spaces[25].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 57.219280948873624
path: .spaces[25].metrics.halstead.time
old: 10.378294855911893
new: 54.209025018750054
path: .spaces[25].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.03279252157043551
path: .spaces[25].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 1.4671610499711183
path: .spaces[25].metrics.halstead.n2
old: 5.0
new: 10.0
path: .spaces[25].metrics.halstead.level
old: 0.2777777777777778
new: 0.16666666666666666
path: .spaces[25].metrics.halstead.effort
old: 186.8093074064141
new: 975.7624503375008
path: .spaces[25].metrics.halstead.length
old: 15.0
new: 39.0
path: .spaces[25].metrics.halstead.vocabulary
old: 11.0
new: 18.0
path: .spaces[25].metrics.halstead.N2
old: 6.0
new: 15.0
path: .spaces[25].metrics.halstead.difficulty
old: 3.6
new: 6.0
path: .spaces[25].metrics.halstead.n1
old: 6.0
new: 8.0
path: .spaces[25].metrics.loc.sloc
old: 3.0
new: 6.0
path: .spaces[25].metrics.loc.ploc
old: 3.0
new: 6.0
path: .spaces[25].metrics.nargs.average
old: 1.0
new: 6.0
path: .spaces[25].metrics.nargs.sum
old: 1.0
new: 6.0
path: .spaces[25].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 67.40813226703975
path: .spaces[25].metrics.mi.mi_original
old: 132.43687749961728
new: 115.26790617663798
path: .spaces[25].metrics.mi.mi_sei
old: 115.46699426690871
new: 90.69740448208164
Code
void nsStorageInputStream::Serialize(
InputStreamParams& aParams, FileDescriptorArray&, bool aDelayedStart,
uint32_t aMaxSize, uint32_t* aSizeUsed,
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
}
Minimal test - lines (398, 401)
path: .spaces[16].metrics.mi.mi_sei
old: 7.319298270110683
new: 111.37444718573404
path: .spaces[16].metrics.mi.mi_visual_studio
old: 29.73437134294739
new: 75.78955557251007
path: .spaces[16].metrics.mi.mi_original
old: 50.84577499644004
new: 129.60014002899223
path: .spaces[16].metrics.cognitive.sum
old: 9.0
new: 0.0
path: .spaces[16].metrics.cognitive.average
old: 9.0
new: 0.0
path: .spaces[16].metrics.cyclomatic.average
old: 18.0
new: 1.0
path: .spaces[16].metrics.cyclomatic.sum
old: 18.0
new: 1.0
path: .spaces[16].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[16].metrics.nargs.average
old: 1.0
new: 0.0
path: .spaces[16].metrics.halstead.N2
old: 188.0
new: 4.0
path: .spaces[16].metrics.halstead.estimated_program_length
old: 726.6301075898987
new: 23.509775004326936
path: .spaces[16].metrics.halstead.purity_ratio
old: 1.5796306686736927
new: 2.1372522731206307
path: .spaces[16].metrics.halstead.time
old: 3402.9160420937733
new: 6.090201507293497
path: .spaces[16].metrics.halstead.difficulty
old: 19.38144329896907
new: 3.0
path: .spaces[16].metrics.halstead.n2
old: 97.0
new: 4.0
path: .spaces[16].metrics.halstead.effort
old: 61252.48875768792
new: 109.62362713128296
path: .spaces[16].metrics.halstead.length
old: 460.0
new: 11.0
path: .spaces[16].metrics.halstead.volume
old: 3160.367771008366
new: 36.541209043760986
path: .spaces[16].metrics.halstead.level
old: 0.05159574468085107
new: 0.3333333333333333
path: .spaces[16].metrics.halstead.N1
old: 272.0
new: 7.0
path: .spaces[16].metrics.halstead.n1
old: 20.0
new: 6.0
path: .spaces[16].metrics.halstead.vocabulary
old: 117.0
new: 10.0
path: .spaces[16].metrics.halstead.bugs
old: 0.5179580312574428
new: 0.007635102239890672
path: .spaces[16].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[16].metrics.loc.sloc
old: 97.0
new: 4.0
path: .spaces[16].metrics.loc.lloc
old: 71.0
new: 2.0
path: .spaces[16].metrics.loc.blank
old: 13.0
new: 0.0
path: .spaces[16].metrics.loc.ploc
old: 83.0
new: 4.0
Code
nsStorageInputStream::Close() {
mStatus = NS_BASE_STREAM_CLOSED;
return NS_OK;
}
Minimal test - lines (535, 551)
path: .spaces[24].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[24].metrics.cognitive.average
old: 0.0
new: 2.0
path: .spaces[24].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[24].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[24].metrics.halstead.volume
old: 51.89147427955946
new: 350.0
path: .spaces[24].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 1.8337374133538296
path: .spaces[24].metrics.halstead.time
old: 10.378294855911893
new: 226.85185185185185
path: .spaces[24].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 128.36161893476807
path: .spaces[24].metrics.halstead.vocabulary
old: 11.0
new: 32.0
path: .spaces[24].metrics.halstead.n1
old: 6.0
new: 14.0
path: .spaces[24].metrics.halstead.difficulty
old: 3.6
new: 11.666666666666666
path: .spaces[24].metrics.halstead.length
old: 15.0
new: 70.0
path: .spaces[24].metrics.halstead.N2
old: 6.0
new: 30.0
path: .spaces[24].metrics.halstead.level
old: 0.2777777777777778
new: 0.08571428571428572
path: .spaces[24].metrics.halstead.n2
old: 5.0
new: 18.0
path: .spaces[24].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.08515731660893115
path: .spaces[24].metrics.halstead.effort
old: 186.8093074064141
new: 4083.333333333333
path: .spaces[24].metrics.halstead.N1
old: 9.0
new: 40.0
path: .spaces[24].metrics.nexits.average
old: 0.0
new: 3.0
path: .spaces[24].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[24].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[24].metrics.loc.lloc
old: 1.0
new: 9.0
path: .spaces[24].metrics.loc.ploc
old: 3.0
new: 15.0
path: .spaces[24].metrics.loc.sloc
old: 3.0
new: 17.0
path: .spaces[24].metrics.mi.mi_original
old: 132.43687749961728
new: 93.95069142297532
path: .spaces[24].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 54.9419248087575
path: .spaces[24].metrics.mi.mi_sei
old: 115.46699426690871
new: 60.146804190216415
Code
nsresult nsStorageInputStream::Seek(uint32_t aPosition) {
uint32_t length = mStorageStream->mLogicalLength;
if (aPosition > length) {
return NS_ERROR_INVALID_ARG;
}
if (length == 0) {
return NS_OK;
}
mSegmentNum = SegNum(aPosition);
mReadCursor = SegOffset(aPosition);
uint32_t available = length - aPosition;
mSegmentEnd = mReadCursor + XPCOM_MIN(mSegmentSize - mReadCursor, available);
mLogicalCursor = aPosition;
return NS_OK;
}
Minimal test - lines (233, 236)
path: .spaces[10].metrics.loc.lloc
old: 1.0
new: 2.0
path: .spaces[10].metrics.mi.mi_original
old: 125.7821630777101
new: 127.59108063160195
path: .spaces[10].metrics.mi.mi_sei
old: 105.86627077189092
new: 108.4759871562677
path: .spaces[10].metrics.mi.mi_visual_studio
old: 73.55682051328075
new: 74.61466703602454
path: .spaces[10].metrics.halstead.level
old: 0.15873015873015872
new: 0.2
path: .spaces[10].metrics.halstead.effort
old: 479.7267201792581
new: 268.87218755408674
path: .spaces[10].metrics.halstead.n2
old: 5.0
new: 4.0
path: .spaces[10].metrics.halstead.volume
old: 76.14709844115208
new: 53.77443751081734
path: .spaces[10].metrics.halstead.difficulty
old: 6.3
new: 5.0
path: .spaces[10].metrics.halstead.bugs
old: 0.020427161279358765
new: 0.013885962850227664
path: .spaces[10].metrics.halstead.vocabulary
old: 14.0
new: 12.0
path: .spaces[10].metrics.halstead.length
old: 20.0
new: 15.0
path: .spaces[10].metrics.halstead.estimated_program_length
old: 40.13896548741762
new: 32.0
path: .spaces[10].metrics.halstead.n1
old: 9.0
new: 8.0
path: .spaces[10].metrics.halstead.N1
old: 13.0
new: 10.0
path: .spaces[10].metrics.halstead.purity_ratio
old: 2.006948274370881
new: 2.1333333333333333
path: .spaces[10].metrics.halstead.N2
old: 7.0
new: 5.0
path: .spaces[10].metrics.halstead.time
old: 26.651484454403228
new: 14.937343753004818
Code
nsStorageStream::GetLength(uint32_t* aLength) {
*aLength = mLogicalLength;
return NS_OK;
}
Minimal test - lines (215, 218)
path: .spaces[7].metrics.loc.ploc
old: 35.0
new: 4.0
path: .spaces[7].metrics.loc.cloc
old: 3.0
new: 0.0
path: .spaces[7].metrics.loc.lloc
old: 27.0
new: 1.0
path: .spaces[7].metrics.loc.sloc
old: 38.0
new: 4.0
path: .spaces[7].metrics.cognitive.average
old: 1.0
new: 0.0
path: .spaces[7].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[7].metrics.cyclomatic.average
old: 9.0
new: 1.0
path: .spaces[7].metrics.cyclomatic.sum
old: 9.0
new: 1.0
path: .spaces[7].metrics.mi.mi_sei
old: 53.134715121003595
new: 107.08549009080345
path: .spaces[7].metrics.mi.mi_original
old: 74.05287273733475
new: 126.62726151109852
path: .spaces[7].metrics.mi.mi_visual_studio
old: 43.30577353060512
new: 74.05103012344942
path: .spaces[7].metrics.nargs.average
old: 1.0
new: 3.0
path: .spaces[7].metrics.nargs.sum
old: 1.0
new: 3.0
path: .spaces[7].metrics.nexits.average
old: 9.0
new: 1.0
path: .spaces[7].metrics.nexits.sum
old: 9.0
new: 1.0
path: .spaces[7].metrics.halstead.level
old: 0.05925925925925926
new: 0.25
path: .spaces[7].metrics.halstead.bugs
old: 0.22008727249513912
new: 0.013540465538538844
path: .spaces[7].metrics.halstead.length
old: 181.0
new: 17.0
path: .spaces[7].metrics.halstead.vocabulary
old: 47.0
new: 14.0
path: .spaces[7].metrics.halstead.N2
old: 72.0
new: 6.0
path: .spaces[7].metrics.halstead.volume
old: 1005.3805821536524
new: 64.72503367497927
path: .spaces[7].metrics.halstead.N1
old: 109.0
new: 11.0
path: .spaces[7].metrics.halstead.n1
old: 15.0
new: 8.0
path: .spaces[7].metrics.halstead.time
old: 942.5442957690492
new: 14.38334081666206
path: .spaces[7].metrics.halstead.purity_ratio
old: 1.2077533642769491
new: 2.324104412019232
path: .spaces[7].metrics.halstead.n2
old: 32.0
new: 6.0
path: .spaces[7].metrics.halstead.difficulty
old: 16.875
new: 4.0
path: .spaces[7].metrics.halstead.estimated_program_length
old: 218.60335893412775
new: 39.50977500432694
path: .spaces[7].metrics.halstead.effort
old: 16965.797323842886
new: 258.9001346999171
Code
nsStorageStream::WriteFrom(nsIInputStream* aInStr, uint32_t aCount,
uint32_t* aResult) {
return NS_ERROR_NOT_IMPLEMENTED;
}
Minimal test - lines (483, 489)
path: .spaces[20].metrics.halstead.n1
old: 6.0
new: 8.0
path: .spaces[20].metrics.halstead.difficulty
old: 3.6
new: 5.0
path: .spaces[20].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 32.0
path: .spaces[20].metrics.halstead.N2
old: 6.0
new: 5.0
path: .spaces[20].metrics.halstead.N1
old: 9.0
new: 10.0
path: .spaces[20].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 2.1333333333333333
path: .spaces[20].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.013885962850227664
path: .spaces[20].metrics.halstead.time
old: 10.378294855911893
new: 14.937343753004818
path: .spaces[20].metrics.halstead.level
old: 0.2777777777777778
new: 0.2
path: .spaces[20].metrics.halstead.n2
old: 5.0
new: 4.0
path: .spaces[20].metrics.halstead.effort
old: 186.8093074064141
new: 268.87218755408674
path: .spaces[20].metrics.halstead.volume
old: 51.89147427955946
new: 53.77443751081734
path: .spaces[20].metrics.halstead.vocabulary
old: 11.0
new: 12.0
path: .spaces[20].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 69.31304378189948
path: .spaces[20].metrics.mi.mi_original
old: 132.43687749961728
new: 118.5253048670481
path: .spaces[20].metrics.mi.mi_sei
old: 115.46699426690871
new: 132.22850500107398
path: .spaces[20].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[20].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[20].metrics.loc.ploc
old: 3.0
new: 4.0
path: .spaces[20].metrics.loc.cloc
old: 0.0
new: 2.0
path: .spaces[20].metrics.loc.lloc
old: 1.0
new: 2.0
path: .spaces[20].metrics.loc.sloc
old: 3.0
new: 7.0
path: .spaces[20].metrics.loc.blank
old: 0.0
new: 1.0
Code
nsStorageInputStream::IsNonBlocking(bool* aNonBlocking) {
// TODO: This class should implement nsIAsyncInputStream so that callers
// have some way of dealing with NS_BASE_STREAM_WOULD_BLOCK errors.
*aNonBlocking = true;
return NS_OK;
}
Minimal test - lines (530, 533)
path: .spaces[23].metrics.mi.mi_original
old: 132.43687749961728
new: 129.84369470176304
path: .spaces[23].metrics.mi.mi_sei
old: 115.46699426690871
new: 111.72582230432585
path: .spaces[23].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 75.93198520570938
path: .spaces[23].metrics.halstead.level
old: 0.2777777777777778
new: 0.4
path: .spaces[23].metrics.halstead.n2
old: 5.0
new: 4.0
path: .spaces[23].metrics.halstead.vocabulary
old: 11.0
new: 9.0
path: .spaces[23].metrics.halstead.effort
old: 186.8093074064141
new: 87.1729375396636
path: .spaces[23].metrics.halstead.N2
old: 6.0
new: 4.0
path: .spaces[23].metrics.halstead.volume
old: 51.89147427955946
new: 34.86917501586544
path: .spaces[23].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 1.7826945885851644
path: .spaces[23].metrics.halstead.difficulty
old: 3.6
new: 2.5
path: .spaces[23].metrics.halstead.N1
old: 9.0
new: 7.0
path: .spaces[23].metrics.halstead.length
old: 15.0
new: 11.0
path: .spaces[23].metrics.halstead.time
old: 10.378294855911893
new: 4.842940974425755
path: .spaces[23].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.006553397824358721
path: .spaces[23].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 19.60964047443681
path: .spaces[23].metrics.halstead.n1
old: 6.0
new: 5.0
path: .spaces[23].metrics.loc.ploc
old: 3.0
new: 4.0
path: .spaces[23].metrics.loc.sloc
old: 3.0
new: 4.0
path: .spaces[23].metrics.loc.lloc
old: 1.0
new: 2.0
path: .spaces[23].metrics.nargs.average
old: 1.0
new: 0.0
path: .spaces[23].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[23].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[23].metrics.nexits.sum
old: 0.0
new: 1.0
Code
nsStorageInputStream::SetEOF() {
MOZ_ASSERT_UNREACHABLE("nsStorageInputStream::SetEOF");
return NS_ERROR_NOT_IMPLEMENTED;
}
Minimal test - lines (240, 266)
path: .spaces[11].metrics.mi.mi_sei
old: 35.57817040379873
new: 48.027573301630895
path: .spaces[11].metrics.mi.mi_original
old: 60.96477570579857
new: 85.33855225658363
path: .spaces[11].metrics.mi.mi_visual_studio
old: 35.65191561742607
new: 49.90558611496118
path: .spaces[11].metrics.halstead.bugs
old: 0.4393136619142136
new: 0.09121197939525948
path: .spaces[11].metrics.halstead.N2
old: 120.0
new: 27.0
path: .spaces[11].metrics.halstead.difficulty
old: 25.714285714285715
new: 11.911764705882351
path: .spaces[11].metrics.halstead.estimated_program_length
old: 301.5359817826695
new: 128.09022723538357
path: .spaces[11].metrics.halstead.volume
old: 1860.6705376166833
new: 380.0
path: .spaces[11].metrics.halstead.n2
old: 42.0
new: 17.0
path: .spaces[11].metrics.halstead.effort
old: 47845.813824429
new: 4526.470588235295
path: .spaces[11].metrics.halstead.N1
old: 195.0
new: 49.0
path: .spaces[11].metrics.halstead.time
old: 2658.1007680238336
new: 251.47058823529417
path: .spaces[11].metrics.halstead.level
old: 0.03888888888888889
new: 0.08395061728395062
path: .spaces[11].metrics.halstead.purity_ratio
old: 0.9572570850243476
new: 1.685397726781363
path: .spaces[11].metrics.halstead.vocabulary
old: 60.0
new: 32.0
path: .spaces[11].metrics.halstead.length
old: 315.0
new: 76.0
path: .spaces[11].metrics.halstead.n1
old: 18.0
new: 15.0
path: .spaces[11].metrics.nargs.sum
old: 2.0
new: 1.0
path: .spaces[11].metrics.nargs.average
old: 2.0
new: 1.0
path: .spaces[11].metrics.cyclomatic.average
old: 11.0
new: 6.0
path: .spaces[11].metrics.cyclomatic.sum
old: 11.0
new: 6.0
path: .spaces[11].metrics.cognitive.sum
old: 3.0
new: 5.0
path: .spaces[11].metrics.cognitive.average
old: 3.0
new: 5.0
path: .spaces[11].metrics.loc.lloc
old: 42.0
new: 13.0
path: .spaces[11].metrics.loc.blank
old: 2.0
new: 5.0
path: .spaces[11].metrics.loc.ploc
old: 60.0
new: 22.0
path: .spaces[11].metrics.loc.sloc
old: 68.0
new: 27.0
path: .spaces[11].metrics.loc.cloc
old: 6.0
new: 0.0
path: .spaces[11].metrics.nexits.sum
old: 2.0
new: 4.0
path: .spaces[11].metrics.nexits.average
old: 2.0
new: 4.0
Code
nsStorageStream::SetLength(uint32_t aLength) {
if (NS_WARN_IF(!mSegmentedBuffer)) {
return NS_ERROR_NOT_INITIALIZED;
}
if (mWriteInProgress) {
return NS_ERROR_NOT_AVAILABLE;
}
if (aLength > mLogicalLength) {
return NS_ERROR_INVALID_ARG;
}
int32_t newLastSegmentNum = SegNum(aLength);
int32_t segmentOffset = SegOffset(aLength);
if (segmentOffset == 0) {
newLastSegmentNum--;
}
while (newLastSegmentNum < mLastSegmentNum) {
mSegmentedBuffer->DeleteLastSegment();
mLastSegmentNum--;
}
mLogicalLength = aLength;
return NS_OK;
}
Minimal test - lines (274, 319)
path: .spaces[13].metrics.cognitive.average
old: 4.0
new: 7.0
path: .spaces[13].metrics.cognitive.sum
old: 4.0
new: 7.0
path: .spaces[13].metrics.cyclomatic.average
old: 4.0
new: 7.0
path: .spaces[13].metrics.cyclomatic.sum
old: 4.0
new: 7.0
path: .spaces[13].metrics.halstead.effort
old: 3748.5
new: 13475.80591094916
path: .spaces[13].metrics.halstead.bugs
old: 0.0804359919668689
new: 0.1887622926377624
path: .spaces[13].metrics.halstead.length
old: 63.0
new: 134.0
path: .spaces[13].metrics.halstead.level
old: 0.08403361344537814
new: 0.0532741398446171
path: .spaces[13].metrics.halstead.n2
old: 15.0
new: 24.0
path: .spaces[13].metrics.halstead.N1
old: 42.0
new: 81.0
path: .spaces[13].metrics.halstead.vocabulary
old: 32.0
new: 41.0
path: .spaces[13].metrics.halstead.purity_ratio
old: 2.0331782100854534
new: 1.339746032228086
path: .spaces[13].metrics.halstead.estimated_program_length
old: 128.09022723538357
new: 179.5259683185635
path: .spaces[13].metrics.halstead.N2
old: 21.0
new: 53.0
path: .spaces[13].metrics.halstead.difficulty
old: 11.9
new: 18.770833333333332
path: .spaces[13].metrics.halstead.time
old: 208.25
new: 748.65588394162
path: .spaces[13].metrics.halstead.volume
old: 315.0
new: 717.9119686188233
path: .spaces[13].metrics.nexits.sum
old: 3.0
new: 4.0
path: .spaces[13].metrics.nexits.average
old: 3.0
new: 4.0
path: .spaces[13].metrics.loc.sloc
old: 15.0
new: 46.0
path: .spaces[13].metrics.loc.blank
old: 0.0
new: 7.0
path: .spaces[13].metrics.loc.cloc
old: 0.0
new: 8.0
path: .spaces[13].metrics.loc.ploc
old: 15.0
new: 31.0
path: .spaces[13].metrics.loc.lloc
old: 9.0
new: 20.0
path: .spaces[13].metrics.mi.mi_original
old: 96.29620902025091
new: 73.16900521009156
path: .spaces[13].metrics.mi.mi_sei
old: 63.632490655528144
new: 60.67463673577416
path: .spaces[13].metrics.mi.mi_visual_studio
old: 56.313572526462536
new: 42.788891935726056
Code
nsresult nsStorageStream::Seek(int32_t aPosition) {
if (NS_WARN_IF(!mSegmentedBuffer)) {
return NS_ERROR_NOT_INITIALIZED;
}
// An argument of -1 means "seek to end of stream"
if (aPosition == -1) {
aPosition = mLogicalLength;
}
// Seeking beyond the buffer end is illegal
if ((uint32_t)aPosition > mLogicalLength) {
return NS_ERROR_INVALID_ARG;
}
// Seeking backwards in the write stream results in truncation
SetLength(aPosition);
// Special handling for seek to start-of-buffer
if (aPosition == 0) {
mWriteCursor = 0;
mSegmentEnd = 0;
LOG(("nsStorageStream [%p] Seek mWriteCursor=%p mSegmentEnd=%p\n", this,
mWriteCursor, mSegmentEnd));
return NS_OK;
}
// Segment may have changed, so reset pointers
mWriteCursor = mSegmentedBuffer->GetSegment(mLastSegmentNum);
NS_ASSERTION(mWriteCursor, "null mWriteCursor");
mSegmentEnd = mWriteCursor + mSegmentSize;
// Adjust write cursor for current segment offset. This test is necessary
// because SegNum may reference the next-to-be-allocated segment, in which
// case we need to be pointing at the end of the last segment.
int32_t segmentOffset = SegOffset(aPosition);
if (segmentOffset == 0 && (SegNum(aPosition) > (uint32_t)mLastSegmentNum)) {
mWriteCursor = mSegmentEnd;
} else {
mWriteCursor += segmentOffset;
}
LOG(("nsStorageStream [%p] Seek mWriteCursor=%p mSegmentEnd=%p\n", this,
mWriteCursor, mSegmentEnd));
return NS_OK;
}
Minimal test - lines (52, 62)
path: .spaces[0].metrics.cognitive.average
old: 1.0
new: 0.0
path: .spaces[0].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 66.58307281799108
new: 68.81274391313339
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.5853112575712165
new: 1.638398664598414
path: .spaces[0].metrics.halstead.time
old: 92.44123980731302
new: 41.05831690142995
path: .spaces[0].metrics.halstead.level
old: 0.1090909090909091
new: 0.2456140350877193
path: .spaces[0].metrics.halstead.bugs
old: 0.04680629402001702
new: 0.02724757418187592
path: .spaces[0].metrics.halstead.difficulty
old: 9.166666666666666
new: 4.071428571428571
path: .spaces[0].metrics.halstead.N1
old: 27.0
new: 23.0
path: .spaces[0].metrics.halstead.n2
old: 9.0
new: 14.0
path: .spaces[0].metrics.halstead.n1
old: 11.0
new: 6.0
path: .spaces[0].metrics.halstead.effort
old: 1663.9423165316346
new: 739.049704225739
path: .spaces[0].metrics.halstead.N2
old: 15.0
new: 19.0
path: .spaces[0].metrics.mi.mi_visual_studio
old: 63.09814701939025
new: 61.33155914425175
path: .spaces[0].metrics.mi.mi_original
old: 107.89783140315733
new: 104.87696613667048
path: .spaces[0].metrics.mi.mi_sei
old: 80.16645401480473
new: 75.70644681624599
path: .spaces[0].metrics.nargs.average
old: 2.0
new: 0.0
path: .spaces[0].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[0].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[0].metrics.nexits.average
old: 2.0
new: 0.0
path: .spaces[0].metrics.loc.lloc
old: 4.0
new: 1.0
path: .spaces[0].metrics.loc.ploc
old: 9.0
new: 11.0
path: .spaces[0].metrics.loc.sloc
old: 9.0
new: 11.0
path: .spaces[0].metrics.cyclomatic.sum
old: 2.0
new: 1.0
path: .spaces[0].metrics.cyclomatic.average
old: 2.0
new: 1.0
Code
nsStorageStream::nsStorageStream()
: mSegmentedBuffer(0),
mSegmentSize(0),
mSegmentSizeLog2(0),
mWriteInProgress(false),
mLastSegmentNum(-1),
mWriteCursor(0),
mSegmentEnd(0),
mLogicalLength(0) {
LOG(("Creating nsStorageStream [%p].\n", this));
}
Minimal test - lines (520, 527)
path: .spaces[22].metrics.halstead.N2
old: 6.0
new: 8.0
path: .spaces[22].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.02271649062674012
path: .spaces[22].metrics.halstead.effort
old: 186.8093074064141
new: 562.5922457676267
path: .spaces[22].metrics.halstead.n2
old: 5.0
new: 6.0
path: .spaces[22].metrics.halstead.length
old: 15.0
new: 24.0
path: .spaces[22].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 1.834962500721156
path: .spaces[22].metrics.halstead.n1
old: 6.0
new: 9.0
path: .spaces[22].metrics.halstead.volume
old: 51.89147427955946
new: 93.76537429460444
path: .spaces[22].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 44.039100017307746
path: .spaces[22].metrics.halstead.N1
old: 9.0
new: 16.0
path: .spaces[22].metrics.halstead.difficulty
old: 3.6
new: 6.0
path: .spaces[22].metrics.halstead.vocabulary
old: 11.0
new: 15.0
path: .spaces[22].metrics.halstead.time
old: 10.378294855911893
new: 31.255124764868143
path: .spaces[22].metrics.halstead.level
old: 0.2777777777777778
new: 0.16666666666666666
path: .spaces[22].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[22].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[22].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[22].metrics.loc.ploc
old: 3.0
new: 7.0
path: .spaces[22].metrics.loc.sloc
old: 3.0
new: 8.0
path: .spaces[22].metrics.loc.lloc
old: 1.0
new: 4.0
path: .spaces[22].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[22].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[22].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[22].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[22].metrics.mi.mi_sei
old: 115.46699426690871
new: 87.87488654298986
path: .spaces[22].metrics.mi.mi_original
old: 132.43687749961728
new: 113.24090967660544
path: .spaces[22].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 66.22275419684529
Code
nsStorageInputStream::Tell(int64_t* aResult) {
if (NS_FAILED(mStatus)) {
return mStatus;
}
*aResult = mLogicalCursor;
return NS_OK;
}
Minimal test - lines (492, 517)
path: .spaces[21].metrics.nexits.average
old: 0.0
new: 4.0
path: .spaces[21].metrics.nexits.sum
old: 0.0
new: 4.0
path: .spaces[21].metrics.loc.sloc
old: 3.0
new: 26.0
path: .spaces[21].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[21].metrics.loc.lloc
old: 1.0
new: 17.0
path: .spaces[21].metrics.loc.ploc
old: 3.0
new: 23.0
path: .spaces[21].metrics.mi.mi_original
old: 132.43687749961728
new: 85.83600462353488
path: .spaces[21].metrics.mi.mi_sei
old: 115.46699426690871
new: 48.74524536450993
path: .spaces[21].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 50.196493931891744
path: .spaces[21].metrics.halstead.difficulty
old: 3.6
new: 13.28125
path: .spaces[21].metrics.halstead.volume
old: 51.89147427955946
new: 388.4183471906009
path: .spaces[21].metrics.halstead.time
old: 10.378294855911893
new: 286.5933985347316
path: .spaces[21].metrics.halstead.n2
old: 5.0
new: 16.0
path: .spaces[21].metrics.halstead.N2
old: 6.0
new: 25.0
path: .spaces[21].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 133.48686830125575
path: .spaces[21].metrics.halstead.n1
old: 6.0
new: 17.0
path: .spaces[21].metrics.halstead.length
old: 15.0
new: 77.0
path: .spaces[21].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.09951866397370736
path: .spaces[21].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 1.7335956922241007
path: .spaces[21].metrics.halstead.N1
old: 9.0
new: 52.0
path: .spaces[21].metrics.halstead.level
old: 0.2777777777777778
new: 0.07529411764705882
path: .spaces[21].metrics.halstead.vocabulary
old: 11.0
new: 33.0
path: .spaces[21].metrics.halstead.effort
old: 186.8093074064141
new: 5158.681173625168
path: .spaces[21].metrics.cyclomatic.average
old: 1.0
new: 6.0
path: .spaces[21].metrics.cyclomatic.sum
old: 1.0
new: 6.0
path: .spaces[21].metrics.cognitive.average
old: 0.0
new: 3.0
path: .spaces[21].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[21].metrics.nargs.average
old: 1.0
new: 2.0
path: .spaces[21].metrics.nargs.sum
old: 1.0
new: 2.0
Code
nsStorageInputStream::Seek(int32_t aWhence, int64_t aOffset) {
if (NS_FAILED(mStatus)) {
return mStatus;
}
int64_t pos = aOffset;
switch (aWhence) {
case NS_SEEK_SET:
break;
case NS_SEEK_CUR:
pos += mLogicalCursor;
break;
case NS_SEEK_END:
pos += mStorageStream->mLogicalLength;
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected whence value");
return NS_ERROR_UNEXPECTED;
}
if (pos == int64_t(mLogicalCursor)) {
return NS_OK;
}
return Seek(pos);
}
Minimal test - lines (568, 611)
path: .spaces[27].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[27].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[27].metrics.halstead.N2
old: 6.0
new: 83.0
path: .spaces[27].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 255.60416835317895
path: .spaces[27].metrics.halstead.level
old: 0.2777777777777778
new: 0.051027639971651315
path: .spaces[27].metrics.halstead.difficulty
old: 3.6
new: 19.59722222222222
path: .spaces[27].metrics.halstead.n2
old: 5.0
new: 36.0
path: .spaces[27].metrics.halstead.time
old: 10.378294855911893
new: 1191.111335204658
path: .spaces[27].metrics.halstead.vocabulary
old: 11.0
new: 53.0
path: .spaces[27].metrics.halstead.volume
old: 51.89147427955946
new: 1094.032806821571
path: .spaces[27].metrics.halstead.length
old: 15.0
new: 191.0
path: .spaces[27].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.25725391164453804
path: .spaces[27].metrics.halstead.N1
old: 9.0
new: 108.0
path: .spaces[27].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 1.3382417191265914
path: .spaces[27].metrics.halstead.effort
old: 186.8093074064141
new: 21440.004033683843
path: .spaces[27].metrics.halstead.n1
old: 6.0
new: 17.0
path: .spaces[27].metrics.loc.blank
old: 0.0
new: 11.0
path: .spaces[27].metrics.loc.ploc
old: 3.0
new: 33.0
path: .spaces[27].metrics.loc.sloc
old: 3.0
new: 44.0
path: .spaces[27].metrics.loc.lloc
old: 1.0
new: 18.0
path: .spaces[27].metrics.nargs.average
old: 1.0
new: 5.0
path: .spaces[27].metrics.nargs.sum
old: 1.0
new: 5.0
path: .spaces[27].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[27].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[27].metrics.mi.mi_original
old: 132.43687749961728
new: 72.84847288399592
path: .spaces[27].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 42.60144613099177
path: .spaces[27].metrics.mi.mi_sei
old: 115.46699426690871
new: 29.60091829287124
path: .spaces[27].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[27].metrics.cognitive.sum
old: 0.0
new: 1.0
Code
void nsStorageInputStream::SerializeInternal(InputStreamParams& aParams,
bool aDelayedStart,
uint32_t aMaxSize,
uint32_t* aSizeUsed, M* aManager) {
MOZ_ASSERT(aSizeUsed);
*aSizeUsed = 0;
uint64_t remaining = 0;
DebugOnly rv = Available(&remaining);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (remaining >= aMaxSize) {
mozilla::ipc::InputStreamHelper::SerializeInputStreamAsPipe(
this, aParams, aDelayedStart, aManager);
return;
}
*aSizeUsed = remaining;
nsCString combined;
int64_t offset;
rv = Tell(&offset);
MOZ_ASSERT(NS_SUCCEEDED(rv));
auto handleOrErr = combined.BulkWrite(remaining, 0, false);
MOZ_ASSERT(!handleOrErr.isErr());
auto handle = handleOrErr.unwrap();
uint32_t numRead = 0;
rv = Read(handle.Elements(), remaining, &numRead);
MOZ_ASSERT(NS_SUCCEEDED(rv));
MOZ_ASSERT(numRead == remaining);
handle.Finish(numRead, false);
rv = Seek(NS_SEEK_SET, offset);
MOZ_ASSERT(NS_SUCCEEDED(rv));
StringInputStreamParams params;
params.data() = combined;
aParams = params;
}
Minimal test - lines (227, 230)
path: .spaces[9].metrics.mi.mi_sei
old: 105.86627077189092
new: 108.4759871562677
path: .spaces[9].metrics.mi.mi_original
old: 125.7821630777101
new: 127.59108063160195
path: .spaces[9].metrics.mi.mi_visual_studio
old: 73.55682051328075
new: 74.61466703602454
path: .spaces[9].metrics.loc.lloc
old: 1.0
new: 2.0
path: .spaces[9].metrics.halstead.N1
old: 13.0
new: 10.0
path: .spaces[9].metrics.halstead.length
old: 20.0
new: 15.0
path: .spaces[9].metrics.halstead.n2
old: 5.0
new: 4.0
path: .spaces[9].metrics.halstead.vocabulary
old: 14.0
new: 12.0
path: .spaces[9].metrics.halstead.bugs
old: 0.020427161279358765
new: 0.013885962850227664
path: .spaces[9].metrics.halstead.purity_ratio
old: 2.006948274370881
new: 2.1333333333333333
path: .spaces[9].metrics.halstead.estimated_program_length
old: 40.13896548741762
new: 32.0
path: .spaces[9].metrics.halstead.effort
old: 479.7267201792581
new: 268.87218755408674
path: .spaces[9].metrics.halstead.level
old: 0.15873015873015872
new: 0.2
path: .spaces[9].metrics.halstead.time
old: 26.651484454403228
new: 14.937343753004818
path: .spaces[9].metrics.halstead.volume
old: 76.14709844115208
new: 53.77443751081734
path: .spaces[9].metrics.halstead.N2
old: 7.0
new: 5.0
path: .spaces[9].metrics.halstead.difficulty
old: 6.3
new: 5.0
path: .spaces[9].metrics.halstead.n1
old: 9.0
new: 8.0
Code
nsStorageStream::IsNonBlocking(bool* aNonBlocking) {
*aNonBlocking = false;
return NS_OK;
}
Minimal test - lines (613, 619)
path: .spaces[28].metrics.mi.mi_sei
old: 115.46699426690871
new: 92.80162719276018
path: .spaces[28].metrics.mi.mi_original
old: 132.43687749961728
new: 116.726442215815
path: .spaces[28].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 68.26107731919006
path: .spaces[28].metrics.halstead.n2
old: 5.0
new: 8.0
path: .spaces[28].metrics.halstead.n1
old: 6.0
new: 8.0
path: .spaces[28].metrics.halstead.time
old: 10.378294855911893
new: 16.88888888888889
path: .spaces[28].metrics.halstead.N1
old: 9.0
new: 11.0
path: .spaces[28].metrics.halstead.vocabulary
old: 11.0
new: 16.0
path: .spaces[28].metrics.halstead.effort
old: 186.8093074064141
new: 304.0
path: .spaces[28].metrics.halstead.level
old: 0.2777777777777778
new: 0.25
path: .spaces[28].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 48.0
path: .spaces[28].metrics.halstead.N2
old: 6.0
new: 8.0
path: .spaces[28].metrics.halstead.volume
old: 51.89147427955946
new: 76.0
path: .spaces[28].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 2.526315789473684
path: .spaces[28].metrics.halstead.length
old: 15.0
new: 19.0
path: .spaces[28].metrics.halstead.difficulty
old: 3.6
new: 4.0
path: .spaces[28].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.015070504847894736
path: .spaces[28].metrics.nargs.average
old: 1.0
new: 2.0
path: .spaces[28].metrics.nargs.sum
old: 1.0
new: 2.0
path: .spaces[28].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[28].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[28].metrics.loc.ploc
old: 3.0
new: 7.0
path: .spaces[28].metrics.loc.sloc
old: 3.0
new: 7.0
path: .spaces[28].metrics.loc.lloc
old: 1.0
new: 2.0
Code
bool nsStorageInputStream::Deserialize(const InputStreamParams& aParams,
const FileDescriptorArray&) {
MOZ_ASSERT_UNREACHABLE(
"We should never attempt to deserialize a storage "
"input stream.");
return false;
}
Minimal test - lines (622, 625)
path: .spaces[29].metrics.loc.ploc
old: 3.0
new: 4.0
path: .spaces[29].metrics.loc.sloc
old: 3.0
new: 4.0
path: .spaces[29].metrics.loc.lloc
old: 1.0
new: 2.0
path: .spaces[29].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[29].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[29].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 74.61466703602454
path: .spaces[29].metrics.mi.mi_sei
old: 115.46699426690871
new: 108.4759871562677
path: .spaces[29].metrics.mi.mi_original
old: 132.43687749961728
new: 127.59108063160195
path: .spaces[29].metrics.halstead.time
old: 10.378294855911893
new: 14.937343753004818
path: .spaces[29].metrics.halstead.n1
old: 6.0
new: 8.0
path: .spaces[29].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 32.0
path: .spaces[29].metrics.halstead.n2
old: 5.0
new: 4.0
path: .spaces[29].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.013885962850227664
path: .spaces[29].metrics.halstead.N1
old: 9.0
new: 10.0
path: .spaces[29].metrics.halstead.level
old: 0.2777777777777778
new: 0.2
path: .spaces[29].metrics.halstead.vocabulary
old: 11.0
new: 12.0
path: .spaces[29].metrics.halstead.difficulty
old: 3.6
new: 5.0
path: .spaces[29].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 2.1333333333333333
path: .spaces[29].metrics.halstead.N2
old: 6.0
new: 5.0
path: .spaces[29].metrics.halstead.effort
old: 186.8093074064141
new: 268.87218755408674
path: .spaces[29].metrics.halstead.volume
old: 51.89147427955946
new: 53.77443751081734
Code
nsStorageInputStream::GetCloneable(bool* aCloneableOut) {
*aCloneableOut = true;
return NS_OK;
}
Minimal test - lines (632, 641)
path: .spaces[31].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[31].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[31].metrics.mi.mi_visual_studio
old: 70.74120820686706
new: 61.068911716884486
path: .spaces[31].metrics.mi.mi_original
old: 120.96746603374264
new: 104.42783903587248
path: .spaces[31].metrics.mi.mi_sei
old: 98.92013122317636
new: 75.16031323460031
path: .spaces[31].metrics.halstead.n1
old: 9.0
new: 14.0
path: .spaces[31].metrics.halstead.estimated_program_length
old: 57.05865002596162
new: 106.60593781761293
path: .spaces[31].metrics.halstead.length
old: 23.0
new: 53.0
path: .spaces[31].metrics.halstead.effort
old: 479.54137516586593
new: 2930.082824994109
path: .spaces[31].metrics.halstead.purity_ratio
old: 2.4808108706939835
new: 2.011432789011564
path: .spaces[31].metrics.halstead.volume
old: 95.90827503317318
new: 254.789810869053
path: .spaces[31].metrics.halstead.level
old: 0.2
new: 0.08695652173913043
path: .spaces[31].metrics.halstead.N2
old: 10.0
new: 23.0
path: .spaces[31].metrics.halstead.difficulty
old: 5.0
new: 11.5
path: .spaces[31].metrics.halstead.bugs
old: 0.02042189951099715
new: 0.06825461319287086
path: .spaces[31].metrics.halstead.n2
old: 9.0
new: 14.0
path: .spaces[31].metrics.halstead.N1
old: 13.0
new: 30.0
path: .spaces[31].metrics.halstead.time
old: 26.641187509214777
new: 162.7823791663394
path: .spaces[31].metrics.halstead.vocabulary
old: 18.0
new: 28.0
path: .spaces[31].metrics.loc.sloc
old: 5.0
new: 10.0
path: .spaces[31].metrics.loc.ploc
old: 5.0
new: 10.0
path: .spaces[31].metrics.loc.lloc
old: 3.0
new: 4.0
path: .spaces[31].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[31].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[31].metrics.nargs.sum
old: 1.0
new: 3.0
path: .spaces[31].metrics.nargs.average
old: 1.0
new: 3.0
path: .spaces[31].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[31].metrics.cognitive.average
old: 0.0
new: 1.0
Code
nsresult NS_NewStorageStream(uint32_t aSegmentSize, uint32_t aMaxSize,
nsIStorageStream** aResult) {
RefPtr storageStream = new nsStorageStream();
nsresult rv = storageStream->Init(aSegmentSize, aMaxSize);
if (NS_FAILED(rv)) {
return rv;
}
storageStream.forget(aResult);
return NS_OK;
}
Minimal test - lines (628, 630)
path: .spaces[30].metrics.mi.mi_original
old: 131.75107096021492
new: 131.28771108481735
path: .spaces[30].metrics.mi.mi_visual_studio
old: 77.04740991825433
new: 76.77643923088733
path: .spaces[30].metrics.mi.mi_sei
old: 114.47758457350372
new: 113.8090975791207
path: .spaces[30].metrics.halstead.effort
old: 241.762061585218
new: 302.05015714990327
path: .spaces[30].metrics.halstead.length
old: 16.0
new: 17.0
path: .spaces[30].metrics.halstead.estimated_program_length
old: 35.161259458730164
new: 39.50977500432694
path: .spaces[30].metrics.halstead.time
old: 13.431225643623222
new: 16.780564286105736
path: .spaces[30].metrics.halstead.N1
old: 9.0
new: 10.0
path: .spaces[30].metrics.halstead.difficulty
old: 4.083333333333333
new: 4.666666666666667
path: .spaces[30].metrics.halstead.purity_ratio
old: 2.1975787161706353
new: 2.324104412019232
path: .spaces[30].metrics.halstead.vocabulary
old: 13.0
new: 14.0
path: .spaces[30].metrics.halstead.level
old: 0.2448979591836735
new: 0.21428571428571427
path: .spaces[30].metrics.halstead.n1
old: 7.0
new: 8.0
path: .spaces[30].metrics.halstead.bugs
old: 0.012936124267933504
new: 0.015005994719638868
path: .spaces[30].metrics.halstead.volume
old: 59.207035490257475
new: 64.72503367497927
path: .spaces[30].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[30].metrics.nexits.average
old: 0.0
new: 1.0
Code
nsStorageInputStream::Clone(nsIInputStream** aCloneOut) {
return mStorageStream->NewInputStream(mLogicalCursor, aCloneOut);
}
Minimal test - lines (64, 64)
path: .spaces[1].metrics.mi.mi_sei
old: 79.04076114614766
new: 146.92819499625
path: .spaces[1].metrics.mi.mi_visual_studio
old: 62.641848283667386
new: 90.2012398141466
path: .spaces[1].metrics.mi.mi_original
old: 107.11756056507124
new: 154.24412008219068
path: .spaces[1].metrics.loc.ploc
old: 9.0
new: 1.0
path: .spaces[1].metrics.loc.lloc
old: 4.0
new: 1.0
path: .spaces[1].metrics.loc.sloc
old: 9.0
new: 1.0
path: .spaces[1].metrics.cognitive.average
old: 1.0
new: 0.0
path: .spaces[1].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[1].metrics.nargs.average
old: 2.0
new: 0.0
path: .spaces[1].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[1].metrics.nexits.average
old: 2.0
new: 0.0
path: .spaces[1].metrics.nexits.sum
old: 2.0
new: 0.0
path: .spaces[1].metrics.cyclomatic.sum
old: 2.0
new: 1.0
path: .spaces[1].metrics.cyclomatic.average
old: 2.0
new: 1.0
path: .spaces[1].metrics.halstead.vocabulary
old: 24.0
new: 8.0
path: .spaces[1].metrics.halstead.length
old: 46.0
new: 8.0
path: .spaces[1].metrics.halstead.N1
old: 27.0
new: 6.0
path: .spaces[1].metrics.halstead.n2
old: 12.0
new: 2.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.8704152177675597
new: 2.188721875540867
path: .spaces[1].metrics.halstead.estimated_program_length
old: 86.03910001730775
new: 17.509775004326936
path: .spaces[1].metrics.halstead.effort
old: 2003.628612815145
new: 72.0
path: .spaces[1].metrics.halstead.bugs
old: 0.052977349770601034
new: 0.0057689982812296325
path: .spaces[1].metrics.halstead.difficulty
old: 9.5
new: 3.0
path: .spaces[1].metrics.halstead.N2
old: 19.0
new: 2.0
path: .spaces[1].metrics.halstead.n1
old: 12.0
new: 6.0
path: .spaces[1].metrics.halstead.time
old: 111.3127007119525
new: 4.0
path: .spaces[1].metrics.halstead.volume
old: 210.90827503317317
new: 24.0
path: .spaces[1].metrics.halstead.level
old: 0.10526315789473684
new: 0.3333333333333333
Code
nsStorageStream::~nsStorageStream() { delete mSegmentedBuffer; }
Minimal test - lines (414, 416)
path: .spaces[18].metrics.halstead.time
old: 10.378294855911893
new: 31.727957683813365
path: .spaces[18].metrics.halstead.N2
old: 6.0
new: 9.0
path: .spaces[18].metrics.halstead.length
old: 15.0
new: 25.0
path: .spaces[18].metrics.halstead.vocabulary
old: 11.0
new: 14.0
path: .spaces[18].metrics.halstead.level
old: 0.2777777777777778
new: 0.16666666666666666
path: .spaces[18].metrics.halstead.volume
old: 51.89147427955946
new: 95.1838730514401
path: .spaces[18].metrics.halstead.n2
old: 5.0
new: 6.0
path: .spaces[18].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 1.5803910001730777
path: .spaces[18].metrics.halstead.N1
old: 9.0
new: 16.0
path: .spaces[18].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.02294502281013948
path: .spaces[18].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 39.50977500432694
path: .spaces[18].metrics.halstead.effort
old: 186.8093074064141
new: 571.1032383086406
path: .spaces[18].metrics.halstead.difficulty
old: 3.6
new: 6.0
path: .spaces[18].metrics.halstead.n1
old: 6.0
new: 8.0
path: .spaces[18].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[18].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[18].metrics.mi.mi_original
old: 132.43687749961728
new: 129.28226618459504
path: .spaces[18].metrics.mi.mi_sei
old: 115.46699426690871
new: 110.91585216679393
path: .spaces[18].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 75.6036644354357
path: .spaces[18].metrics.nargs.sum
old: 1.0
new: 3.0
path: .spaces[18].metrics.nargs.average
old: 1.0
new: 3.0
Code
nsStorageInputStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aNumRead) {
return ReadSegments(NS_CopySegmentToBuffer, aBuffer, aCount, aNumRead);
}
Minimal test - lines (145, 145)
path: .spaces[5].metrics.cognitive.average
old: 15.0
new: 0.0
path: .spaces[5].metrics.cognitive.sum
old: 15.0
new: 0.0
path: .spaces[5].metrics.cyclomatic.average
old: 85.0
new: 1.0
path: .spaces[5].metrics.cyclomatic.sum
old: 85.0
new: 1.0
path: .spaces[5].metrics.mi.mi_original
old: 16.823780476208185
new: 155.2836050228807
path: .spaces[5].metrics.mi.mi_sei
old: -27.409908304569413
new: 148.4278547652622
path: .spaces[5].metrics.mi.mi_visual_studio
old: 9.838468114741628
new: 90.80912574437468
path: .spaces[5].metrics.loc.sloc
old: 246.0
new: 1.0
path: .spaces[5].metrics.loc.ploc
old: 201.0
new: 1.0
path: .spaces[5].metrics.loc.blank
old: 35.0
new: 0.0
path: .spaces[5].metrics.loc.cloc
old: 10.0
new: 0.0
path: .spaces[5].metrics.loc.lloc
old: 49.0
new: 1.0
path: .spaces[5].metrics.halstead.purity_ratio
old: 0.6614321671410276
new: 1.944234353490973
path: .spaces[5].metrics.halstead.level
old: 0.024067388688327317
new: 0.4
path: .spaces[5].metrics.halstead.N2
old: 277.0
new: 2.0
path: .spaces[5].metrics.halstead.length
old: 931.0
new: 7.0
path: .spaces[5].metrics.halstead.bugs
old: 1.3550690339700184
new: 0.004471319041702271
path: .spaces[5].metrics.halstead.n2
old: 80.0
new: 2.0
path: .spaces[5].metrics.halstead.difficulty
old: 41.55
new: 2.5
path: .spaces[5].metrics.halstead.estimated_program_length
old: 615.7933476082967
new: 13.60964047443681
path: .spaces[5].metrics.halstead.time
old: 14399.635813268762
new: 2.7293728408893374
path: .spaces[5].metrics.halstead.vocabulary
old: 104.0
new: 7.0
path: .spaces[5].metrics.halstead.effort
old: 259193.4446388377
new: 49.12871113600807
path: .spaces[5].metrics.halstead.N1
old: 654.0
new: 5.0
path: .spaces[5].metrics.halstead.volume
old: 6238.109377589356
new: 19.651484454403228
path: .spaces[5].metrics.halstead.n1
old: 24.0
new: 5.0
Code
nsStorageStream::Flush() { return NS_OK; }
Minimal test - lines (324, 372)
path: .spaces[14].metrics.halstead.n1
old: 18.0
new: 16.0
path: .spaces[14].metrics.halstead.length
old: 93.0
new: 148.0
path: .spaces[14].metrics.halstead.level
old: 0.06734006734006734
new: 0.078125
path: .spaces[14].metrics.halstead.vocabulary
old: 38.0
new: 56.0
path: .spaces[14].metrics.halstead.purity_ratio
old: 1.7365291604699875
new: 1.8707913769965847
path: .spaces[14].metrics.halstead.N1
old: 60.0
new: 84.0
path: .spaces[14].metrics.halstead.volume
old: 488.0572587502534
new: 859.4885284645253
path: .spaces[14].metrics.halstead.difficulty
old: 14.85
new: 12.8
path: .spaces[14].metrics.halstead.estimated_program_length
old: 161.49721192370885
new: 276.8771237954945
path: .spaces[14].metrics.halstead.n2
old: 20.0
new: 40.0
path: .spaces[14].metrics.halstead.time
old: 402.6472384689591
new: 611.1918424636625
path: .spaces[14].metrics.halstead.N2
old: 33.0
new: 64.0
path: .spaces[14].metrics.halstead.bugs
old: 0.12483706950839343
new: 0.1648841012793654
path: .spaces[14].metrics.halstead.effort
old: 7247.650292441263
new: 11001.453164345923
path: .spaces[14].metrics.nom.functions
old: 1.0
new: 3.0
path: .spaces[14].metrics.nom.total
old: 1.0
new: 3.0
path: .spaces[14].metrics.loc.lloc
old: 14.0
new: 2.0
path: .spaces[14].metrics.loc.ploc
old: 20.0
new: 42.0
path: .spaces[14].metrics.loc.blank
old: 4.0
new: 2.0
path: .spaces[14].metrics.loc.sloc
old: 24.0
new: 49.0
path: .spaces[14].metrics.loc.cloc
old: 0.0
new: 5.0
path: .spaces[14].metrics.nexits.average
old: 3.0
new: 0.6666666666666666
path: .spaces[14].metrics.nexits.sum
old: 3.0
new: 2.0
path: .spaces[14].metrics.cognitive.sum
old: 2.0
new: 0.0
path: .spaces[14].metrics.cognitive.average
old: 2.0
new: 0.0
path: .spaces[14].metrics.nargs.average
old: 2.0
new: 1.3333333333333333
path: .spaces[14].metrics.nargs.sum
old: 2.0
new: 4.0
path: .spaces[14].metrics.cyclomatic.average
old: 4.0
new: 1.0
path: .spaces[14].metrics.mi.mi_sei
old: 49.362893147007654
new: 52.181496318437986
path: .spaces[14].metrics.mi.mi_visual_studio
old: 50.52940218683902
new: 42.04652414334223
path: .spaces[14].metrics.mi.mi_original
old: 86.40527773949472
new: 71.89955628511521
Code
class nsStorageInputStream final : public nsIInputStream,
public nsISeekableStream,
public nsIIPCSerializableInputStream,
public nsICloneableInputStream {
public:
nsStorageInputStream(nsStorageStream* aStorageStream, uint32_t aSegmentSize)
: mStorageStream(aStorageStream),
mReadCursor(0),
mSegmentEnd(0),
mSegmentNum(0),
mSegmentSize(aSegmentSize),
mLogicalCursor(0),
mStatus(NS_OK) {}
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIINPUTSTREAM
NS_DECL_NSISEEKABLESTREAM
NS_DECL_NSITELLABLESTREAM
NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM
NS_DECL_NSICLONEABLEINPUTSTREAM
private:
~nsStorageInputStream() = default;
protected:
nsresult Seek(uint32_t aPosition);
friend class nsStorageStream;
private:
RefPtr mStorageStream;
uint32_t mReadCursor; // Next memory location to read byte, or 0
uint32_t mSegmentEnd; // One byte past end of current buffer segment
uint32_t mSegmentNum; // Segment number containing read cursor
uint32_t mSegmentSize; // All segments, except the last, are of this size
uint32_t mLogicalCursor; // Logical offset into stream
nsresult mStatus;
uint32_t SegNum(uint32_t aPosition) {
return aPosition >> mStorageStream->mSegmentSizeLog2;
}
uint32_t SegOffset(uint32_t aPosition) {
return aPosition & (mSegmentSize - 1);
}
template
void SerializeInternal(InputStreamParams& aParams, bool aDelayedStart,
uint32_t aMaxSize, uint32_t* aSizeUsed, M* aManager);
};
Minimal test - lines (560, 565)
path: .spaces[26].metrics.halstead.effort
old: 186.8093074064141
new: 975.7624503375008
path: .spaces[26].metrics.halstead.length
old: 15.0
new: 39.0
path: .spaces[26].metrics.halstead.n2
old: 5.0
new: 10.0
path: .spaces[26].metrics.halstead.level
old: 0.2777777777777778
new: 0.16666666666666666
path: .spaces[26].metrics.halstead.n1
old: 6.0
new: 8.0
path: .spaces[26].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 1.4671610499711183
path: .spaces[26].metrics.halstead.time
old: 10.378294855911893
new: 54.209025018750054
path: .spaces[26].metrics.halstead.volume
old: 51.89147427955946
new: 162.62707505625016
path: .spaces[26].metrics.halstead.vocabulary
old: 11.0
new: 18.0
path: .spaces[26].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 57.219280948873624
path: .spaces[26].metrics.halstead.N1
old: 9.0
new: 24.0
path: .spaces[26].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.03279252157043551
path: .spaces[26].metrics.halstead.N2
old: 6.0
new: 15.0
path: .spaces[26].metrics.halstead.difficulty
old: 3.6
new: 6.0
path: .spaces[26].metrics.loc.ploc
old: 3.0
new: 6.0
path: .spaces[26].metrics.loc.sloc
old: 3.0
new: 6.0
path: .spaces[26].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 67.40813226703975
path: .spaces[26].metrics.mi.mi_original
old: 132.43687749961728
new: 115.26790617663798
path: .spaces[26].metrics.mi.mi_sei
old: 115.46699426690871
new: 90.69740448208164
path: .spaces[26].metrics.nargs.sum
old: 1.0
new: 6.0
path: .spaces[26].metrics.nargs.average
old: 1.0
new: 6.0
Code
void nsStorageInputStream::Serialize(
InputStreamParams& aParams, FileDescriptorArray&, bool aDelayedStart,
uint32_t aMaxSize, uint32_t* aSizeUsed,
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
}
Minimal test - lines (120, 142)
path: .spaces[4].metrics.loc.lloc
old: 67.0
new: 9.0
path: .spaces[4].metrics.loc.sloc
old: 100.0
new: 23.0
path: .spaces[4].metrics.loc.blank
old: 13.0
new: 6.0
path: .spaces[4].metrics.loc.cloc
old: 6.0
new: 2.0
path: .spaces[4].metrics.loc.ploc
old: 81.0
new: 15.0
path: .spaces[4].metrics.mi.mi_visual_studio
old: 29.098584320530147
new: 52.90962872422184
path: .spaces[4].metrics.mi.mi_original
old: 49.75857918810655
new: 90.47546511841936
path: .spaces[4].metrics.mi.mi_sei
old: 17.15266533825386
new: 77.18848055719076
path: .spaces[4].metrics.cognitive.sum
old: 11.0
new: 2.0
path: .spaces[4].metrics.cognitive.average
old: 11.0
new: 2.0
path: .spaces[4].metrics.halstead.N2
old: 163.0
new: 22.0
path: .spaces[4].metrics.halstead.length
old: 410.0
new: 56.0
path: .spaces[4].metrics.halstead.difficulty
old: 21.6484375
new: 7.5625
path: .spaces[4].metrics.halstead.effort
old: 56271.61708419726
new: 2013.6948571662288
path: .spaces[4].metrics.halstead.estimated_program_length
old: 453.48686830125575
new: 102.05374780501026
path: .spaces[4].metrics.halstead.vocabulary
old: 81.0
new: 27.0
path: .spaces[4].metrics.halstead.n2
old: 64.0
new: 16.0
path: .spaces[4].metrics.halstead.N1
old: 247.0
new: 34.0
path: .spaces[4].metrics.halstead.volume
old: 2599.338501182696
new: 266.2737001211542
path: .spaces[4].metrics.halstead.n1
old: 17.0
new: 11.0
path: .spaces[4].metrics.halstead.level
old: 0.04619271021291952
new: 0.1322314049586777
path: .spaces[4].metrics.halstead.purity_ratio
old: 1.1060655324420872
new: 1.8223883536608976
path: .spaces[4].metrics.halstead.bugs
old: 0.48948382196665374
new: 0.053154640579350806
path: .spaces[4].metrics.halstead.time
old: 3126.20094912207
new: 111.87193650923491
path: .spaces[4].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[4].metrics.nargs.average
old: 1.0
new: 0.0
path: .spaces[4].metrics.nexits.average
old: 15.0
new: 2.0
path: .spaces[4].metrics.nexits.sum
old: 15.0
new: 2.0
path: .spaces[4].metrics.cyclomatic.average
old: 25.0
new: 3.0
path: .spaces[4].metrics.cyclomatic.sum
old: 25.0
new: 3.0
Code
nsStorageStream::Close() {
if (NS_WARN_IF(!mSegmentedBuffer)) {
return NS_ERROR_NOT_INITIALIZED;
}
mWriteInProgress = false;
int32_t segmentOffset = SegOffset(mLogicalLength);
// Shrink the final segment in the segmented buffer to the minimum size
// needed to contain the data, so as to conserve memory.
if (segmentOffset) {
mSegmentedBuffer->ReallocLastSegment(segmentOffset);
}
mWriteCursor = 0;
mSegmentEnd = 0;
LOG(("nsStorageStream [%p] Close mWriteCursor=%p mSegmentEnd=%p\n", this,
mWriteCursor, mSegmentEnd));
return NS_OK;
}
Minimal test - lines (83, 117)
path: .spaces[3].metrics.mi.mi_sei
old: 111.00881611745795
new: 63.992493099445205
path: .spaces[3].metrics.mi.mi_original
old: 129.34670388489153
new: 78.93103313860611
path: .spaces[3].metrics.mi.mi_visual_studio
old: 75.64134730110615
new: 46.15849891146556
path: .spaces[3].metrics.cyclomatic.average
old: 1.0
new: 8.0
path: .spaces[3].metrics.cyclomatic.sum
old: 1.0
new: 8.0
path: .spaces[3].metrics.cognitive.average
old: 0.0
new: 7.0
path: .spaces[3].metrics.cognitive.sum
old: 0.0
new: 7.0
path: .spaces[3].metrics.loc.blank
old: 0.0
new: 4.0
path: .spaces[3].metrics.loc.ploc
old: 3.0
new: 27.0
path: .spaces[3].metrics.loc.sloc
old: 3.0
new: 35.0
path: .spaces[3].metrics.loc.lloc
old: 1.0
new: 17.0
path: .spaces[3].metrics.loc.cloc
old: 0.0
new: 4.0
path: .spaces[3].metrics.nexits.sum
old: 1.0
new: 6.0
path: .spaces[3].metrics.nexits.average
old: 1.0
new: 6.0
path: .spaces[3].metrics.halstead.volume
old: 94.0116453487578
new: 531.3642432941529
path: .spaces[3].metrics.halstead.difficulty
old: 5.625
new: 12.613636363636363
path: .spaces[3].metrics.halstead.level
old: 0.17777777777777778
new: 0.07927927927927927
path: .spaces[3].metrics.halstead.N1
old: 13.0
new: 65.0
path: .spaces[3].metrics.halstead.bugs
old: 0.021797910521911084
new: 0.11849512969348272
path: .spaces[3].metrics.halstead.length
old: 23.0
new: 102.0
path: .spaces[3].metrics.halstead.effort
old: 528.8155050867626
new: 6702.435341551246
path: .spaces[3].metrics.halstead.n2
old: 8.0
new: 22.0
path: .spaces[3].metrics.halstead.N2
old: 10.0
new: 37.0
path: .spaces[3].metrics.halstead.n1
old: 9.0
new: 15.0
path: .spaces[3].metrics.halstead.vocabulary
old: 17.0
new: 37.0
path: .spaces[3].metrics.halstead.time
old: 29.378639171486817
new: 372.3575189750693
path: .spaces[3].metrics.halstead.purity_ratio
old: 2.2838836962165567
new: 1.536380926903415
path: .spaces[3].metrics.halstead.estimated_program_length
old: 52.529325012980806
new: 156.71085454414833
Code
nsStorageStream::GetOutputStream(int32_t aStartingOffset,
nsIOutputStream** aOutputStream) {
if (NS_WARN_IF(!aOutputStream)) {
return NS_ERROR_INVALID_ARG;
}
if (NS_WARN_IF(!mSegmentedBuffer)) {
return NS_ERROR_NOT_INITIALIZED;
}
if (mWriteInProgress) {
return NS_ERROR_NOT_AVAILABLE;
}
nsresult rv = Seek(aStartingOffset);
if (NS_FAILED(rv)) {
return rv;
}
// Enlarge the last segment in the buffer so that it is the same size as
// all the other segments in the buffer. (It may have been realloc'ed
// smaller in the Close() method.)
if (mLastSegmentNum >= 0)
if (mSegmentedBuffer->ReallocLastSegment(mSegmentSize)) {
// Need to re-Seek, since realloc changed segment base pointer
rv = Seek(aStartingOffset);
if (NS_FAILED(rv)) {
return rv;
}
}
NS_ADDREF(this);
*aOutputStream = static_cast(this);
mWriteInProgress = true;
return NS_OK;
}
Minimal test - lines (221, 224)
path: .spaces[8].metrics.nargs.sum
old: 1.0
new: 4.0
path: .spaces[8].metrics.nargs.average
old: 1.0
new: 4.0
path: .spaces[8].metrics.cyclomatic.sum
old: 10.0
new: 1.0
path: .spaces[8].metrics.cyclomatic.average
old: 10.0
new: 1.0
path: .spaces[8].metrics.halstead.purity_ratio
old: 1.2367194624922828
new: 2.1825742227201617
path: .spaces[8].metrics.halstead.length
old: 213.0
new: 20.0
path: .spaces[8].metrics.halstead.bugs
old: 0.2652814005998025
new: 0.015351809402487026
path: .spaces[8].metrics.halstead.time
old: 1247.2961438899558
new: 17.363958202704527
path: .spaces[8].metrics.halstead.estimated_program_length
old: 263.42124551085624
new: 43.65148445440323
path: .spaces[8].metrics.halstead.n2
old: 38.0
new: 7.0
path: .spaces[8].metrics.halstead.difficulty
old: 18.31578947368421
new: 4.0
path: .spaces[8].metrics.halstead.N2
old: 87.0
new: 7.0
path: .spaces[8].metrics.halstead.N1
old: 126.0
new: 13.0
path: .spaces[8].metrics.halstead.effort
old: 22451.330590019206
new: 312.5512476486815
path: .spaces[8].metrics.halstead.volume
old: 1225.7910379608188
new: 78.13781191217038
path: .spaces[8].metrics.halstead.n1
old: 16.0
new: 8.0
path: .spaces[8].metrics.halstead.vocabulary
old: 54.0
new: 15.0
path: .spaces[8].metrics.halstead.level
old: 0.05459770114942529
new: 0.25
path: .spaces[8].metrics.cognitive.average
old: 3.0
new: 0.0
path: .spaces[8].metrics.cognitive.sum
old: 3.0
new: 0.0
path: .spaces[8].metrics.loc.ploc
old: 44.0
new: 4.0
path: .spaces[8].metrics.loc.cloc
old: 8.0
new: 0.0
path: .spaces[8].metrics.loc.sloc
old: 52.0
new: 4.0
path: .spaces[8].metrics.loc.lloc
old: 30.0
new: 1.0
path: .spaces[8].metrics.nexits.average
old: 10.0
new: 1.0
path: .spaces[8].metrics.nexits.sum
old: 10.0
new: 1.0
path: .spaces[8].metrics.mi.mi_sei
old: 51.55021383644859
new: 105.6726654533256
path: .spaces[8].metrics.mi.mi_original
old: 67.71087512776504
new: 125.64796609700514
path: .spaces[8].metrics.mi.mi_visual_studio
old: 39.59700299869301
new: 73.47834274678662
Code
nsStorageStream::WriteSegments(nsReadSegmentFun aReader, void* aClosure,
uint32_t aCount, uint32_t* aResult) {
return NS_ERROR_NOT_IMPLEMENTED;
}
Minimal test - lines (419, 480)
path: .spaces[19].metrics.cognitive.average
old: 0.0
new: 18.0
path: .spaces[19].metrics.cognitive.sum
old: 0.0
new: 18.0
path: .spaces[19].metrics.cyclomatic.average
old: 1.0
new: 12.0
path: .spaces[19].metrics.cyclomatic.sum
old: 1.0
new: 12.0
path: .spaces[19].metrics.nexits.sum
old: 0.0
new: 4.0
path: .spaces[19].metrics.nexits.average
old: 0.0
new: 4.0
path: .spaces[19].metrics.nargs.average
old: 1.0
new: 4.0
path: .spaces[19].metrics.nargs.sum
old: 1.0
new: 4.0
path: .spaces[19].metrics.mi.mi_original
old: 132.43687749961728
new: 64.16466394569191
path: .spaces[19].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 37.52319528987831
path: .spaces[19].metrics.mi.mi_sei
old: 115.46699426690871
new: 41.26561029791128
path: .spaces[19].metrics.loc.sloc
old: 3.0
new: 62.0
path: .spaces[19].metrics.loc.blank
old: 0.0
new: 8.0
path: .spaces[19].metrics.loc.lloc
old: 1.0
new: 32.0
path: .spaces[19].metrics.loc.ploc
old: 3.0
new: 48.0
path: .spaces[19].metrics.loc.cloc
old: 0.0
new: 6.0
path: .spaces[19].metrics.halstead.effort
old: 186.8093074064141
new: 42277.3151136991
path: .spaces[19].metrics.halstead.n2
old: 5.0
new: 33.0
path: .spaces[19].metrics.halstead.time
old: 10.378294855911893
new: 2348.739728538839
path: .spaces[19].metrics.halstead.length
old: 15.0
new: 219.0
path: .spaces[19].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 1.290234751978069
path: .spaces[19].metrics.halstead.volume
old: 51.89147427955946
new: 1282.8978379329385
path: .spaces[19].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 282.5614106831971
path: .spaces[19].metrics.halstead.vocabulary
old: 11.0
new: 58.0
path: .spaces[19].metrics.halstead.N2
old: 6.0
new: 87.0
path: .spaces[19].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.404529636833066
path: .spaces[19].metrics.halstead.level
old: 0.2777777777777778
new: 0.030344827586206897
path: .spaces[19].metrics.halstead.n1
old: 6.0
new: 25.0
path: .spaces[19].metrics.halstead.N1
old: 9.0
new: 132.0
path: .spaces[19].metrics.halstead.difficulty
old: 3.6
new: 32.95454545454545
Code
nsStorageInputStream::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
uint32_t aCount, uint32_t* aNumRead) {
*aNumRead = 0;
if (mStatus == NS_BASE_STREAM_CLOSED) {
return NS_OK;
}
if (NS_FAILED(mStatus)) {
return mStatus;
}
uint32_t count, availableInSegment, remainingCapacity, bytesConsumed;
nsresult rv;
remainingCapacity = aCount;
while (remainingCapacity) {
availableInSegment = mSegmentEnd - mReadCursor;
if (!availableInSegment) {
uint32_t available = mStorageStream->mLogicalLength - mLogicalCursor;
if (!available) {
goto out;
}
// We have data in the stream, but if mSegmentEnd is zero, then we
// were likely constructed prior to any data being written into
// the stream. Therefore, if mSegmentEnd is non-zero, we should
// move into the next segment; otherwise, we should stay in this
// segment so our input state can be updated and we can properly
// perform the initial read.
if (mSegmentEnd > 0) {
mSegmentNum++;
}
mReadCursor = 0;
mSegmentEnd = XPCOM_MIN(mSegmentSize, available);
availableInSegment = mSegmentEnd;
}
const char* cur = mStorageStream->mSegmentedBuffer->GetSegment(mSegmentNum);
count = XPCOM_MIN(availableInSegment, remainingCapacity);
rv = aWriter(this, aClosure, cur + mReadCursor, aCount - remainingCapacity,
count, &bytesConsumed);
if (NS_FAILED(rv) || (bytesConsumed == 0)) {
break;
}
remainingCapacity -= bytesConsumed;
mReadCursor += bytesConsumed;
mLogicalCursor += bytesConsumed;
}
out:
*aNumRead = aCount - remainingCapacity;
bool isWriteInProgress = false;
if (NS_FAILED(mStorageStream->GetWriteInProgress(&isWriteInProgress))) {
isWriteInProgress = false;
}
if (*aNumRead == 0 && isWriteInProgress) {
return NS_BASE_STREAM_WOULD_BLOCK;
}
return NS_OK;
}