[Bf-blender-cvs] [131912d] master: Cycles: Fix compilation error with MSVC after recent C++11 changes

Sergey Sharybin noreply at git.blender.org
Mon Mar 30 12:07:11 CEST 2015


Commit: 131912dc73ddb828a9e393845e12f6d1c4f5d76b
Author: Sergey Sharybin
Date:   Mon Mar 30 15:06:20 2015 +0500
Branches: master
https://developer.blender.org/rB131912dc73ddb828a9e393845e12f6d1c4f5d76b

Cycles: Fix compilation error with MSVC after recent C++11 changes

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

M	intern/cycles/blender/blender_session.cpp
M	intern/cycles/util/util_function.h
M	intern/cycles/util/util_progress.h

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

diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index ee6ec7a..4f428bb 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -487,8 +487,8 @@ void BlenderSession::render()
 	}
 
 	/* clear callback */
-	session->write_render_tile_cb = NULL;
-	session->update_render_tile_cb = NULL;
+	session->write_render_tile_cb = function_null;
+	session->update_render_tile_cb = function_null;
 
 	/* free all memory used (host and device), so we wouldn't leave render
 	 * engine with extra memory allocated
diff --git a/intern/cycles/util/util_function.h b/intern/cycles/util/util_function.h
index 83c07ae..33e1593 100644
--- a/intern/cycles/util/util_function.h
+++ b/intern/cycles/util/util_function.h
@@ -28,6 +28,11 @@ CCL_NAMESPACE_BEGIN
 
 #if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
 #  define function_bind std::bind
+#  ifdef _MSC_VER
+#    define function_null nullptr
+#  else
+#    define function_null NULL
+#endif
 using std::function;
 using std::placeholders::_1;
 using std::placeholders::_2;
@@ -41,6 +46,7 @@ using std::placeholders::_9;
 #else
 using boost::function;
 #  define function_bind boost::bind
+#  define function_null NULL
 #endif
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/util/util_progress.h b/intern/cycles/util/util_progress.h
index 9639874..13fce65 100644
--- a/intern/cycles/util/util_progress.h
+++ b/intern/cycles/util/util_progress.h
@@ -44,12 +44,12 @@ public:
 		substatus = "";
 		sync_status = "";
 		sync_substatus = "";
-		update_cb = NULL;
+		update_cb = function_null;
 		cancel = false;
 		cancel_message = "";
 		error = false;
 		error_message = "";
-		cancel_cb = NULL;
+		cancel_cb = function_null;
 	}
 
 	Progress(Progress& progress)




More information about the Bf-blender-cvs mailing list