Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 3fa520a

Browse files
committed
Resolve warnings
1 parent 42e100b commit 3fa520a

File tree

6 files changed

+13
-18
lines changed

6 files changed

+13
-18
lines changed

src/ServiceStack.Text/Common/DeserializeType.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ private static SetMemberDelegate GetSetPropertyMethod(TypeConfig typeConfig, Pro
362362
}
363363

364364
return propertyInfo.CanWrite
365-
? PclExport.Instance.CreateSetter(propertyInfo)
366-
: PclExport.Instance.CreateSetter(fieldInfo);
365+
? ReflectionOptimizer.Instance.CreateSetter(propertyInfo)
366+
: ReflectionOptimizer.Instance.CreateSetter(fieldInfo);
367367
}
368368

369369
public static TypeAccessor Create(ITypeSerializer serializer, TypeConfig typeConfig, FieldInfo fieldInfo)
@@ -381,7 +381,7 @@ private static SetMemberDelegate GetSetFieldMethod(TypeConfig typeConfig, FieldI
381381
if (typeConfig.Type != fieldInfo.DeclaringType)
382382
fieldInfo = fieldInfo.DeclaringType.GetField(fieldInfo.Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
383383

384-
return PclExport.Instance.CreateSetter(fieldInfo);
384+
return ReflectionOptimizer.Instance.CreateSetter(fieldInfo);
385385
}
386386
}
387387

src/ServiceStack.Text/Json/JsonTypeSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ public ReadOnlySpan<char> EatMapKey(ReadOnlySpan<char> value, ref int i)
686686
}
687687
}
688688

689-
return value.Subsegment(tokenStartPos, i - tokenStartPos);
689+
return value.Slice(tokenStartPos, i - tokenStartPos);
690690
}
691691

692692
public bool EatMapKeySeperator(string value, ref int i) => EatMapKeySeperator(value.AsSpan(), ref i);

src/ServiceStack.Text/LicenseUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ static LicenseUtils()
125125
PclExport.Instance.RegisterLicenseFromConfig();
126126
}
127127

128-
private static bool hasInit;
128+
public static bool HasInit { get; private set; }
129129
public static void Init()
130130
{
131-
hasInit = true; //Dummy method to init static constructor
131+
HasInit = true; //Dummy method to init static constructor
132132
}
133133

134134
public static class ErrorMessages

src/ServiceStack.Text/MemoryProvider.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,6 @@ public static long ParseInt64(ReadOnlySpan<char> value)
917917
internal static class UnsignedInteger<T> where T : struct, IComparable<T>, IEquatable<T>, IConvertible
918918
{
919919
private static readonly TypeCode typeCode;
920-
private static readonly ulong minValue;
921920
private static readonly ulong maxValue;
922921

923922
static UnsignedInteger()
@@ -927,19 +926,15 @@ static UnsignedInteger()
927926
switch (typeCode)
928927
{
929928
case TypeCode.Byte:
930-
minValue = byte.MinValue;
931929
maxValue = byte.MaxValue;
932930
break;
933931
case TypeCode.UInt16:
934-
minValue = ushort.MinValue;
935932
maxValue = ushort.MaxValue;
936933
break;
937934
case TypeCode.UInt32:
938-
minValue = uint.MinValue;
939935
maxValue = uint.MaxValue;
940936
break;
941937
case TypeCode.UInt64:
942-
minValue = ulong.MinValue;
943938
maxValue = ulong.MaxValue;
944939
break;
945940
default:

src/ServiceStack.Text/StreamExtensions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public static string ReadToEnd(this MemoryStream ms, Encoding encoding)
320320
var ret = encoding.GetString(ms.GetBuffer(), 0, (int) ms.Length);
321321
return ret;
322322
}
323-
catch (UnauthorizedAccessException e)
323+
catch (UnauthorizedAccessException)
324324
{
325325
Tracer.Instance.WriteWarning("MemoryStream wasn't created with a publiclyVisible:true byte[] bufffer, falling back to slow impl");
326326

@@ -337,7 +337,7 @@ public static ReadOnlyMemory<byte> GetBufferAsMemory(this MemoryStream ms)
337337
{
338338
return new ReadOnlyMemory<byte>(ms.GetBuffer(), 0, (int)ms.Length);
339339
}
340-
catch (UnauthorizedAccessException e)
340+
catch (UnauthorizedAccessException)
341341
{
342342
Tracer.Instance.WriteWarning("MemoryStream in GetBufferAsSpan() wasn't created with a publiclyVisible:true byte[] bufffer, falling back to slow impl");
343343
return new ReadOnlyMemory<byte>(ms.ToArray());
@@ -350,7 +350,7 @@ public static ReadOnlySpan<byte> GetBufferAsSpan(this MemoryStream ms)
350350
{
351351
return new ReadOnlySpan<byte>(ms.GetBuffer(), 0, (int)ms.Length);
352352
}
353-
catch (UnauthorizedAccessException e)
353+
catch (UnauthorizedAccessException)
354354
{
355355
Tracer.Instance.WriteWarning("MemoryStream in GetBufferAsSpan() wasn't created with a publiclyVisible:true byte[] bufffer, falling back to slow impl");
356356
return new ReadOnlySpan<byte>(ms.ToArray());
@@ -363,7 +363,7 @@ public static byte[] GetBufferAsBytes(this MemoryStream ms)
363363
{
364364
return ms.GetBuffer();
365365
}
366-
catch (UnauthorizedAccessException e)
366+
catch (UnauthorizedAccessException)
367367
{
368368
Tracer.Instance.WriteWarning("MemoryStream in GetBufferAsBytes() wasn't created with a publiclyVisible:true byte[] bufffer, falling back to slow impl");
369369
return ms.ToArray();
@@ -379,7 +379,7 @@ public static Task<string> ReadToEndAsync(this MemoryStream ms, Encoding encodin
379379
var ret = encoding.GetString(ms.GetBuffer(), 0, (int) ms.Length);
380380
return ret.InTask();
381381
}
382-
catch (UnauthorizedAccessException e)
382+
catch (UnauthorizedAccessException)
383383
{
384384
Tracer.Instance.WriteWarning("MemoryStream in ReadToEndAsync() wasn't created with a publiclyVisible:true byte[] bufffer, falling back to slow impl");
385385

@@ -433,7 +433,7 @@ public static async Task WriteToAsync(this MemoryStream stream, Stream output, E
433433
{
434434
await output.WriteAsync(stream.GetBuffer(), 0, (int) stream.Length, token);
435435
}
436-
catch (UnauthorizedAccessException e)
436+
catch (UnauthorizedAccessException)
437437
{
438438
Tracer.Instance.WriteWarning("MemoryStream in WriteToAsync() wasn't created with a publiclyVisible:true byte[] bufffer, falling back to slow impl");
439439

tests/ServiceStack.Text.Tests/JsonTests/JsonObjectTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ public void Can_deserialize_custom_JsonObject_with_incorrect_payload()
503503
var payload = dto.Event.EventPayLoad.ConvertTo<EventPayLoadPosition>();
504504
Assert.Fail("Should throw");
505505
}
506-
catch (FormatException e) {}
506+
catch (FormatException) {}
507507
}
508508

509509

0 commit comments

Comments
 (0)