Skip to content
This repository has been archived by the owner on Mar 21, 2020. It is now read-only.

Commit

Permalink
Use offset as a variable in the search
Browse files Browse the repository at this point in the history
Makes the search not repeat itself.
  • Loading branch information
kwsch committed Sep 24, 2015
1 parent bfd7aef commit 8649dd9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Misc/Util.cs
Expand Up @@ -91,8 +91,8 @@ internal static void ReplaceAllBytes(byte[] array, byte[] oldPattern, byte[] new
{
if (oldPattern.Length != newPattern.Length || oldPattern.SequenceEqual(newPattern))
return;
int offset; // Loop until no instances of oldPattern are found
while ((offset = IndexOfBytes(array, oldPattern, 0, 0)) != -1)
int offset = 0; // Loop until no instances of oldPattern are found
while ((offset = IndexOfBytes(array, oldPattern, offset, 0)) != -1)
Array.Copy(newPattern, 0, array, offset, newPattern.Length);
}
}
Expand Down

0 comments on commit 8649dd9

Please sign in to comment.