ITimeZoneService rewrite (#722)
* Clean up ITimeZoneService Add error codes and simplify parsing * Add accurate timezone logic TOOD: LoadTimeZoneRule and location name cmds. * Integrate the new TimeZone logic * SCREAMING_UNIX_CASE => PascalCase * Address comments * Reduce use of pointer in the LoadTimeZoneRule logic * Address comments * Realign tzIfStream logic in LoadTimeZoneRule * Address gdk's comments
This commit is contained in:
16
Ryujinx.HLE/Utilities/StreamUtils.cs
Normal file
16
Ryujinx.HLE/Utilities/StreamUtils.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System.IO;
|
||||
|
||||
namespace Ryujinx.HLE.Utilities
|
||||
{
|
||||
static class StreamUtils
|
||||
{
|
||||
public static byte[] StreamToBytes(Stream input)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
input.CopyTo(ms);
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -95,5 +95,31 @@ namespace Ryujinx.HLE.Utilities
|
||||
return Encoding.UTF8.GetString(ms.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe int CompareCStr(char* s1, char* s2)
|
||||
{
|
||||
int s1Index = 0;
|
||||
int s2Index = 0;
|
||||
|
||||
while (s1[s1Index] != 0 && s2[s2Index] != 0 && s1[s1Index] == s2[s2Index])
|
||||
{
|
||||
s1Index += 1;
|
||||
s2Index += 1;
|
||||
}
|
||||
|
||||
return s2[s2Index] - s1[s1Index];
|
||||
}
|
||||
|
||||
public static unsafe int LengthCstr(char* s)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (s[i] != '\0')
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user