Global Metrics

path: .metrics.loc.lloc
old: 456.0
new: 0.0

path: .metrics.loc.sloc
old: 1345.0
new: 80.0

path: .metrics.loc.cloc
old: 273.0
new: 18.0

path: .metrics.loc.blank
old: 152.0
new: 13.0

path: .metrics.loc.ploc
old: 920.0
new: 49.0

path: .metrics.nom.total
old: 43.0
new: 2.0

path: .metrics.nom.functions
old: 43.0
new: 2.0

path: .metrics.cyclomatic.average
old: 6.0227272727272725
new: 1.0

path: .metrics.cyclomatic.sum
old: 265.0
new: 6.0

path: .metrics.cognitive.average
old: 9.0
new: 0.0

path: .metrics.cognitive.sum
old: 387.0
new: 0.0

path: .metrics.nargs.average
old: 1.162790697674419
new: 0.0

path: .metrics.nargs.sum
old: 50.0
new: 0.0

path: .metrics.mi.mi_sei
old: -105.85345950646766
new: 47.73817302679756

path: .metrics.mi.mi_original
old: -61.875434451006925
new: 61.901111329607446

path: .metrics.mi.mi_visual_studio
old: 0.0
new: 36.19948030971196

path: .metrics.nexits.average
old: 2.3255813953488373
new: 0.0

path: .metrics.nexits.sum
old: 100.0
new: 0.0

path: .metrics.halstead.N2
old: 1882.0
new: 75.0

path: .metrics.halstead.vocabulary
old: 386.0
new: 53.0

path: .metrics.halstead.time
old: 199885.21647476233
new: 637.5720982162607

path: .metrics.halstead.volume
old: 40900.09549739606
new: 1168.4957727308924

path: .metrics.halstead.difficulty
old: 87.96883852691218
new: 9.821428571428571

path: .metrics.halstead.bugs
old: 7.826739246987825
new: 0.1695950936262192

path: .metrics.halstead.purity_ratio
old: 0.6626237625427639
new: 1.2967209782437168

path: .metrics.halstead.n2
old: 353.0
new: 42.0

path: .metrics.halstead.level
old: 0.01136766173960648
new: 0.10181818181818182

path: .metrics.halstead.estimated_program_length
old: 3154.089109703556
new: 264.53107956171823

path: .metrics.halstead.N1
old: 2878.0
new: 129.0

path: .metrics.halstead.effort
old: 3597933.896545722
new: 11476.297767892693

path: .metrics.halstead.length
old: 4760.0
new: 204.0

path: .metrics.halstead.n1
old: 33.0
new: 11.0

Spaces Data

Minimal test - lines (15, 78)

path: .spaces[0].metrics.nexits.average
old: 1.0
new: 0.0

path: .spaces[0].metrics.nexits.sum
old: 1.0
new: 0.0

path: .spaces[0].metrics.halstead.n1
old: 6.0
new: 11.0

path: .spaces[0].metrics.halstead.level
old: 0.2777777777777778
new: 0.0998719590268886

path: .spaces[0].metrics.halstead.estimated_program_length
old: 27.11941547876375
new: 244.18443434063795

path: .spaces[0].metrics.halstead.effort
old: 186.8093074064141
new: 11302.183805677076

path: .spaces[0].metrics.halstead.n2
old: 5.0
new: 39.0

path: .spaces[0].metrics.halstead.N1
old: 9.0
new: 129.0

path: .spaces[0].metrics.halstead.N2
old: 6.0
new: 71.0

path: .spaces[0].metrics.halstead.length
old: 15.0
new: 200.0

path: .spaces[0].metrics.halstead.vocabulary
old: 11.0
new: 50.0

path: .spaces[0].metrics.halstead.time
old: 10.378294855911893
new: 627.8991003153931

path: .spaces[0].metrics.halstead.difficulty
old: 3.6
new: 10.012820512820513

path: .spaces[0].metrics.halstead.bugs
old: 0.01089292262669305
new: 0.16787537244799708

path: .spaces[0].metrics.halstead.volume
old: 51.89147427955946
new: 1128.7712379549448

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.8079610319175832
new: 1.2209221717031895

path: .spaces[0].metrics.nom.total
old: 1.0
new: 2.0

path: .spaces[0].metrics.nom.functions
old: 1.0
new: 2.0

path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 5.0

path: .spaces[0].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 38.55315348858419

path: .spaces[0].metrics.mi.mi_original
old: 132.43687749961728
new: 65.92589246547895

path: .spaces[0].metrics.mi.mi_sei
old: 115.46699426690871
new: 49.86960320477696

path: .spaces[0].metrics.loc.cloc
old: 0.0
new: 11.0

path: .spaces[0].metrics.loc.sloc
old: 3.0
new: 64.0

path: .spaces[0].metrics.loc.blank
old: 0.0
new: 10.0

path: .spaces[0].metrics.loc.ploc
old: 3.0
new: 43.0

path: .spaces[0].metrics.loc.lloc
old: 1.0
new: 0.0

path: .spaces[0].metrics.nargs.average
old: 1.0
new: 0.0

path: .spaces[0].metrics.nargs.sum
old: 1.0
new: 0.0

Code

namespace mozilla {
namespace detail {

//
// Utility class providing primitives necessary to build streams based
// on the snappy compressor.  This essentially abstracts the framing format
// defined in:
//
//  other-licences/snappy/src/framing_format.txt
//
// NOTE: Currently only the StreamIdentifier and CompressedData chunks are
//       supported.
//
class SnappyFrameUtils {
 public:
  enum ChunkType {
    Unknown,
    StreamIdentifier,
    CompressedData,
    UncompressedData,
    Padding,
    Reserved,
    ChunkTypeCount
  };

  static const size_t kChunkTypeLength = 1;
  static const size_t kChunkLengthLength = 3;
  static const size_t kHeaderLength = kChunkTypeLength + kChunkLengthLength;
  static const size_t kStreamIdentifierDataLength = 6;
  static const size_t kCRCLength = 4;

  static nsresult WriteStreamIdentifier(char* aDest, size_t aDestLength,
                                        size_t* aBytesWrittenOut);

  static nsresult WriteCompressedData(char* aDest, size_t aDestLength,
                                      const char* aData, size_t aDataLength,
                                      size_t* aBytesWrittenOut);

  static nsresult ParseHeader(const char* aSource, size_t aSourceLength,
                              ChunkType* aTypeOut, size_t* aDataLengthOut);

  static nsresult ParseData(char* aDest, size_t aDestLength, ChunkType aType,
                            const char* aData, size_t aDataLength,
                            size_t* aBytesWrittenOut, size_t* aBytesReadOut);

  static nsresult ParseStreamIdentifier(char* aDest, size_t aDestLength,
                                        const char* aData, size_t aDataLength,
                                        size_t* aBytesWrittenOut,
                                        size_t* aBytesReadOut);

  static nsresult ParseCompressedData(char* aDest, size_t aDestLength,
                                      const char* aData, size_t aDataLength,
                                      size_t* aBytesWrittenOut,
                                      size_t* aBytesReadOut);

  static size_t MaxCompressedBufferLength(size_t aSourceLength);

 protected:
  SnappyFrameUtils() = default;
  virtual ~SnappyFrameUtils() = default;
};

}  // namespace detail
}  // namespace mozilla