From 2e928e86fd10627c9139c074a37e55de986e75e6 Mon Sep 17 00:00:00 2001 From: haykpetros Date: Tue, 4 Aug 2015 03:24:59 -0700 Subject: [PATCH 1/2] Removed unused method. --- SharpCompress/Compressor/LZMA/CRC.cs | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/SharpCompress/Compressor/LZMA/CRC.cs b/SharpCompress/Compressor/LZMA/CRC.cs index e97a5f28..17ec9f6e 100644 --- a/SharpCompress/Compressor/LZMA/CRC.cs +++ b/SharpCompress/Compressor/LZMA/CRC.cs @@ -79,33 +79,5 @@ namespace SharpCompress.Compressor.LZMA return crc; } - -#if !PORTABLE && !NETFX_CORE - public static unsafe uint Update(uint crc, byte* buffer, int length) - { - while (length > 0 && ((int) buffer & 3) != 0) - { - crc = Update(crc, *buffer); - buffer++; - length--; - } - - while (length >= 4) - { - crc = Update(crc, *(uint*) buffer); - buffer += 4; - length -= 4; - } - - while (length > 0) - { - crc = Update(crc, *buffer); - length--; - } - - return crc; - } - -#endif } } \ No newline at end of file From 35a8b444b8bbd21aaee69387c65ef873617d5a8e Mon Sep 17 00:00:00 2001 From: haykpetros Date: Tue, 4 Aug 2015 03:47:09 -0700 Subject: [PATCH 2/2] I feel there is no need to use unsafe version, so conditional compilation has been removed and only safe version kept. --- SharpCompress/Utility.cs | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/SharpCompress/Utility.cs b/SharpCompress/Utility.cs index 38d1c8b7..a6c05f73 100644 --- a/SharpCompress/Utility.cs +++ b/SharpCompress/Utility.cs @@ -199,21 +199,11 @@ namespace SharpCompress /// /// the value to write /// -#if PORTABLE || NETFX_CORE public static void WriteLittleEndian(byte[] array, int pos, short value) { byte[] newBytes = BitConverter.GetBytes(value); Array.Copy(newBytes, 0, array, pos, newBytes.Length); } -#else - public static unsafe void WriteLittleEndian(byte[] array, int pos, short value) - { - fixed (byte* numRef = &(array[pos])) - { - *((short*)numRef) = value; - } - } -#endif /// Increment a short value at the specified position by the specified amount /// (little endian). @@ -241,21 +231,11 @@ namespace SharpCompress /// /// the value to write /// -#if PORTABLE || NETFX_CORE public static void WriteLittleEndian(byte[] array, int pos, int value) { byte[] newBytes = BitConverter.GetBytes(value); Array.Copy(newBytes, 0, array, pos, newBytes.Length); } -#else - public static unsafe void WriteLittleEndian(byte[] array, int pos, int value) - { - fixed (byte* numRef = &(array[pos])) - { - *((int*)numRef) = value; - } - } -#endif public static void Initialize(this T[] array, Func func) {