mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Replace some calls to fopen with File::OpenCFile (utf8).
This commit is contained in:
parent
27c71aa340
commit
3ba911bf07
8 changed files with 12 additions and 14 deletions
|
@ -791,12 +791,7 @@ IOFile::~IOFile()
|
|||
bool IOFile::Open(const std::string& filename, const char openmode[])
|
||||
{
|
||||
Close();
|
||||
#if defined(_WIN32) && defined(UNICODE)
|
||||
_wfopen_s(&m_file, ConvertUTF8ToWString(filename).c_str(), ConvertUTF8ToWString(openmode).c_str());
|
||||
#else
|
||||
m_file = fopen(filename.c_str(), openmode);
|
||||
#endif
|
||||
|
||||
m_file = File::OpenCFile(filename, openmode);
|
||||
m_good = IsOpen();
|
||||
return m_good;
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ void SymbolMap::SaveNocashSym(const char *filename) const {
|
|||
return;
|
||||
}
|
||||
|
||||
FILE* f = fopen(filename, "w");
|
||||
FILE* f = File::OpenCFile(filename, "w");
|
||||
if (f == NULL)
|
||||
return;
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ typedef int socklen_t;
|
|||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
//#include <sqlite3.h>
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HLE/proAdhocServer.h"
|
||||
|
||||
|
@ -1013,7 +1014,7 @@ void game_product_override(SceNetAdhocctlProductCode * product)
|
|||
void update_status(void)
|
||||
{
|
||||
// Open Logfile
|
||||
FILE * log = fopen(SERVER_STATUS_XMLOUT, "w");
|
||||
FILE * log = File::OpenCFile(SERVER_STATUS_XMLOUT, "w");
|
||||
|
||||
// Opened Logfile
|
||||
if(log != NULL)
|
||||
|
|
|
@ -794,7 +794,7 @@ static void __SaveDecryptedEbootToStorageMedia(const u8 *decryptedEbootDataPtr,
|
|||
}
|
||||
}
|
||||
|
||||
FILE *decryptedEbootFile = fopen(fullPath.c_str(), "wb");
|
||||
FILE *decryptedEbootFile = File::OpenCFile(fullPath, "wb");
|
||||
if (!decryptedEbootFile) {
|
||||
ERROR_LOG(SCEMODULE, "Unable to write decrypted EBOOT.");
|
||||
return;
|
||||
|
|
|
@ -236,7 +236,7 @@ bool GameManager::InstallGame(std::string zipfile, bool deleteAfter) {
|
|||
}
|
||||
|
||||
zip_file *zf = zip_fopen_index(z, i, 0);
|
||||
FILE *f = fopen(outFilename.c_str(), "wb");
|
||||
FILE *f = File::OpenCFile(outFilename.c_str(), "wb");
|
||||
if (f) {
|
||||
size_t pos = 0;
|
||||
const size_t blockSize = 1024 * 128;
|
||||
|
|
|
@ -806,7 +806,7 @@ namespace MainWindow {
|
|||
} else if (info.type == FILETYPE_DIRECTORY) {
|
||||
MessageBox(hWnd, L"Cannot extract directories.", L"Sorry", 0);
|
||||
} else if (W32Util::BrowseForFileName(false, hWnd, L"Save file as...", 0, L"All files\0*.*\0\0", L"", fn)) {
|
||||
FILE *fp = fopen(fn.c_str(), "wb");
|
||||
FILE *fp = File::OpenCFile(fn.c_str(), "wb");
|
||||
u32 handle = pspFileSystem.OpenFile(filename, FILEACCESS_READ, "");
|
||||
u8 buffer[4096];
|
||||
while (pspFileSystem.ReadFile(handle, buffer, sizeof(buffer)) > 0) {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "file/file_util.h"
|
||||
|
||||
#include "Common/ColorConv.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Core/Host.h"
|
||||
|
||||
#include "GPU/GPUState.h"
|
||||
|
@ -338,7 +339,7 @@ double CompareScreenshot(const std::vector<u32> &pixels, u32 stride, u32 w, u32
|
|||
// We assume the bitmap is the specified size, not including whatever stride.
|
||||
u32 *reference = (u32 *) calloc(stride * h, sizeof(u32));
|
||||
|
||||
FILE *bmp = fopen(screenshotFilename.c_str(), "rb");
|
||||
FILE *bmp = File::OpenCFile(screenshotFilename.c_str(), "rb");
|
||||
if (bmp)
|
||||
{
|
||||
// The bitmap header is 14 + 40 bytes. We could validate it but the test would fail either way.
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "WindowsHeadlessHost.h"
|
||||
#include "Compare.h"
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/CommonWindows.h"
|
||||
|
||||
#include "Core/CoreParameter.h"
|
||||
|
@ -116,14 +117,14 @@ void WindowsHeadlessHost::SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h)
|
|||
{
|
||||
// Lazy, just read in the original header to output the failed screenshot.
|
||||
u8 header[14 + 40] = {0};
|
||||
FILE *bmp = fopen(comparisonScreenshot.c_str(), "rb");
|
||||
FILE *bmp = File::OpenCFile(comparisonScreenshot.c_str(), "rb");
|
||||
if (bmp)
|
||||
{
|
||||
fread(&header, sizeof(header), 1, bmp);
|
||||
fclose(bmp);
|
||||
}
|
||||
|
||||
FILE *saved = fopen("__testfailure.bmp", "wb");
|
||||
FILE *saved = File::OpenCFile("__testfailure.bmp", "wb");
|
||||
if (saved)
|
||||
{
|
||||
fwrite(&header, sizeof(header), 1, saved);
|
||||
|
|
Loading…
Add table
Reference in a new issue