LCOV - code coverage report
Current view: top level - modules/libjar/zipwriter - nsDeflateConverter.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 11 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       3             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       4             :  */
       5             : 
       6             : #ifndef _nsDeflateConverter_h_
       7             : #define _nsDeflateConverter_h_
       8             : 
       9             : #include "nsIStreamConverter.h"
      10             : #include "nsCOMPtr.h"
      11             : #include "nsIPipe.h"
      12             : #include "zlib.h"
      13             : #include "mozilla/Attributes.h"
      14             : 
      15             : #define DEFLATECONVERTER_CID { 0x461cd5dd, 0x73c6, 0x47a4, \
      16             :            { 0x8c, 0xc3, 0x60, 0x3b, 0x37, 0xd8, 0x4a, 0x61 } }
      17             : 
      18             : #define ZIP_BUFLEN (4 * 1024 - 1)
      19             : 
      20             : class nsDeflateConverter final : public nsIStreamConverter
      21             : {
      22             : public:
      23             :     NS_DECL_ISUPPORTS
      24             :     NS_DECL_NSIREQUESTOBSERVER
      25             :     NS_DECL_NSISTREAMLISTENER
      26             :     NS_DECL_NSISTREAMCONVERTER
      27             : 
      28           0 :     nsDeflateConverter()
      29           0 :     {
      30             :         // 6 is Z_DEFAULT_COMPRESSION but we need the actual value
      31           0 :         mLevel = 6;
      32           0 :     }
      33             : 
      34           0 :     explicit nsDeflateConverter(int32_t level)
      35           0 :     {
      36           0 :         mLevel = level;
      37           0 :     }
      38             : 
      39             : private:
      40             : 
      41           0 :     ~nsDeflateConverter()
      42           0 :     {
      43           0 :     }
      44             : 
      45             :     enum WrapMode {
      46             :         WRAP_ZLIB,
      47             :         WRAP_GZIP,
      48             :         WRAP_NONE
      49             :     };
      50             : 
      51             :     WrapMode mWrapMode;
      52             :     uint64_t mOffset;
      53             :     int32_t mLevel;
      54             :     nsCOMPtr<nsIStreamListener> mListener;
      55             :     nsCOMPtr<nsISupports> mContext;
      56             :     z_stream mZstream;
      57             :     unsigned char mWriteBuffer[ZIP_BUFLEN];
      58             : 
      59             :     nsresult Init();
      60             :     nsresult PushAvailableData(nsIRequest *aRequest, nsISupports *aContext);
      61             : };
      62             : 
      63             : #endif

Generated by: LCOV version 1.13