Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ public uint TranslateLocalCounterPath(string englishPath, out string localizedPa
// NOTE: 1-based enumeration because the name strings follow index strings in the array
Int32 counterIndex = -1;
Int32 objIndex = -1;
for (uint enumIndex = 1; enumIndex < regCounters.Length; enumIndex++)
for (int enumIndex = 1; enumIndex < regCounters.Length; enumIndex++)
{
string regString = regCounters[enumIndex];
if (regString.ToLowerInvariant() == lowerEngCtrName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class TestConnectionCommand : PSCmdlet, IDisposable

// Count of pings sent to each trace route hop. Default mimics Windows' defaults.
// If this value changes, we need to update 'ConsoleTraceRouteReply' resource string.
private const int DefaultTraceRoutePingCount = 3;
private const uint DefaultTraceRoutePingCount = 3;

// Default size for the send buffer.
private const int DefaultSendBufferSize = 32;
Expand Down Expand Up @@ -608,7 +608,7 @@ private void ProcessPing(string targetNameOrAddress)
int timeout = TimeoutSeconds * 1000;
int delay = Delay * 1000;

for (uint i = 1; i <= Count; i++)
for (int i = 1; i <= Count; i++)
{
try
{
Expand Down Expand Up @@ -642,7 +642,7 @@ private void ProcessPing(string targetNameOrAddress)
reply,
reply.RoundtripTime,
buffer.Length,
pingNum: i));
pingNum: (uint)i));
}

// Delay between pings, but not after last ping.
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.PowerShell.Security/security/AclCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ public static SecurityIdentifier GetCentralAccessPolicyId(PSObject instance)

// Extract the first CAPID from the SACL that does not have INHERIT_ONLY_ACE flag set.
IntPtr pAce = pSacl + Marshal.SizeOf(new NativeMethods.ACL());
for (uint aceIdx = 0; aceIdx < sacl.AceCount; aceIdx++)
for (ushort aceIdx = 0; aceIdx < sacl.AceCount; aceIdx++)
{
NativeMethods.ACE_HEADER ace = new NativeMethods.ACE_HEADER();
ace = Marshal.PtrToStructure<NativeMethods.ACE_HEADER>(pAce);
Expand Down
6 changes: 3 additions & 3 deletions src/System.Management.Automation/engine/Attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ public sealed class ValidateCountAttribute : ValidateArgumentsAttribute
/// </exception>
protected override void Validate(object arguments, EngineIntrinsics engineIntrinsics)
{
UInt32 len = 0;
int len = 0;
if (arguments == null || arguments == AutomationNull.Value)
{
// treat a nul list the same as an empty list
Expand All @@ -1441,11 +1441,11 @@ protected override void Validate(object arguments, EngineIntrinsics engineIntrin
}
else if (arguments is IList il)
{
len = (UInt32)il.Count;
len = il.Count;
}
else if (arguments is ICollection ic)
{
len = (UInt32)ic.Count;
len = ic.Count;
}
else if (arguments is IEnumerable ie)
{
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/SessionState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal SessionStateInternal(SessionStateInternal parent, bool linkToGlobal, Ex
_workingLocationStack = new Dictionary<string, Stack<PathInfo>>(StringComparer.OrdinalIgnoreCase);

// Conservative choice to limit the Set-Location history in order to limit memory impact in case of a regression.
const uint locationHistoryLimit = 20;
const int locationHistoryLimit = 20;
_setLocationHistory = new HistoryStack<PathInfo>(locationHistoryLimit);

GlobalScope = new SessionStateScope(null);
Expand Down
6 changes: 3 additions & 3 deletions src/System.Management.Automation/engine/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2133,7 +2133,7 @@ internal class HistoryStack<T>
private readonly BoundedStack<T> _boundedUndoStack;
private readonly BoundedStack<T> _boundedRedoStack;

internal HistoryStack(uint capacity)
internal HistoryStack(int capacity)
{
_boundedUndoStack = new BoundedStack<T>(capacity);
_boundedRedoStack = new BoundedStack<T>(capacity);
Expand Down Expand Up @@ -2178,13 +2178,13 @@ internal T Redo(T currentItem)
/// </summary>
internal class BoundedStack<T> : LinkedList<T>
{
private readonly uint _capacity;
private readonly int _capacity;

/// <summary>
/// Lazy initialisation, i.e. it sets only its limit but does not allocate the memory for the given capacity.
/// </summary>
/// <param name="capacity"></param>
internal BoundedStack(uint capacity)
internal BoundedStack(int capacity)
{
_capacity = capacity;
}
Expand Down
2 changes: 1 addition & 1 deletion test/xUnit/csharp/test_Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static void TestHistoryStack()
[Fact]
public static void TestBoundedStack()
{
uint capacity = 20;
int capacity = 20;
var boundedStack = new BoundedStack<string>(capacity);
Assert.Throws<InvalidOperationException>(() => boundedStack.Pop());

Expand Down