diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp index 12444d1a5..3c406389e 100644 --- a/xs/src/libslic3r/GCode.cpp +++ b/xs/src/libslic3r/GCode.cpp @@ -264,11 +264,14 @@ inline void write(FILE *file, const std::string &what) fwrite(what.data(), 1, what.size(), file); } +// Write a string into a file. Add a newline, if the string does not end with a newline already. +// Used to export a custom G-code section processed by the PlaceholderParser. inline void writeln(FILE *file, const std::string &what) { if (! what.empty()) { write(file, what); - fprintf(file, "\n"); + if (what.back() != '\n') + fprintf(file, "\n"); } } diff --git a/xs/src/libslic3r/PlaceholderParser.cpp b/xs/src/libslic3r/PlaceholderParser.cpp index 655913d90..fbe8572d5 100644 --- a/xs/src/libslic3r/PlaceholderParser.cpp +++ b/xs/src/libslic3r/PlaceholderParser.cpp @@ -597,16 +597,11 @@ namespace client using namespace qi::labels; qi::alpha_type alpha; qi::alnum_type alnum; - qi::eol_type eol; - qi::eoi_type eoi; qi::eps_type eps; - qi::omit_type omit; qi::raw_type raw; qi::lit_type lit; qi::lexeme_type lexeme; - qi::skip_type skip; qi::no_skip_type no_skip; - qi::uint_type uint_; qi::real_parser strict_double; spirit::ascii::char_type char_; spirit::bool_type bool_;