Fixing build issues with msvc2013
This commit is contained in:
parent
4f1a10c0f8
commit
0343b82534
2 changed files with 16 additions and 10 deletions
|
@ -12,11 +12,18 @@
|
||||||
//! return same string
|
//! return same string
|
||||||
#define L(s) Slic3r::I18N::translate(s)
|
#define L(s) Slic3r::I18N::translate(s)
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER <= 1800 || __cplusplus < 201103L
|
||||||
|
#define SLIC3R_NORETURN
|
||||||
|
#elif __cplusplus >= 201103L
|
||||||
|
#define SLIC3R_NORETURN [[noreturn]]
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
class Zipper::Impl {
|
class Zipper::Impl {
|
||||||
public:
|
public:
|
||||||
mz_zip_archive arch;
|
mz_zip_archive arch;
|
||||||
|
std::string m_zipname;
|
||||||
|
|
||||||
std::string get_errorstr(mz_zip_error mz_err)
|
std::string get_errorstr(mz_zip_error mz_err)
|
||||||
{
|
{
|
||||||
|
@ -93,8 +100,10 @@ public:
|
||||||
return "unknown error";
|
return "unknown error";
|
||||||
}
|
}
|
||||||
|
|
||||||
[[noreturn]] void blow_up() {
|
SLIC3R_NORETURN void blow_up() {
|
||||||
throw std::runtime_error(get_errorstr(arch.m_last_error));
|
std::string prefix(L("Error with zip archive"));
|
||||||
|
throw std::runtime_error(prefix + " " + m_zipname + ": " +
|
||||||
|
get_errorstr(arch.m_last_error) + "!");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -102,14 +111,14 @@ Zipper::Zipper(const std::string &zipfname, e_compression compression)
|
||||||
{
|
{
|
||||||
m_impl.reset(new Impl());
|
m_impl.reset(new Impl());
|
||||||
|
|
||||||
|
m_compression = compression;
|
||||||
|
m_impl->m_zipname = zipfname;
|
||||||
|
|
||||||
memset(&m_impl->arch, 0, sizeof(m_impl->arch));
|
memset(&m_impl->arch, 0, sizeof(m_impl->arch));
|
||||||
|
|
||||||
// Initialize the archive data
|
// Initialize the archive data
|
||||||
if(!mz_zip_writer_init_file(&m_impl->arch, zipfname.c_str(), 0))
|
if(!mz_zip_writer_init_file(&m_impl->arch, zipfname.c_str(), 0))
|
||||||
m_impl->blow_up();
|
m_impl->blow_up();
|
||||||
|
|
||||||
m_compression = compression;
|
|
||||||
m_zipname = zipfname;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Zipper::~Zipper()
|
Zipper::~Zipper()
|
||||||
|
@ -124,15 +133,13 @@ Zipper::Zipper(Zipper &&m):
|
||||||
m_impl(std::move(m.m_impl)),
|
m_impl(std::move(m.m_impl)),
|
||||||
m_data(std::move(m.m_data)),
|
m_data(std::move(m.m_data)),
|
||||||
m_entry(std::move(m.m_entry)),
|
m_entry(std::move(m.m_entry)),
|
||||||
m_compression(m.m_compression),
|
m_compression(m.m_compression) {}
|
||||||
m_zipname(m.m_zipname) {}
|
|
||||||
|
|
||||||
Zipper &Zipper::operator=(Zipper &&m) {
|
Zipper &Zipper::operator=(Zipper &&m) {
|
||||||
m_impl = std::move(m.m_impl);
|
m_impl = std::move(m.m_impl);
|
||||||
m_data = std::move(m.m_data);
|
m_data = std::move(m.m_data);
|
||||||
m_entry = std::move(m.m_entry);
|
m_entry = std::move(m.m_entry);
|
||||||
m_compression = m.m_compression;
|
m_compression = m.m_compression;
|
||||||
m_zipname = std::move(m.m_zipname);
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +171,7 @@ void Zipper::finish_entry()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Zipper::get_name() const {
|
std::string Zipper::get_name() const {
|
||||||
return boost::filesystem::path(m_zipname).stem().string();
|
return boost::filesystem::path(m_impl->m_zipname).stem().string();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ private:
|
||||||
std::string m_data;
|
std::string m_data;
|
||||||
std::string m_entry;
|
std::string m_entry;
|
||||||
e_compression m_compression;
|
e_compression m_compression;
|
||||||
std::string m_zipname;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue