More fixes, some cleanup.

This commit is contained in:
Ottermandias 2022-03-17 14:03:57 +01:00
parent 581b91b337
commit e6752ade04
20 changed files with 193 additions and 361 deletions

View file

@ -49,7 +49,7 @@ public readonly struct Utf8RelPath : IEquatable< Utf8RelPath >, IComparable< Utf
return true;
}
if( !Utf8String.FromString( substring, out var ascii ) || !ascii.IsAscii )
if( !Utf8String.FromString( substring, out var ascii, true ) || !ascii.IsAscii )
{
return false;
}
@ -66,7 +66,7 @@ public readonly struct Utf8RelPath : IEquatable< Utf8RelPath >, IComparable< Utf
return false;
}
var substring = file.FullName[ baseDir.FullName.Length.. ];
var substring = file.FullName[ (baseDir.FullName.Length + 1).. ];
return FromString( substring, out path );
}
@ -78,7 +78,7 @@ public readonly struct Utf8RelPath : IEquatable< Utf8RelPath >, IComparable< Utf
return false;
}
var substring = file.FullName[ baseDir.FullName.Length.. ];
var substring = file.FullName[ (baseDir.FullName.Length + 1).. ];
return FromString( substring, out path );
}

View file

@ -97,7 +97,7 @@ public sealed unsafe partial class Utf8String : IDisposable
}
Marshal.FreeHGlobal( ( IntPtr )_path );
GC.RemoveMemoryPressure( Length );
GC.RemoveMemoryPressure( Length + 1 );
_length = AsciiCheckedFlag | AsciiFlag | AsciiLowerCheckedFlag | AsciiLowerFlag | NullTerminatedFlag;
_path = Null.NullBytePtr;
_crc32 = 0;