Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVojtech Bubnik <bubnikv@gmail.com>2022-01-06 18:41:54 +0300
committerYuSanka <yusanka@gmail.com>2022-01-17 14:29:46 +0300
commitd4fd95bd4aa4db5265a4dc5bb3ff849e9af88fbb (patch)
treeb432fdf5b575454f1a1048e86b6de54f0d818036 /src/libslic3r/GCode.cpp
parentadd1e994fac2c7446d813fe158dda16e34c7097a (diff)
WIP: G-code find & replace: Support for non-regular expression,
whole word and case insensitive search.
Diffstat (limited to 'src/libslic3r/GCode.cpp')
-rw-r--r--src/libslic3r/GCode.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp
index cb0ffc01d..d79e8177f 100644
--- a/src/libslic3r/GCode.cpp
+++ b/src/libslic3r/GCode.cpp
@@ -2849,14 +2849,11 @@ void GCode::GCodeOutputStream::close()
void GCode::GCodeOutputStream::write(const char *what)
{
if (what != nullptr) {
- const char* gcode = what;
- // writes string to file
- fwrite(gcode, 1, ::strlen(gcode), this->f);
//FIXME don't allocate a string, maybe process a batch of lines?
- if (m_find_replace)
- m_processor.process_buffer(m_find_replace->process_layer(std::string(gcode)));
- else
- m_processor.process_buffer(std::string(gcode));
+ std::string gcode(m_find_replace ? m_find_replace->process_layer(what) : what);
+ // writes string to file
+ fwrite(gcode.c_str(), 1, gcode.size(), this->f);
+ m_processor.process_buffer(gcode);
}
}