Fix T63528: Alembic export always showing error on macOS, even on success
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 25 Apr 2019 01:31:30 +0000 (03:31 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 25 Apr 2019 01:46:11 +0000 (03:46 +0200)
tellp() is not valid to check if the string stream is empty. Just get the
string directly as there is no obvious efficient method to check otherwise.

source/blender/alembic/intern/abc_util.cc
source/blender/alembic/intern/abc_util.h
source/blender/alembic/intern/alembic_capi.cc

index 380ceff80cfc000fd7d05b3ff35c1e5af09ce25e..ed3ee051a440582ade9dcfa23febeb8e35fe780c 100644 (file)
@@ -378,11 +378,6 @@ ScopeTimer::~ScopeTimer()
 
 /* ********************** */
 
-bool SimpleLogger::empty()
-{
-  return ((size_t)m_stream.tellp()) == 0ul;
-}
-
 std::string SimpleLogger::str() const
 {
   return m_stream.str();
index 44ad4bca2f7601a9bca67b027ad080fe201dfecc..f7f662212fde18ee15aa7740bfcce299bc7e4ceb 100644 (file)
@@ -209,11 +209,6 @@ class SimpleLogger {
   std::ostringstream m_stream;
 
  public:
-  /**
-   * Check whether or not the SimpleLogger's stream is empty.
-   */
-  bool empty();
-
   /**
    * Return a copy of the string contained in the SimpleLogger's stream.
    */
index aac7a7f2d82e0a23254c9a1876f283f23a04c44c..3ff3fbe2001306914f451bdfdbf856a3f6febc9c 100644 (file)
@@ -290,8 +290,9 @@ static void export_endjob(void *customdata)
     BLI_delete(data->filename, false, false);
   }
 
-  if (!data->settings.logger.empty()) {
-    std::cerr << data->settings.logger;
+  std::string log = data->settings.logger.str();
+  if (!log.empty()) {
+    std::cerr << log;
     WM_report(RPT_ERROR, "Errors occurred during the export, look in the console to know more...");
   }