replace _WINDOWS with _WIN32

This commit is contained in:
Mathis Logemann 2021-10-21 18:22:53 +02:00
parent f2ab25cf98
commit e626ba2688
25 changed files with 44 additions and 40 deletions

View file

@ -14,7 +14,10 @@
{
"name": "default-build-dir",
"hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}"
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "debug-build",

View file

@ -25,7 +25,7 @@
// Windows DLL support
#ifdef _WINDOWS
#ifdef _WIN32
# define MAPNIK_EXP __declspec (dllexport)
# define MAPNIK_IMP __declspec (dllimport)
# ifdef MAPNIK_EXPORTS

View file

@ -30,7 +30,7 @@
#include <iomanip>
#include <ctime>
#ifdef _WINDOWS
#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#else
@ -45,7 +45,7 @@ namespace mapnik {
// Try to return the time now
inline double time_now()
{
#ifdef _WINDOWS
#ifdef _WIN32
LARGE_INTEGER t, f;
QueryPerformanceCounter(&t);
QueryPerformanceFrequency(&f);

View file

@ -42,7 +42,7 @@ public:
using data_type = std::unique_ptr<char[]>;
explicit file(std::string const& filename)
#ifdef _WINDOWS
#ifdef _WIN32
: file_(_wfopen(mapnik::utf8_to_utf16(filename).c_str(), L"rb"), std::fclose),
#else
: file_(std::fopen(filename.c_str(),"rb"), std::fclose),

View file

@ -23,7 +23,7 @@
#ifndef MAPNIK_UTIL_UTF_CONV_WIN_HPP
#define MAPNIK_UTIL_UTF_CONV_WIN_HPP
#ifdef _WINDOWS
#ifdef _WIN32
// mapnik
#include <mapnik/config.hpp>
// stl
@ -38,6 +38,6 @@ namespace mapnik
MAPNIK_DECL std::wstring utf8_to_utf16(std::string const& str);
}
#endif // _WINDOWS
#endif // _WIN32
#endif // MAPNIK_UTIL_UTF_CONV_WIN_HPP

View file

@ -136,7 +136,7 @@ csv_datasource::csv_datasource(parameters const& params)
{
throw std::runtime_error("could not create file mapping for " + filename_);
}
#elif defined (_WINDOWS)
#elif defined (_WIN32)
std::ifstream in(mapnik::utf8_to_utf16(filename_),std::ios_base::in | std::ios_base::binary);
if (!in.is_open())
{
@ -368,7 +368,7 @@ boost::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type
{
if (inline_string_.empty())
{
#if defined (_WINDOWS)
#if defined (_WIN32)
std::ifstream in(mapnik::utf8_to_utf16(filename_),std::ios_base::in | std::ios_base::binary);
#else
std::ifstream in(filename_.c_str(),std::ios_base::in | std::ios_base::binary);

View file

@ -36,7 +36,7 @@ csv_featureset::csv_featureset(std::string const& filename, locator_type const&
:
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
//
#elif defined( _WINDOWS)
#elif defined( _WIN32)
file_(_wfopen(mapnik::utf8_to_utf16(filename).c_str(), L"rb"), std::fclose),
#else
file_(std::fopen(filename.c_str(),"rb"), std::fclose),

View file

@ -49,7 +49,7 @@ csv_index_featureset::csv_index_featureset(std::string const& filename,
tr_("utf8")
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
//
#elif defined( _WINDOWS)
#elif defined( _WIN32)
,file_(_wfopen(mapnik::utf8_to_utf16(filename).c_str(), L"rb"), std::fclose)
#else
,file_(std::fopen(filename.c_str(),"rb"), std::fclose)

View file

@ -39,7 +39,7 @@ geojson_index_featureset::geojson_index_featureset(std::string const& filename,
:
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
//
#elif defined _WINDOWS
#elif defined(_WIN32)
file_(_wfopen(mapnik::utf8_to_utf16(filename).c_str(), L"rb"), std::fclose),
#else
file_(std::fopen(filename.c_str(),"rb"), std::fclose),

View file

@ -36,7 +36,7 @@
geojson_memory_index_featureset::geojson_memory_index_featureset(std::string const& filename,
array_type && index_array)
:
#ifdef _WINDOWS
#ifdef _WIN32
file_(_wfopen(mapnik::utf8_to_utf16(filename).c_str(), L"rb"), std::fclose),
#else
file_(std::fopen(filename.c_str(),"rb"), std::fclose),

View file

@ -301,7 +301,7 @@ void ogr_datasource::init(mapnik::parameters const& params)
}
index_name_ = dataset_name_.substr(0, breakpoint) + ".ogrindex";
#if defined (_WINDOWS)
#if defined (_WIN32)
std::ifstream index_file(mapnik::utf8_to_utf16(index_name_), std::ios::in | std::ios::binary);
#else
std::ifstream index_file(index_name_.c_str(), std::ios::in | std::ios::binary);

View file

@ -61,7 +61,7 @@ static inline std::string numeric2string(const char* buf)
// All digits after the first must be padded to make the field 4 characters long
if (d != 0)
{
#ifdef _WINDOWS
#ifdef _WIN32
int dig = digits[d];
if (dig < 10)
{

View file

@ -56,7 +56,7 @@ dbf_file::dbf_file(std::string const& file_name)
record_length_(0),
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
file_(),
#elif defined(_WINDOWS)
#elif defined(_WIN32)
file_(mapnik::utf8_to_utf16(file_name), std::ios::in | std::ios::binary),
#else
file_(file_name.c_str() ,std::ios::in | std::ios::binary),

View file

@ -163,7 +163,7 @@ public:
shape_file(std::string const& file_name) :
#if defined(MAPNIK_MEMORY_MAPPED_FILE)
file_()
#elif defined (_WINDOWS)
#elif defined(_WIN32)
file_(mapnik::utf8_to_utf16(file_name), std::ios::in | std::ios::binary)
#else
file_(file_name.c_str(), std::ios::in | std::ios::binary)

View file

@ -41,7 +41,7 @@ namespace util {
bool exists(std::string const& filepath)
{
#ifdef _WINDOWS
#ifdef _WIN32
return boost::filesystem::exists(mapnik::utf8_to_utf16(filepath));
#else
return boost::filesystem::exists(filepath);
@ -50,7 +50,7 @@ namespace util {
bool is_directory(std::string const& filepath)
{
#ifdef _WINDOWS
#ifdef _WIN32
return boost::filesystem::is_directory(mapnik::utf8_to_utf16(filepath));
#else
return boost::filesystem::is_directory(filepath);
@ -59,7 +59,7 @@ namespace util {
bool is_regular_file(std::string const& filepath)
{
#ifdef _WINDOWS
#ifdef _WIN32
return boost::filesystem::is_regular_file(mapnik::utf8_to_utf16(filepath));
#else
return boost::filesystem::is_regular_file(filepath);
@ -68,7 +68,7 @@ namespace util {
bool remove(std::string const& filepath)
{
#ifdef _WINDOWS
#ifdef _WIN32
return boost::filesystem::remove(mapnik::utf8_to_utf16(filepath));
#else
return boost::filesystem::remove(filepath);
@ -78,7 +78,7 @@ namespace util {
bool is_relative(std::string const& filepath)
{
#ifdef _WINDOWS
#ifdef _WIN32
boost::filesystem::path child_path(mapnik::utf8_to_utf16(filepath));
#else
boost::filesystem::path child_path(filepath);
@ -88,7 +88,7 @@ namespace util {
std::string make_relative(std::string const& filepath, std::string const& base)
{
#ifdef _WINDOWS
#ifdef _WIN32
boost::filesystem::path absolute_path(mapnik::utf8_to_utf16(base));
#else
boost::filesystem::path absolute_path(base);
@ -123,7 +123,7 @@ namespace util {
{
std::vector<std::string> listing;
boost::filesystem::directory_iterator end_itr;
#ifdef _WINDOWS
#ifdef _WIN32
std::wstring wide_dir(mapnik::utf8_to_utf16(dir));
for (boost::filesystem::directory_iterator itr(wide_dir); itr != end_itr; ++itr)
{

View file

@ -23,7 +23,7 @@
#include <mapnik/plugin.hpp>
#include <stdexcept>
#ifdef _WINDOWS
#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#define handle HMODULE
@ -54,7 +54,7 @@ PluginInfo::PluginInfo(std::string const& filename,
name_(),
module_(new mapnik_lib_t)
{
#ifdef _WINDOWS
#ifdef _WIN32
if (module_) module_->dl = LoadLibraryA(filename.c_str());
if (module_ && module_->dl)
{

View file

@ -62,7 +62,7 @@ public:
throw config_error(std::string("Could not load map file: File does not exist"), 0, filename);
}
filename_ = filename;
#ifdef _WINDOWS
#ifdef _WIN32
std::basic_ifstream<char> stream(mapnik::utf8_to_utf16(filename));
#else
std::basic_ifstream<char> stream(filename.c_str());

View file

@ -1604,7 +1604,7 @@ svg_parser::~svg_parser() {}
void svg_parser::parse(std::string const& filename)
{
#ifdef _WINDOWS
#ifdef _WIN32
std::basic_ifstream<char> stream(mapnik::utf8_to_utf16(filename));
#else
std::basic_ifstream<char> stream(filename.c_str());

View file

@ -20,7 +20,7 @@
*
*****************************************************************************/
#ifdef _WINDOWS
#ifdef _WIN32
// windows specific methods for UTF8 from/to UTF16
#include <mapnik/util/utf_conv_win.hpp>
#include <string>
@ -58,4 +58,4 @@ std::wstring utf8_to_utf16 (std::string const& str)
} // namespace mapnik
#endif // _WINDOWS
#endif // _WIN32

View file

@ -200,13 +200,13 @@ inline int create_disk_index(std::string const& filename, bool silent = true)
cmd += std::string("DYLD_LIBRARY_PATH=") + std::getenv("DYLD_LIBRARY_PATH") + " ";
}
cmd += "mapnik-index";
#ifdef _WINDOWS
#ifdef _WIN32
cmd += ".exe";
#endif
cmd += " " + filename;
if (silent)
{
#ifndef _WINDOWS
#ifndef _WIN32
cmd += " 2>/dev/null";
#else
cmd += " 2> nul";

View file

@ -50,7 +50,7 @@ bool run(std::string const& command, bool okay_to_fail = false)
// silence output unless MAPNIK_TEST_DEBUG is defined
if (std::getenv("MAPNIK_TEST_DEBUG") == nullptr)
{
#ifndef _WINDOWS
#ifndef _WIN32
cmd += " 2>/dev/null";
#else
cmd += " 2> nul";

View file

@ -75,7 +75,7 @@ int create_shapefile_index(std::string const& filename, bool index_parts, bool s
cmd += std::string("DYLD_LIBRARY_PATH=") + std::getenv("DYLD_LIBRARY_PATH") + " ";
}
cmd += "shapeindex";
#ifdef _WINDOWS
#ifdef _WIN32
cmd += ".exe";
#endif
cmd += " ";
@ -83,7 +83,7 @@ int create_shapefile_index(std::string const& filename, bool index_parts, bool s
cmd += filename;
if (silent)
{
#ifndef _WINDOWS
#ifndef _WIN32
cmd += " 2>/dev/null";
#else
cmd += " 2> nul";

View file

@ -70,7 +70,7 @@ std::pair<bool,typename T::value_type::first_type> process_csv_file(T & boxes, s
return std::make_pair(false, box_type(p.extent_));
}
#else
#if defined(_WINDOWS)
#if defined(_WIN32)
std::ifstream csv_file(mapnik::utf8_to_utf16(filename),std::ios_base::in | std::ios_base::binary);
#else
std::ifstream csv_file(filename.c_str(),std::ios_base::in | std::ios_base::binary);

View file

@ -79,7 +79,7 @@ static std::string numeric2string(const char* buf)
// All digits after the first must be padded to make the field 4 characters long
if (d != 0)
{
#ifdef _WINDOWS
#ifdef _WIN32
int dig = digits[d];
if (dig < 10)
{

View file

@ -41,7 +41,8 @@ MAPNIK_DISABLE_WARNING_POP
const int DEFAULT_DEPTH = 8;
const double DEFAULT_RATIO = 0.55;
#ifdef _WINDOWS
#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
int main ()
#else
@ -73,7 +74,7 @@ int main (int argc,char** argv)
po::positional_options_description p;
p.add("shape_files",-1);
po::variables_map vm;
#ifdef _WINDOWS
#ifdef _WIN32
std::vector<std::string> args;
const auto wargs = po::split_winmain(GetCommandLineW());
for( auto it = wargs.begin() + 1; it != wargs.end(); ++it )
@ -292,7 +293,7 @@ int main (int argc,char** argv)
if (count > 0)
{
std::clog << " number shapes=" << count << std::endl;
#ifdef _WINDOWS
#ifdef _WIN32
std::ofstream file(mapnik::utf8_to_utf16(shapename+".index").c_str(), std::ios::trunc | std::ios::binary);
#else
std::ofstream file((shapename+".index").c_str(), std::ios::trunc | std::ios::binary);