Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_labels
This commit is contained in:
commit
0937c576ac
6 changed files with 8 additions and 23 deletions
|
@ -93,8 +93,6 @@ namespace PerlUtils {
|
|||
extern std::string path_to_parent_path(const char *src);
|
||||
};
|
||||
|
||||
std::string string_printf(const char *format, ...);
|
||||
|
||||
// Standard "generated by Slic3r version xxx timestamp xxx" header string,
|
||||
// to be placed at the top of Slic3r generated files.
|
||||
std::string header_slic3r_generated();
|
||||
|
|
|
@ -231,16 +231,17 @@ static inline bool is_approx(Number value, Number test_value)
|
|||
}
|
||||
|
||||
template<class...Args>
|
||||
std::string string_printf(const char *const fmt, Args &&...args)
|
||||
std::string string_printf(const char *const _fmt, Args &&...args)
|
||||
{
|
||||
static const size_t INITIAL_LEN = 1024;
|
||||
std::vector<char> buffer(INITIAL_LEN, '\0');
|
||||
|
||||
int bufflen = snprintf(buffer.data(), INITIAL_LEN - 1, fmt, std::forward<Args>(args)...);
|
||||
auto fmt = std::string("%s") + _fmt;
|
||||
int bufflen = snprintf(buffer.data(), INITIAL_LEN - 1, fmt.c_str(), "", std::forward<Args>(args)...);
|
||||
|
||||
if (bufflen >= int(INITIAL_LEN)) {
|
||||
buffer.resize(size_t(bufflen) + 1);
|
||||
snprintf(buffer.data(), buffer.size(), fmt, std::forward<Args>(args)...);
|
||||
snprintf(buffer.data(), buffer.size(), fmt.c_str(), "", std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
return std::string(buffer.begin(), buffer.begin() + bufflen);
|
||||
|
|
|
@ -577,24 +577,6 @@ namespace PerlUtils {
|
|||
std::string path_to_parent_path(const char *src) { return boost::filesystem::path(src).parent_path().string(); }
|
||||
};
|
||||
|
||||
|
||||
std::string string_printf(const char *format, ...)
|
||||
{
|
||||
va_list args1;
|
||||
va_start(args1, format);
|
||||
va_list args2;
|
||||
va_copy(args2, args1);
|
||||
|
||||
size_t needed_size = ::vsnprintf(nullptr, 0, format, args1) + 1;
|
||||
va_end(args1);
|
||||
|
||||
std::string res(needed_size, '\0');
|
||||
::vsnprintf(&res.front(), res.size(), format, args2);
|
||||
va_end(args2);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string header_slic3r_generated()
|
||||
{
|
||||
return std::string("generated by " SLIC3R_APP_NAME " " SLIC3R_VERSION " on " ) + Utils::utc_timestamp();
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef SLIC3R_GUI_BITMAP_CACHE_HPP
|
||||
#define SLIC3R_GUI_BITMAP_CACHE_HPP
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <wx/wxprec.h>
|
||||
#ifndef WX_PRECOMP
|
||||
#include <wx/wx.h>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <wx/glcanvas.h>
|
||||
#include <wx/timer.h>
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/dataview.h>
|
||||
|
|
Loading…
Reference in a new issue