Skip to content

Commit 5db737c

Browse files
author
rstam
committed
Changed return type of GetCurrentProcessId.
1 parent 8171f85 commit 5db737c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Bson/ObjectModel/ObjectId.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using System.Runtime.CompilerServices;
2121
using System.Security;
2222
using System.Security.Cryptography;
23-
using System.Security.Permissions;
2423
using System.Text;
2524
using System.Threading;
2625

@@ -55,11 +54,11 @@ static ObjectId()
5554

5655
try
5756
{
58-
__staticPid = GetCurrentProcessId();
57+
__staticPid = (short)GetCurrentProcessId(); // use low order two bytes only
5958
}
6059
catch (SecurityException)
6160
{
62-
__staticPid = (short)0;
61+
__staticPid = 0;
6362
}
6463
}
6564

@@ -368,9 +367,9 @@ public static void Unpack(byte[] bytes, out int timestamp, out int machine, out
368367
/// before throwing an exception requiring the try/catch at an even higher level that we don't necessarily control.
369368
/// </summary>
370369
[MethodImpl(MethodImplOptions.NoInlining)]
371-
private static short GetCurrentProcessId()
370+
private static int GetCurrentProcessId()
372371
{
373-
return (short)Process.GetCurrentProcess().Id;
372+
return Process.GetCurrentProcess().Id;
374373
}
375374

376375
private static int GetMachineHash()

0 commit comments

Comments
 (0)