mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-09 00:12:45 +01:00
Merge pull request #120 from lioncash/core-common
Fix warnings in core and common
This commit is contained in:
commit
9061cdc9c0
5 changed files with 7 additions and 17 deletions
|
@ -241,16 +241,6 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
|
||||||
void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
|
void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
/*
|
|
||||||
const int MAX_BYTES = 1024*10;
|
|
||||||
char Str[MAX_BYTES];
|
|
||||||
va_list ArgPtr;
|
|
||||||
int Cnt;
|
|
||||||
va_start(ArgPtr, Text);
|
|
||||||
Cnt = vsnprintf(Str, MAX_BYTES, Text, ArgPtr);
|
|
||||||
va_end(ArgPtr);
|
|
||||||
*/
|
|
||||||
DWORD cCharsWritten;
|
|
||||||
WORD Color;
|
WORD Color;
|
||||||
|
|
||||||
switch (Level)
|
switch (Level)
|
||||||
|
|
|
@ -763,12 +763,12 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
|
||||||
// return dir;
|
// return dir;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
bool WriteStringToFile(bool text_file, const std::string &str, const char *filename)
|
size_t WriteStringToFile(bool text_file, const std::string &str, const char *filename)
|
||||||
{
|
{
|
||||||
return FileUtil::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size());
|
return FileUtil::IOFile(filename, text_file ? "w" : "wb").WriteBytes(str.data(), str.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadFileToString(bool text_file, const char *filename, std::string &str)
|
size_t ReadFileToString(bool text_file, const char *filename, std::string &str)
|
||||||
{
|
{
|
||||||
FileUtil::IOFile file(filename, text_file ? "r" : "rb");
|
FileUtil::IOFile file(filename, text_file ? "r" : "rb");
|
||||||
auto const f = file.GetHandle();
|
auto const f = file.GetHandle();
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
|
@ -128,8 +128,8 @@ std::string GetBundleDirectory();
|
||||||
std::string &GetExeDirectory();
|
std::string &GetExeDirectory();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool WriteStringToFile(bool text_file, const std::string &str, const char *filename);
|
size_t WriteStringToFile(bool text_file, const std::string &str, const char *filename);
|
||||||
bool ReadFileToString(bool text_file, const char *filename, std::string &str);
|
size_t ReadFileToString(bool text_file, const char *filename, std::string &str);
|
||||||
|
|
||||||
// simple wrapper for cstdlib file functions to
|
// simple wrapper for cstdlib file functions to
|
||||||
// hopefully will make error checking easier
|
// hopefully will make error checking easier
|
||||||
|
|
|
@ -53,7 +53,7 @@ size_t File_SDMC::Write(const u64 offset, const u32 length, const u32 flush, con
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t File_SDMC::GetSize() const {
|
size_t File_SDMC::GetSize() const {
|
||||||
return file->GetSize();
|
return static_cast<size_t>(file->GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool File_SDMC::Close() const {
|
bool File_SDMC::Close() const {
|
||||||
|
|
|
@ -287,7 +287,7 @@ void Write64(const VAddr addr, const u64 data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteBlock(const VAddr addr, const u8* data, const size_t size) {
|
void WriteBlock(const VAddr addr, const u8* data, const size_t size) {
|
||||||
int offset = 0;
|
u32 offset = 0;
|
||||||
while (offset < (size & ~3)) {
|
while (offset < (size & ~3)) {
|
||||||
Write32(addr + offset, *(u32*)&data[offset]);
|
Write32(addr + offset, *(u32*)&data[offset]);
|
||||||
offset += 4;
|
offset += 4;
|
||||||
|
|
Loading…
Reference in a new issue