mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Misc code accuracy fixes
This commit is contained in:
parent
a2c64797a9
commit
4e23465982
3 changed files with 10 additions and 6 deletions
|
@ -155,7 +155,7 @@ public static class PathFormatter
|
|||
|
||||
currentPath = path.Slice(1);
|
||||
}
|
||||
else if (path.Length != 0 && WindowsPath.IsWindowsDrive(path.Slice(1)))
|
||||
else if (WindowsPath.IsWindowsDrive(path.Slice(1)))
|
||||
{
|
||||
if (normalizeBuffer.Length == 0)
|
||||
return ResultFs.NotNormalized.Log();
|
||||
|
@ -356,8 +356,12 @@ public static class PathFormatter
|
|||
if (path.At(0) == Dot && (path.At(1) == NullTerminator || path.At(1) == DirectorySeparator ||
|
||||
path.At(1) == AltDirectorySeparator))
|
||||
{
|
||||
if (relativePathBuffer.Length >= 2)
|
||||
if (relativePathBuffer.Length != 0)
|
||||
{
|
||||
// Note: Nintendo doesn't check if the buffer is long enough here
|
||||
if (relativePathBuffer.Length < 2)
|
||||
return ResultFs.TooLongPath.Log();
|
||||
|
||||
relativePathBuffer[0] = Dot;
|
||||
relativePathBuffer[1] = NullTerminator;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class FileInterfaceAdapter : IFileSf
|
|||
if (offset < 0)
|
||||
return ResultFs.InvalidOffset.Log();
|
||||
|
||||
if (destination.Size < 0)
|
||||
if (size < 0)
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
if (destination.Size < (int)size)
|
||||
|
@ -78,7 +78,7 @@ public class FileInterfaceAdapter : IFileSf
|
|||
if (offset < 0)
|
||||
return ResultFs.InvalidOffset.Log();
|
||||
|
||||
if (source.Size < 0)
|
||||
if (size < 0)
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
if (source.Size < (int)size)
|
||||
|
|
|
@ -33,7 +33,7 @@ public class StorageInterfaceAdapter : IStorageSf
|
|||
if (offset < 0)
|
||||
return ResultFs.InvalidOffset.Log();
|
||||
|
||||
if (destination.Size < 0)
|
||||
if (size < 0)
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
if (destination.Size < size)
|
||||
|
@ -58,7 +58,7 @@ public class StorageInterfaceAdapter : IStorageSf
|
|||
if (offset < 0)
|
||||
return ResultFs.InvalidOffset.Log();
|
||||
|
||||
if (source.Size < 0)
|
||||
if (size < 0)
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
if (source.Size < size)
|
||||
|
|
Loading…
Reference in a new issue