[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49397] branches/soc-2011-tomato/intern/ opencolorio/ocio_capi.cpp: Color management: abort execution when error happens in debug mode
Sergey Sharybin
sergey.vfx at gmail.com
Mon Jul 30 18:07:35 CEST 2012
Revision: 49397
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49397
Author: nazgul
Date: 2012-07-30 16:07:30 +0000 (Mon, 30 Jul 2012)
Log Message:
-----------
Color management: abort execution when error happens in debug mode
Modified Paths:
--------------
branches/soc-2011-tomato/intern/opencolorio/ocio_capi.cpp
Modified: branches/soc-2011-tomato/intern/opencolorio/ocio_capi.cpp
===================================================================
--- branches/soc-2011-tomato/intern/opencolorio/ocio_capi.cpp 2012-07-30 15:26:06 UTC (rev 49396)
+++ branches/soc-2011-tomato/intern/opencolorio/ocio_capi.cpp 2012-07-30 16:07:30 UTC (rev 49397)
@@ -32,6 +32,25 @@
#define OCIO_CAPI_IMPLEMENTATION
#include "ocio_capi.h"
+#ifdef NDEBUG
+# define OCIO_abort()
+#else
+# include <stdlib.h>
+# define OCIO_abort() abort()
+#endif
+
+static void OCIO_reportError(const char *err)
+{
+ std::cerr << "OpenColorIO Error: " << err << std::endl;
+
+ OCIO_abort();
+}
+
+static void OCIO_reportException(Exception &exception)
+{
+ OCIO_reportError(exception.what());
+}
+
ConstConfigRcPtr *OCIO_getCurrentConfig(void)
{
ConstConfigRcPtr *config = new ConstConfigRcPtr();
@@ -42,7 +61,7 @@
return config;
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
@@ -53,8 +72,8 @@
try {
SetCurrentConfig(*config);
}
- catch (Exception & exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ catch (Exception &exception) {
+ OCIO_reportException(exception);
}
}
@@ -69,7 +88,7 @@
return config;
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
@@ -87,7 +106,7 @@
return config;
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
@@ -104,7 +123,7 @@
return (*config)->getNumColorSpaces();
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return 0;
@@ -116,7 +135,7 @@
return (*config)->getColorSpaceNameByIndex(index);
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
@@ -133,7 +152,7 @@
return cs;
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
delete cs;
}
@@ -146,7 +165,7 @@
return (*config)->getIndexForColorSpace(name);
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return -1;
@@ -158,7 +177,7 @@
return (*config)->getDefaultDisplay();
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
@@ -170,7 +189,7 @@
return (*config)->getNumDisplays();
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return 0;
@@ -182,7 +201,7 @@
return (*config)->getDisplay(index);
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
@@ -194,7 +213,7 @@
return (*config)->getDefaultView(display);
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
@@ -206,7 +225,7 @@
return (*config)->getNumViews(display);
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return 0;
@@ -218,7 +237,7 @@
return (*config)->getView(display, index);
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
@@ -230,7 +249,7 @@
return (*config)->getDisplayColorSpaceName(display, view);
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
@@ -252,7 +271,7 @@
return p;
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return 0;
@@ -269,7 +288,7 @@
return p;
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
@@ -281,7 +300,7 @@
(*processor)->apply(*img);
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
}
@@ -364,7 +383,7 @@
return id;
}
catch (Exception &exception) {
- std::cerr << "OpenColorIO Error: " << exception.what() << std::endl;
+ OCIO_reportException(exception);
}
return NULL;
More information about the Bf-blender-cvs
mailing list