anshdadhich commited on
Commit
124234c
·
verified ·
1 Parent(s): 4a4acc1

Upload FastSeekWpf/Core/IndexStore.cs

Browse files
Files changed (1) hide show
  1. FastSeekWpf/Core/IndexStore.cs +7 -3
FastSeekWpf/Core/IndexStore.cs CHANGED
@@ -103,7 +103,11 @@ public class IndexStore
103
 
104
  foreach (var r in scan.Records)
105
  {
106
- var nameChars = scan.NameData.Slice((int)r.NameOff, r.NameLen);
 
 
 
 
107
  string name = new string(nameChars);
108
  string nameLower = name.ToLowerInvariant();
109
 
@@ -303,8 +307,8 @@ public class IndexStore
303
 
304
  public string BuildPath(ulong fileRef)
305
  {
306
- // Stackalloc-friendly: use array instead of List
307
- Span<string> components = stackalloc string[64];
308
  int compCount = 0;
309
  ulong current = fileRef;
310
 
 
103
 
104
  foreach (var r in scan.Records)
105
  {
106
+ int start = (int)r.NameOff;
107
+ int len = r.NameLen;
108
+ var nameChars = new char[len];
109
+ for (int i = 0; i < len; i++)
110
+ nameChars[i] = scan.NameData[start + i];
111
  string name = new string(nameChars);
112
  string nameLower = name.ToLowerInvariant();
113
 
 
307
 
308
  public string BuildPath(ulong fileRef)
309
  {
310
+ // string is a managed type, can't stackalloc it. Use small heap array.
311
+ string[] components = new string[64];
312
  int compCount = 0;
313
  ulong current = fileRef;
314