fix(logging): Account for nullable value types

This commit updates logging to handle nullable value types and parameters.

The following changes were made:
- Updated the Value record to use '!' instead of '?' for nullability.
- Added '!' to the default Value.
- Added '!= null' checks to conditional assignment.
- Removed unnecessary nullable-disable compiler directives.
This commit is contained in:
Marc Hernandez 2024-08-15 22:26:47 -07:00
parent b59baf0239
commit f873c42cbf
6 changed files with 12 additions and 11 deletions

View File

@ -133,7 +133,8 @@ namespace lib
} }
else else
{ {
log.debug( $"{path} already exists." ); var cwd = Directory.GetCurrentDirectory();
log.debug( $"Dir {path}/ already exists. {cwd}" );
} }
} }

View File

@ -43,7 +43,7 @@ public sealed class ArithmeticDecoder : ArithmeticCoderBase
code = 0; code = 0;
for (int i = 0; i < numStateBits; i++) for (int i = 0; i < numStateBits; i++)
{ {
code = code << 1 | readCodeBit(); code = code << 1 | (long)readCodeBit();
} }
} }
@ -123,7 +123,7 @@ public sealed class ArithmeticDecoder : ArithmeticCoderBase
//ORIGINAL LINE: protected void shift() throws java.io.IOException //ORIGINAL LINE: protected void shift() throws java.io.IOException
protected internal override void shift() protected internal override void shift()
{ {
code = ((code << 1) & stateMask) | readCodeBit(); code = ((code << 1) & stateMask) | (long)readCodeBit();
} }
@ -131,7 +131,7 @@ public sealed class ArithmeticDecoder : ArithmeticCoderBase
//ORIGINAL LINE: protected void underflow() throws java.io.IOException //ORIGINAL LINE: protected void underflow() throws java.io.IOException
protected internal override void underflow() protected internal override void underflow()
{ {
code = (code & halfRange) | ((code << 1) & ((long)((ulong)stateMask >> 1))) | readCodeBit(); code = (code & halfRange) | ((code << 1) & ((long)((ulong)stateMask >> 1))) | (long)readCodeBit();
} }

View File

@ -97,7 +97,7 @@ public record class Versioned<T> : Imm
where T : Versioned<T> where T : Versioned<T>
{ {
public delegate void ChangeDelegate( T old, T next ); public delegate void ChangeDelegate( T? old, T next );
public record class MetaData : Meta public record class MetaData : Meta
{ {
@ -138,7 +138,7 @@ public record class Versioned<T> : Imm
[lib.Dont] [lib.Dont]
[DebuggerBrowsable(DebuggerBrowsableState.Never)] [DebuggerBrowsable(DebuggerBrowsableState.Never)]
public ChangeDelegate OnChange = (old, cur) => {}; public ChangeDelegate OnChange = (T? old,T cur) => {};
/* /*
public void AddOnChange( ChangeDelegate fn, public void AddOnChange( ChangeDelegate fn,

View File

@ -34,7 +34,7 @@ N O T D O I N G :
public record struct Value<T>( T _val, string _exp = "" ) public record struct Value<T>( T _val, string _exp = "" )
{ {
public static T Default = default; public static T Default = default!;
public static implicit operator T( Value<T> v ) public static implicit operator T( Value<T> v )
{ {

View File

@ -12,7 +12,7 @@ namespace Tracing
{ {
static public async Task<int> CreateTracingSession( bool noSampling, bool sortBySize, int topTypesLimit ) static public int CreateTracingSession( bool noSampling, bool sortBySize, int topTypesLimit )
{ {
ShowHeader(); ShowHeader();

View File

@ -395,7 +395,7 @@ public class Mgr
} }
} }
return actualLoad<T>( filename ); //return actualLoad<T>( filename );
} }
static object s_loadingLock = new object(); static object s_loadingLock = new object();