From 49d13a2fe6c875ca22816b6c82618762958142bf Mon Sep 17 00:00:00 2001 From: buddytex Date: Wed, 4 Sep 2013 21:07:03 -0500 Subject: [PATCH 1/3] Eliminated usage of default parameters. --- OpenRA.FileFormats/FileFormats/CRC32.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenRA.FileFormats/FileFormats/CRC32.cs b/OpenRA.FileFormats/FileFormats/CRC32.cs index 22fd2077c5..1bdbe833e9 100644 --- a/OpenRA.FileFormats/FileFormats/CRC32.cs +++ b/OpenRA.FileFormats/FileFormats/CRC32.cs @@ -96,7 +96,7 @@ namespace OpenRA.FileFormats /// /// The calculated checksum. /// - public static uint Calculate(byte[] data, uint polynomal = 0xFFFFFFFF) + public static uint Calculate(byte[] data, uint polynomal) { uint crc = polynomal; for (int i = 0; i < data.Length; i++) @@ -104,6 +104,10 @@ namespace OpenRA.FileFormats crc ^= polynomal; return crc; } + public static uint Calculate(byte[] data) + { + return Calculate(data, 0xFFFFFFFF); + } /// /// A fast (native) CRC32 implementation that can be used on a pinned byte array using @@ -113,7 +117,7 @@ namespace OpenRA.FileFormats /// The length of the data data. /// The polynomal to xor with. /// The calculated checksum. - public static unsafe uint Calculate(byte* data, uint len, uint polynomal = 0xFFFFFFFF) + public static unsafe uint Calculate(byte* data, uint len, uint polynomal) { uint crc = polynomal; for (int i = 0; i < len; i++) @@ -121,5 +125,9 @@ namespace OpenRA.FileFormats crc ^= polynomal; return crc; } + public static unsafe uint Calculate(byte* data, uint len) + { + return Calculate(data, len, 0xFFFFFFFF); + } } } \ No newline at end of file From 5e3504fe44584e2121a49dd161fbe174054f6e44 Mon Sep 17 00:00:00 2001 From: buddytex Date: Thu, 5 Sep 2013 16:04:38 -0500 Subject: [PATCH 2/3] Fixed spelling. Changed polynomal to polynomial. --- OpenRA.FileFormats/FileFormats/CRC32.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenRA.FileFormats/FileFormats/CRC32.cs b/OpenRA.FileFormats/FileFormats/CRC32.cs index 1bdbe833e9..61de944e55 100644 --- a/OpenRA.FileFormats/FileFormats/CRC32.cs +++ b/OpenRA.FileFormats/FileFormats/CRC32.cs @@ -96,12 +96,12 @@ namespace OpenRA.FileFormats /// /// The calculated checksum. /// - public static uint Calculate(byte[] data, uint polynomal) + public static uint Calculate(byte[] data, uint polynomial) { - uint crc = polynomal; + uint crc = polynomial; for (int i = 0; i < data.Length; i++) crc = (crc >> 8) ^ lookUp[(crc & 0xFF) ^ data[i]]; - crc ^= polynomal; + crc ^= polynomial; return crc; } public static uint Calculate(byte[] data) @@ -117,12 +117,12 @@ namespace OpenRA.FileFormats /// The length of the data data. /// The polynomal to xor with. /// The calculated checksum. - public static unsafe uint Calculate(byte* data, uint len, uint polynomal) + public static unsafe uint Calculate(byte* data, uint len, uint polynomial) { - uint crc = polynomal; + uint crc = polynomial; for (int i = 0; i < len; i++) crc = (crc >> 8) ^ lookUp[(crc & 0xFF) ^ *data++]; - crc ^= polynomal; + crc ^= polynomial; return crc; } public static unsafe uint Calculate(byte* data, uint len) From 403e374b61bb8cafd81541d2682eaf42b4c20cbb Mon Sep 17 00:00:00 2001 From: buddytex Date: Thu, 5 Sep 2013 16:07:34 -0500 Subject: [PATCH 3/3] Removed default param usage. --- OpenRA.Mods.RA/AI/HackyAI.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.RA/AI/HackyAI.cs b/OpenRA.Mods.RA/AI/HackyAI.cs index 7bb15d84e6..c25260e0ca 100644 --- a/OpenRA.Mods.RA/AI/HackyAI.cs +++ b/OpenRA.Mods.RA/AI/HackyAI.cs @@ -500,12 +500,16 @@ namespace OpenRA.Mods.RA.AI return squads.Where(s => s.type == type).FirstOrDefault(); } - Squad RegisterNewSquad(SquadType type, Actor target = null) + Squad RegisterNewSquad(SquadType type, Actor target) { var ret = new Squad(this, type, target); squads.Add(ret); return ret; } + Squad RegisterNewSquad(SquadType type) + { + return RegisterNewSquad(type, null); + } int assignRolesTicks = 0; int rushTicks = 0;