From 0896a9e686749ee290b44c0b18339f1279290447 Mon Sep 17 00:00:00 2001 From: Maeyanie Date: Tue, 9 Sep 2025 07:55:49 -0400 Subject: [PATCH] Use boost instead of fstat. --- src/libslic3r/Format/DRC.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/Format/DRC.cpp b/src/libslic3r/Format/DRC.cpp index 88a2f3d933..b603549a91 100644 --- a/src/libslic3r/Format/DRC.cpp +++ b/src/libslic3r/Format/DRC.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include @@ -22,18 +21,15 @@ namespace Slic3r { bool load_drc(const char *path, TriangleMesh *meshptr) { - struct stat st; - if (stat(path, &st)) { - return false; - } + size_t size = boost::filesystem::file_size(path); - FILE *fp = fopen(path, "rb"); + FILE *fp = boost::nowide::fopen(path, "rb"); if (fp == nullptr) { return false; } - char *data = new char[st.st_size]; - if (fread(data, 1, st.st_size, fp) != st.st_size) { + char *data = new char[size]; + if (fread(data, 1, size, fp) != size) { fclose(fp); delete[] data; return false; @@ -41,7 +37,7 @@ bool load_drc(const char *path, TriangleMesh *meshptr) fclose(fp); DecoderBuffer buffer; - buffer.Init(data, st.st_size); + buffer.Init(data, size); auto geotype = Decoder::GetEncodedGeometryType(&buffer); if ((!geotype.ok()) || geotype.value() != TRIANGULAR_MESH) {