Fix build
This commit is contained in:
parent
6629d75853
commit
b950e9e575
@ -68,6 +68,8 @@ namespace PerlUtils {
|
||||
extern std::string path_to_parent_path(const char *src);
|
||||
};
|
||||
|
||||
std::string string_printf(const char *format, ...);
|
||||
|
||||
// Timestamp formatted for header_slic3r_generated().
|
||||
extern std::string timestamp_str();
|
||||
// Standard "generated by Slic3r version xxx timestamp xxx" header string,
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include <locale>
|
||||
#include <ctime>
|
||||
#include <cstdarg>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
@ -297,6 +299,25 @@ 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 timestamp_str()
|
||||
{
|
||||
const auto now = boost::posix_time::second_clock::local_time();
|
||||
|
@ -275,10 +275,7 @@ void GLGizmoBase::set_tooltip(const std::string& tooltip) const
|
||||
|
||||
std::string GLGizmoBase::format(float value, unsigned int decimals) const
|
||||
{
|
||||
size_t needed_size = std::snprintf(nullptr, 0, "%.*f", decimals, value);
|
||||
std::string res(needed_size, '\0');
|
||||
std::snprintf(&res.front(), res.size(), "%.*f", decimals, value);
|
||||
return res;
|
||||
return Slic3r::string_printf("%.*f", decimals, value);
|
||||
}
|
||||
|
||||
const float GLGizmoRotate::Offset = 5.0f;
|
||||
|
@ -232,12 +232,6 @@ ModelMaterial::attributes()
|
||||
%code{% THIS->rotate(angle, *axis); %};
|
||||
void mirror(Axis axis);
|
||||
|
||||
Model* cut(double z)
|
||||
%code%{
|
||||
RETVAL = new Model();
|
||||
THIS->cut(z, RETVAL);
|
||||
%};
|
||||
|
||||
ModelObjectPtrs* split_object()
|
||||
%code%{
|
||||
RETVAL = new ModelObjectPtrs(); // leak?
|
||||
|
Loading…
Reference in New Issue
Block a user