Exemple #1
0
        public static bool BrotliEncoderCompressStream(
            IntPtr state, BrotliEncoderOperation operation, ref UInt32 availableIn,
            ref IntPtr nextIn, ref UInt32 availableOut, ref IntPtr nextOut, out UInt32 totalOut)
        {
            if (USE_X86)
            {
                return(Brolib32.BrotliEncoderCompressStream(
                           state,
                           operation,
                           ref availableIn,
                           ref nextIn,
                           ref availableOut,
                           ref nextOut,
                           out totalOut));
            }

            UInt64 availableInL  = availableIn;
            UInt64 availableOutL = availableOut;
            UInt64 totalOutL     = 0;

            bool result = Brolib64.BrotliEncoderCompressStream(
                state,
                operation,
                ref availableInL,
                ref nextIn,
                ref availableOutL,
                ref nextOut,
                out totalOutL);

            availableIn  = (UInt32)availableInL;
            availableOut = (UInt32)availableOutL;
            totalOut     = (UInt32)totalOutL;

            return(result);
        }
Exemple #2
0
        public static BrotliDecoderResult BrotliDecoderDecompressStream(
            IntPtr state, ref UInt32 availableIn, ref IntPtr nextIn, ref UInt32 availableOut,
            ref IntPtr nextOut, out UInt32 totalOut)
        {
            if (USE_X86)
            {
                return(Brolib32.BrotliDecoderDecompressStream(
                           state,
                           ref availableIn,
                           ref nextIn,
                           ref availableOut,
                           ref nextOut,
                           out totalOut));
            }

            UInt64 availableInL  = availableIn;
            UInt64 availableOutL = availableOut;
            UInt64 totalOutL     = 0;

            BrotliDecoderResult result = Brolib64.BrotliDecoderDecompressStream(
                state,
                ref availableInL,
                ref nextIn,
                ref availableOutL,
                ref nextOut,
                out totalOutL);

            availableIn  = (UInt32)availableInL;
            availableOut = (UInt32)availableOutL;
            totalOut     = (UInt32)totalOutL;

            return(result);
        }
Exemple #3
0
 public static bool BrotliEncoderSetParameter(
     IntPtr state, BrotliEncoderParameter parameter, UInt32 value)
 {
     return(USE_X86
         ? Brolib32.BrotliEncoderSetParameter(state, parameter, value)
         : Brolib64.BrotliEncoderSetParameter(state, parameter, value));
 }
Exemple #4
0
        public static string  BrotliDecoderErrorString(Int32 code)
        {
            IntPtr result = USE_X86
                ? Brolib32.BrotliDecoderErrorString(code)
                : Brolib64.BrotliDecoderErrorString(code);

            return(result != IntPtr.Zero
                ? Marshal.PtrToStringAnsi(result)
                : string.Empty);
        }
Exemple #5
0
        public static void BrotliEncoderDestroyInstance(IntPtr state)
        {
            if (USE_X86)
            {
                Brolib32.BrotliEncoderDestroyInstance(state);
                return;
            }

            Brolib64.BrotliEncoderDestroyInstance(state);
        }
Exemple #6
0
        public static void BrotliEncoderSetCustomDictionary(
            IntPtr state, UInt32 size, IntPtr dict)
        {
            if (USE_X86)
            {
                Brolib32.BrotliEncoderSetCustomDictionary(state, size, dict);
                return;
            }

            Brolib64.BrotliEncoderSetCustomDictionary(state, size, dict);
        }
Exemple #7
0
 public static bool BrotliEncoderIsFinished(IntPtr state)
 {
     if (UseX86)
     {
         return(Brolib32.BrotliEncoderIsFinished(state));
     }
     else
     {
         return(Brolib64.BrotliEncoderIsFinished(state));
     }
 }
Exemple #8
0
 public static UInt32 BrotliDecoderVersion()
 {
     if (UseX86)
     {
         return(Brolib32.BrotliDecoderVersion());
     }
     else
     {
         return(Brolib64.BrotliDecoderVersion());
     }
 }
