Structural and Memory Safety Improvements, Analyzer Cleanup (ryubing/ryujinx!47)

See merge request ryubing/ryujinx!47
This commit is contained in:
MrKev
2025-06-11 17:58:27 -05:00
committed by LotP
parent d03ae9c164
commit ea027d65a7
309 changed files with 1018 additions and 1247 deletions

View File

@ -353,9 +353,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
int timeout = context.RequestData.ReadInt32();
(ulong inputBufferPosition, ulong inputBufferSize) = context.Request.GetBufferType0x21();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong outputBufferPosition, ulong outputBufferSize) = context.Request.GetBufferType0x22();
#pragma warning restore IDE0059
(ulong outputBufferPosition, _) = context.Request.GetBufferType0x22();
if (timeout < -1 || fdsCount < 0 || (ulong)(fdsCount * 8) > inputBufferSize)
{
@ -603,9 +602,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
BsdSocketFlags socketFlags = (BsdSocketFlags)context.RequestData.ReadInt32();
(ulong sendPosition, ulong sendSize) = context.Request.GetBufferType0x21(0);
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21(1);
#pragma warning restore IDE0059
(ulong bufferPosition, _) = context.Request.GetBufferType0x21(1);
ReadOnlySpan<byte> sendBuffer = context.Memory.GetSpan(sendPosition, (int)sendSize);
@ -634,9 +632,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPos, ulong bufferSize) = context.Request.GetBufferType0x22();
#pragma warning restore IDE0059
(ulong bufferPos, _) = context.Request.GetBufferType0x22();
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@ -679,9 +675,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21();
#pragma warning restore IDE0059
(ulong bufferPosition, _) = context.Request.GetBufferType0x21();
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@ -702,9 +696,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x21();
#pragma warning restore IDE0059
(ulong bufferPosition, _) = context.Request.GetBufferType0x21();
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@ -725,9 +717,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x22();
#pragma warning restore IDE0059
(ulong bufferPosition, _) = context.Request.GetBufferType0x22();
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@ -754,9 +744,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPos, ulong bufferSize) = context.Request.GetBufferType0x22();
#pragma warning restore IDE0059
(ulong bufferPos, _) = context.Request.GetBufferType0x22();
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@ -828,9 +816,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
{
int socketFd = context.RequestData.ReadInt32();
BsdIoctl cmd = (BsdIoctl)context.RequestData.ReadInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
int bufferCount = context.RequestData.ReadInt32();
#pragma warning restore IDE0059
_ = context.RequestData.ReadInt32(); // buffer count
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
@ -842,9 +829,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
case BsdIoctl.AtMark:
errno = LinuxError.SUCCESS;
#pragma warning disable IDE0059 // Remove unnecessary value assignment
(ulong bufferPosition, ulong bufferSize) = context.Request.GetBufferType0x22();
#pragma warning restore IDE0059
(ulong bufferPosition, _) = context.Request.GetBufferType0x22();
// FIXME: OOB not implemented.
context.Memory.Write(bufferPosition, 0);
@ -1036,9 +1021,8 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
public ResultCode DuplicateSocket(ServiceCtx context)
{
int fd = context.RequestData.ReadInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
ulong reserved = context.RequestData.ReadUInt64();
#pragma warning restore IDE0059
_ = context.RequestData.ReadUInt64(); // Padding, not used.
LinuxError errno = LinuxError.ENOENT;
int newSockFd = -1;
@ -1065,9 +1049,9 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
int socketFd = context.RequestData.ReadInt32();
int vlen = context.RequestData.ReadInt32();
BsdSocketFlags socketFlags = (BsdSocketFlags)context.RequestData.ReadInt32();
#pragma warning disable IDE0059 // Remove unnecessary value assignment
uint reserved = context.RequestData.ReadUInt32();
#pragma warning restore IDE0059
_ = context.RequestData.ReadUInt32(); // Padding, not used.
TimeVal timeout = context.RequestData.ReadStruct<TimeVal>();
ulong receivePosition = context.Request.ReceiveBuff[0].Position;