[Bf-blender-cvs] [d0bb2c62778] soc-2020-io-performance: Writers: use NonMovable, and NonCopyable.

Ankit Meel noreply at git.blender.org
Sun Oct 18 22:19:03 CEST 2020


Commit: d0bb2c6277869bf956683c6c34607ff89910fc68
Author: Ankit Meel
Date:   Mon Oct 19 01:42:57 2020 +0530
Branches: soc-2020-io-performance
https://developer.blender.org/rBd0bb2c6277869bf956683c6c34607ff89910fc68

Writers: use NonMovable, and NonCopyable.

===================================================================

M	source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
M	source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
M	source/blender/io/wavefront_obj/exporter/obj_exporter.hh

===================================================================

diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
index c81194c43b9..c0ef8eb3a79 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
@@ -493,8 +493,8 @@ MTLWriter::MTLWriter(const char *obj_filepath)
 MTLWriter::~MTLWriter()
 {
   if (mtl_outfile_ && fclose(mtl_outfile_)) {
-    std::cerr << "Error: could not close the MTL file properly, file may be corrupted."
-              << std::endl;
+    std::cerr << "Error: could not close the '" << mtl_file_path()
+              << "' file properly, it may be corrupted." << std::endl;
   }
 }
 
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
index 4048273cfe9..d81e21224c9 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh
@@ -46,12 +46,12 @@ struct IndexOffsets {
 /**
  * Responsible for writing a .OBJ file.
  */
-class OBJWriter {
+class OBJWriter : NonMovable, NonCopyable {
  private:
   /**
    * Destination .OBJ file.
    */
-  FILE *outfile_;
+  FILE *outfile_ = nullptr;
   const OBJExportParams &export_params_;
 
   IndexOffsets index_offsets_{0, 0, 0};
@@ -108,7 +108,7 @@ class OBJWriter {
 /**
  * Responsible for writing a .MTL file.
  */
-class MTLWriter {
+class MTLWriter : NonMovable, NonCopyable {
  private:
   char mtl_filepath_[FILE_MAX];
   FILE *mtl_outfile_;
diff --git a/source/blender/io/wavefront_obj/exporter/obj_exporter.hh b/source/blender/io/wavefront_obj/exporter/obj_exporter.hh
index 3865e97d2ad..72b9caa8f0d 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_exporter.hh
+++ b/source/blender/io/wavefront_obj/exporter/obj_exporter.hh
@@ -23,6 +23,8 @@
 
 #pragma once
 
+#include "BLI_utility_mixins.hh"
+
 #include "IO_wavefront_obj.h"
 
 namespace blender::io::obj {
@@ -30,7 +32,7 @@ namespace blender::io::obj {
  * Behaves like `std::unique_ptr<Depsgraph, custom_deleter>`.
  * Needed to free a new Depsgraph created for #DAG_EVAL_RENDER.
  */
-class OBJDepsgraph {
+class OBJDepsgraph : NonMovable, NonCopyable {
  private:
   Depsgraph *depsgraph_ = nullptr;
   bool needs_free_ = false;



More information about the Bf-blender-cvs mailing list