Exemple #9
0
 public static Int32 BrotliDecoderGetErrorCode(IntPtr state)
 {
     if (UseX86)
     {
         return(Brolib32.BrotliDecoderGetErrorCode(state));
     }
     else
     {
         return(Brolib64.BrotliDecoderGetErrorCode(state));
     }
 }
Exemple #10
0
 public static IntPtr BrotliDecoderCreateInstance()
 {
     if (UseX86)
     {
         return(Brolib32.BrotliDecoderCreateInstance(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero));
     }
     else
     {
         return(Brolib64.BrotliDecoderCreateInstance(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero));
     }
 }
Exemple #11
0
 public static void BrotliDecoderDestroyInstance(IntPtr state)
 {
     if (UseX86)
     {
         Brolib32.BrotliDecoderDestroyInstance(state);
     }
     else
     {
         Brolib64.BrotliDecoderDestroyInstance(state);
     }
 }
 public static void BrotliEncoderSetCustomDictionary(IntPtr state, UInt32 size, IntPtr dict)
 {
     if (UseX86)
     {
         Brolib32.BrotliEncoderSetCustomDictionary(state, size, dict);
     }
     else
     {
         Brolib64.BrotliEncoderSetCustomDictionary(state, size, dict);
     }
 }
Exemple #13
0
 public static bool BrotliEncoderSetParameter(IntPtr state, BrotliEncoderParameter parameter, UInt32 value)
 {
     if (UseX86)
     {
         return(Brolib32.BrotliEncoderSetParameter(state, parameter, value));
     }
     else
     {
         return(Brolib64.BrotliEncoderSetParameter(state, parameter, value));
     }
 }
Exemple #14
0
 public static IntPtr BrotliEncoderTakeOutput(IntPtr state, ref UInt32 size)
 {
     if (UseX86)
     {
         return(Brolib32.BrotliEncoderTakeOutput(state, ref size));
     }
     else
     {
         UInt64 longSize = size;
         var    r        = Brolib64.BrotliEncoderTakeOutput(state, ref longSize);
         size = (UInt32)longSize;
         return(r);
     }
 }
Exemple #15
0
        public static String BrotliDecoderErrorString(Int32 code)
        {
            IntPtr r = IntPtr.Zero;

            if (UseX86)
            {
                r = Brolib32.BrotliDecoderErrorString(code);
            }
            else
            {
                r = Brolib64.BrotliDecoderErrorString(code);
            }

            if (r != IntPtr.Zero)
            {
                return(Marshal.PtrToStringAnsi(r));
            }
            return(String.Empty);
        }
Exemple #16
0
 public static bool BrotliDecoderIsUsed(IntPtr state)
 {
     return(USE_X86
         ? Brolib32.BrotliDecoderIsUsed(state)
         : Brolib64.BrotliDecoderIsUsed(state));
 }
Exemple #17
0
 public static bool BrotliEncoderIsFinished(IntPtr state)
 {
     return(USE_X86
         ? Brolib32.BrotliEncoderIsFinished(state)
         : Brolib64.BrotliEncoderIsFinished(state));
 }
Exemple #18
0
 public static Int32 BrotliDecoderGetErrorCode(IntPtr state)
 {
     return(USE_X86
         ? Brolib32.BrotliDecoderGetErrorCode(state)
         : Brolib64.BrotliDecoderGetErrorCode(state));
 }
Exemple #19
0
 public static UInt32 BrotliEncoderVersion()
 {
     return(USE_X86
         ? Brolib32.BrotliEncoderVersion()
         : Brolib64.BrotliEncoderVersion());
 }
Exemple #20
0
 public static IntPtr BrotliDecoderCreateInstance()
 {
     return(USE_X86
         ? Brolib32.BrotliDecoderCreateInstance(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero)
         : Brolib64.BrotliDecoderCreateInstance(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero));
 }