Beispiel #1
0
 public static SnappyStatus snappy_validate_compressed_buffer(byte[] input, int input_offset, int input_length)
 {
     using (var pinnedInput = new PinnedBuffer(input, input_offset))
     {
         return(Snappy64NativeMethods.snappy_validate_compressed_buffer(pinnedInput.IntPtr, (ulong)input_length));
     }
 }
Beispiel #2
0
 public static int snappy_max_compressed_length(int input_length)
 {
     if (__is64BitProcess)
     {
         return((int)Snappy64NativeMethods.snappy_max_compressed_length((ulong)input_length));
     }
     else
     {
         return((int)Snappy32NativeMethods.snappy_max_compressed_length((uint)input_length));
     }
 }
Beispiel #3
0
 public static SnappyStatus snappy_validate_compressed_buffer(IntPtr input, int input_length)
 {
     if (__is64BitProcess)
     {
         return(Snappy64NativeMethods.snappy_validate_compressed_buffer(input, (ulong)input_length));
     }
     else
     {
         return(Snappy32NativeMethods.snappy_validate_compressed_buffer(input, (uint)input_length));
     }
 }
Beispiel #4
0
        public static SnappyStatus snappy_uncompressed_length(byte[] input, int input_offset, int input_length, out int output_length)
        {
            SnappyStatus status;

            using (var pinnedInput = new PinnedBuffer(input, input_offset))
            {
                status        = Snappy64NativeMethods.snappy_uncompressed_length(pinnedInput.IntPtr, (ulong)input_length, out var ulongOutput_length);
                output_length = (int)ulongOutput_length;
            }
            return(status);
        }
Beispiel #5
0
        public static SnappyStatus snappy_compress(byte[] input, int input_offset, int input_length, byte[] output, int output_offset, ref int output_length)
        {
            SnappyStatus status;
            var          ulongOutput_length = (ulong)output_length;

            using (var pinnedInput = new PinnedBuffer(input, input_offset))
                using (var pinnedOutput = new PinnedBuffer(output, output_offset))
                {
                    status        = Snappy64NativeMethods.snappy_compress(pinnedInput.IntPtr, (ulong)input_length, pinnedOutput.IntPtr, ref ulongOutput_length);
                    output_length = (int)ulongOutput_length;
                }
            return(status);
        }
Beispiel #6
0
            public static SnappyStatus snappy_uncompressed_length(IntPtr input, int input_length, out int output_length)
            {
                SnappyStatus status;

                if (__is64BitProcess)
                {
                    status        = Snappy64NativeMethods.snappy_uncompressed_length(input, (ulong)input_length, out var ulongOutput_length);
                    output_length = (int)ulongOutput_length;
                }
                else
                {
                    status        = Snappy32NativeMethods.snappy_uncompressed_length(input, (uint)input_length, out var uintOutput_length);
                    output_length = (int)uintOutput_length;
                }
                return(status);
            }
Beispiel #7
0
            public static SnappyStatus snappy_compress(IntPtr input, int input_length, IntPtr output, ref int output_length)
            {
                SnappyStatus status;

                if (__is64BitProcess)
                {
                    var ulongOutput_length = (ulong)output_length;
                    status        = Snappy64NativeMethods.snappy_compress(input, (ulong)input_length, output, ref ulongOutput_length);
                    output_length = (int)ulongOutput_length;
                }
                else
                {
                    var uintOutput_length = (uint)output_length;
                    status        = Snappy32NativeMethods.snappy_compress(input, (uint)input_length, output, ref uintOutput_length);
                    output_length = (int)uintOutput_length;
                }

                return(status);
            }
Beispiel #8
0
 public static int snappy_max_compressed_length(int input_length)
 {
     return((int)Snappy64NativeMethods.snappy_max_compressed_length((ulong)input_length));
 }