Use porting::fopen; porting::strerror to avaoid MSVC warnings

master
Unknown 2018-05-26 10:25:55 +02:00
parent b2501879cc
commit 012af62d42
2 changed files with 5 additions and 3 deletions

View File

@ -10,6 +10,8 @@
#include <gdfonts.h>
#include <gdfontt.h>
#include "porting.h"
PaintEngine_libgd::PaintEngine_libgd()
{
@ -83,10 +85,10 @@ void PaintEngine_libgd::drawPixel(int x, int y, const Color &color)
bool PaintEngine_libgd::save(const std::string & filename, const std::string & format, int quality)
{
FILE *out;
out = fopen(filename.c_str(), "wb");
out = porting::fopen(filename.c_str(), "wb");
if (!out) {
std::ostringstream oss;
oss << "Error opening '" << filename << "': " << std::strerror(errno);
oss << "Error opening '" << filename << "': " << porting::strerror(errno);
throw std::runtime_error(oss.str());
}
gdImagePng(image, out);

View File

@ -969,7 +969,7 @@ void Mapper::parseDataFile(TileGenerator & generator, const string & input, stri
// Check if input/../.. looks like a valid minetest directory
string minetestPath = input + PATH_SEPARATOR + ".." + PATH_SEPARATOR + "..";
string minetestConf = minetestPath + PATH_SEPARATOR + "minetest.conf";
if (FILE *file = fopen(minetestConf.c_str(), "r")) {
if (FILE *file = porting::fopen(minetestConf.c_str(), "r")) {
fclose(file);
colorPaths.push_back(minetestPath);
}