Skip to content

Commit 49ebad6

Browse files
committed
no var
1 parent 3ff17c7 commit 49ebad6

3 files changed

Lines changed: 46 additions & 46 deletions

File tree

src/Usmap.NET.Tests/Tests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static async Task<string> DownloadOodleAsync()
5959
var entry = zip.GetEntry(entryName);
6060
ArgumentNullException.ThrowIfNull(entry, "oodle entry in zip not found");
6161
await using var entryStream = entry.Open();
62-
var filePath = Path.GetTempFileName();
62+
string filePath = Path.GetTempFileName();
6363
await using var fs = File.Create(filePath);
6464
await entryStream.CopyToAsync(fs);
6565
return filePath;

src/Usmap.NET/Usmap.cs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -96,37 +96,37 @@ public static Usmap Parse<TReader>(ref TReader usmapReader, UsmapOptions? option
9696

9797
try
9898
{
99-
var magic = usmapReader.Read<ushort>();
99+
ushort magic = usmapReader.Read<ushort>();
100100
if (magic != Magic)
101101
throw new FileLoadException($"Invalid .usmap magic constant: 0x{magic:X4}, expected: 0x{Magic:X4}");
102-
var version = usmapReader.Read<EUsmapVersion>();
102+
EUsmapVersion version = usmapReader.Read<EUsmapVersion>();
103103
if (version > EUsmapVersion.Latest)
104104
throw new FileLoadException($"Invalid or unsupported .usmap version: {(int)version}");
105105

106-
var bHasVersioning = version >= EUsmapVersion.PackageVersioning && usmapReader.ReadBoolean();
106+
bool bHasVersioning = version >= EUsmapVersion.PackageVersioning && usmapReader.ReadBoolean();
107107
if (bHasVersioning)
108108
{
109109
//usmapReader.Read<FPackageFileVersion>();
110110
usmapReader.Position += sizeof(int) * 2;
111111

112112
//usmapReader.Read<FCustomVersionContainer>();
113-
var versionsLength = usmapReader.Read<int>();
113+
int versionsLength = usmapReader.Read<int>();
114114
usmapReader.Position += versionsLength * (16 /* FGuid */ + sizeof(int));
115115
}
116116

117-
var compressionMethod = usmapReader.Read<EUsmapCompressionMethod>();
118-
var compressedSize = usmapReader.Read<int>();
119-
var uncompressedSize = usmapReader.Read<int>();
117+
EUsmapCompressionMethod compressionMethod = usmapReader.Read<EUsmapCompressionMethod>();
118+
int compressedSize = usmapReader.Read<int>();
119+
int uncompressedSize = usmapReader.Read<int>();
120120

121121
if (compressionMethod > EUsmapCompressionMethod.Max)
122122
throw new FileLoadException($"Invalid or unsupported .usmap compression: {(int)compressionMethod}");
123-
if (usmapReader.Length - usmapReader.Position < (uint)compressedSize)
123+
if (usmapReader.Length - usmapReader.Position < compressedSize)
124124
throw new FileLoadException("There is not enough data in the .usmap file");
125125

126126
options ??= new UsmapOptions();
127-
var longFName = version >= EUsmapVersion.LongFName;
128-
var largeEnums = version >= EUsmapVersion.LargeEnums;
129-
var explicitEnumValues = version >= EUsmapVersion.ExplicitEnumValues;
127+
bool longFName = version >= EUsmapVersion.LongFName;
128+
bool largeEnums = version >= EUsmapVersion.LargeEnums;
129+
bool explicitEnumValues = version >= EUsmapVersion.ExplicitEnumValues;
130130

131131
if (compressionMethod == EUsmapCompressionMethod.None)
132132
{
@@ -149,7 +149,7 @@ public static Usmap Parse<TReader>(ref TReader usmapReader, UsmapOptions? option
149149
if (options.Oodle is null)
150150
throw new InvalidOperationException(".usmap data is compressed and oodle instance was null");
151151

152-
var result = (int)options.Oodle.Decompress(compressedSpan, uncompressedData
152+
int result = (int)options.Oodle.Decompress(compressedSpan, uncompressedData
153153
#if !NET9_0_OR_GREATER
154154
.Span
155155
#endif
@@ -166,7 +166,7 @@ public static Usmap Parse<TReader>(ref TReader usmapReader, UsmapOptions? option
166166
#if !NET9_0_OR_GREATER
167167
.Span
168168
#endif
169-
, out var bytesWritten))
169+
, out int bytesWritten))
170170
{
171171
throw new FileLoadException($"Failed to decompress brotli .usmap data: {bytesWritten} / {uncompressedSize}");
172172
}
@@ -180,7 +180,7 @@ public static Usmap Parse<TReader>(ref TReader usmapReader, UsmapOptions? option
180180
#if !NET9_0_OR_GREATER
181181
.Span
182182
#endif
183-
, out var bytesWritten))
183+
, out int bytesWritten))
184184
{
185185
throw new FileLoadException($"Failed to decompress zstd .usmap data: {bytesWritten} / {uncompressedSize}");
186186
}
@@ -215,39 +215,39 @@ private static Usmap ParseInternal<TReader>(ref TReader reader, UsmapOptions opt
215215
UsmapSchema[] schemas;
216216

217217
{
218-
var size = reader.Read<uint>();
218+
uint size = reader.Read<uint>();
219219
names = new string[size];
220220

221-
for (var i = 0; i < size; ++i)
221+
for (int i = 0; i < size; ++i)
222222
{
223-
var nameLength = (int)(longFName
223+
int nameLength = longFName
224224
? reader.Read<ushort>()
225-
: reader.Read<byte>());
226-
var name = reader.ReadString(nameLength, Encoding.UTF8);
225+
: reader.Read<byte>();
226+
string name = reader.ReadString(nameLength, Encoding.UTF8);
227227
names[i] = name;
228228
}
229229
}
230230

231231
{
232-
var size = reader.Read<uint>();
232+
uint size = reader.Read<uint>();
233233
enums = new UsmapEnum[size];
234234

235-
for (var i = 0; i < size; ++i)
235+
for (int i = 0; i < size; ++i)
236236
{
237-
var idx = reader.Read<uint>();
238-
var enumName = names[idx];
239-
var enumMembersSize = (int)(largeEnums
237+
uint idx = reader.Read<uint>();
238+
string enumName = names[idx];
239+
int enumMembersSize = largeEnums
240240
? reader.Read<ushort>()
241-
: reader.Read<byte>());
241+
: reader.Read<byte>();
242242
var enumMembers = new UsmapEnumMember[enumMembersSize];
243243

244-
for (var j = 0; j < enumMembersSize; ++j)
244+
for (int j = 0; j < enumMembersSize; ++j)
245245
{
246-
var memberValue = explicitEnumValues
246+
long memberValue = explicitEnumValues
247247
? reader.Read<long>()
248248
: j;
249-
var memberNameIdx = reader.Read<uint>();
250-
var memberName = names[memberNameIdx];
249+
uint memberNameIdx = reader.Read<uint>();
250+
string memberName = names[memberNameIdx];
251251
enumMembers[j] = new UsmapEnumMember(memberName, memberValue);
252252
}
253253

@@ -256,20 +256,20 @@ private static Usmap ParseInternal<TReader>(ref TReader reader, UsmapOptions opt
256256
}
257257

258258
{
259-
var size = reader.Read<uint>();
259+
uint size = reader.Read<uint>();
260260
schemas = new UsmapSchema[size];
261261

262-
for (var i = 0; i < size; ++i)
262+
for (int i = 0; i < size; ++i)
263263
{
264-
var idx = reader.Read<uint>();
265-
var schemaName = names[idx];
266-
var superIdx = reader.Read<uint>();
267-
var schemaSuperType = superIdx == uint.MaxValue
264+
uint idx = reader.Read<uint>();
265+
string schemaName = names[idx];
266+
uint superIdx = reader.Read<uint>();
267+
string? schemaSuperType = superIdx == uint.MaxValue
268268
? null
269269
: names[superIdx];
270-
var propCount = reader.Read<ushort>();
270+
ushort propCount = reader.Read<ushort>();
271271

272-
var serializablePropCount = reader.Read<ushort>();
272+
ushort serializablePropCount = reader.Read<ushort>();
273273
UsmapProperty[] props;
274274

275275
if (serializablePropCount == 0)
@@ -280,13 +280,13 @@ private static Usmap ParseInternal<TReader>(ref TReader reader, UsmapOptions opt
280280
{
281281
props = new UsmapProperty[serializablePropCount];
282282

283-
for (var j = 0; j < serializablePropCount; ++j)
283+
for (int j = 0; j < serializablePropCount; ++j)
284284
{
285-
var schemaIdx = reader.Read<ushort>();
286-
var arraySize = reader.Read<byte>();
287-
var nameIdx = reader.Read<uint>();
285+
ushort schemaIdx = reader.Read<ushort>();
286+
byte arraySize = reader.Read<byte>();
287+
uint nameIdx = reader.Read<uint>();
288288
var data = UsmapPropertyData.Deserialize(ref reader, names);
289-
var name = names[nameIdx];
289+
string name = names[nameIdx];
290290
props[j] = new UsmapProperty(name, schemaIdx, arraySize, data);
291291
}
292292
}

src/Usmap.NET/UsmapPropertyData.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ internal static UsmapPropertyData Deserialize<TReader>(ref TReader reader, strin
2727
, allows ref struct
2828
#endif
2929
{
30-
var propType = reader.Read<EUsmapPropertyType>();
30+
EUsmapPropertyType propType = reader.Read<EUsmapPropertyType>();
3131
var data = new UsmapPropertyData(propType);
3232

3333
switch (propType)
3434
{
3535
case EUsmapPropertyType.EnumProperty:
3636
{
3737
data.InnerType = Deserialize(ref reader, names);
38-
var idx = reader.Read<uint>();
38+
uint idx = reader.Read<uint>();
3939
data.EnumName = names[idx];
4040
break;
4141
}
4242
case EUsmapPropertyType.StructProperty:
4343
{
44-
var idx = reader.Read<uint>();
44+
uint idx = reader.Read<uint>();
4545
data.StructType = names[idx];
4646
break;
4747
}

0 commit comments

Comments
 (0)