Use porting::fopen; porting::strerror to avaoid MSVC warnings
This commit is contained in:
parent
b2501879cc
commit
012af62d42
@ -10,6 +10,8 @@
|
|||||||
#include <gdfonts.h>
|
#include <gdfonts.h>
|
||||||
#include <gdfontt.h>
|
#include <gdfontt.h>
|
||||||
|
|
||||||
|
#include "porting.h"
|
||||||
|
|
||||||
|
|
||||||
PaintEngine_libgd::PaintEngine_libgd()
|
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)
|
bool PaintEngine_libgd::save(const std::string & filename, const std::string & format, int quality)
|
||||||
{
|
{
|
||||||
FILE *out;
|
FILE *out;
|
||||||
out = fopen(filename.c_str(), "wb");
|
out = porting::fopen(filename.c_str(), "wb");
|
||||||
if (!out) {
|
if (!out) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Error opening '" << filename << "': " << std::strerror(errno);
|
oss << "Error opening '" << filename << "': " << porting::strerror(errno);
|
||||||
throw std::runtime_error(oss.str());
|
throw std::runtime_error(oss.str());
|
||||||
}
|
}
|
||||||
gdImagePng(image, out);
|
gdImagePng(image, out);
|
||||||
|
@ -969,7 +969,7 @@ void Mapper::parseDataFile(TileGenerator & generator, const string & input, stri
|
|||||||
// Check if input/../.. looks like a valid minetest directory
|
// Check if input/../.. looks like a valid minetest directory
|
||||||
string minetestPath = input + PATH_SEPARATOR + ".." + PATH_SEPARATOR + "..";
|
string minetestPath = input + PATH_SEPARATOR + ".." + PATH_SEPARATOR + "..";
|
||||||
string minetestConf = minetestPath + PATH_SEPARATOR + "minetest.conf";
|
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);
|
fclose(file);
|
||||||
colorPaths.push_back(minetestPath);
|
colorPaths.push_back(minetestPath);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user