[Bf-blender-cvs] [c1095c7] master: Revert "Fix T47869: OpenColorIO Error with unicode path to config file under Windows"

Sergey Sharybin noreply at git.blender.org
Wed Mar 23 19:28:48 CET 2016


Commit: c1095c7a9f1c96a5bb249bed8e465e653a54a4dc
Author: Sergey Sharybin
Date:   Wed Mar 23 19:25:29 2016 +0100
Branches: master
https://developer.blender.org/rBc1095c7a9f1c96a5bb249bed8e465e653a54a4dc

Revert "Fix T47869: OpenColorIO Error with unicode path to config file under Windows"

White the config itself could be loaded this way, lookup tables can not. Additionally,
that's not really clear how to solve the issue with search path which is multi-byte
only in the API.

Reverting for further investigation.

This reverts commit ab4307aa0868f2d8389cc0dd500eff38909b08f1.

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

M	intern/opencolorio/ocio_impl.cc
M	source/blender/imbuf/intern/colormanagement.c

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

diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc
index 5c05d18..82536a7 100644
--- a/intern/opencolorio/ocio_impl.cc
+++ b/intern/opencolorio/ocio_impl.cc
@@ -25,7 +25,6 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#include <fstream>
 #include <iostream>
 #include <sstream>
 #include <string.h>
@@ -56,19 +55,6 @@ using namespace OCIO_NAMESPACE;
 #  define __func__ __FUNCTION__
 #endif
 
-#ifdef _WIN32
-#  ifndef NOGDI
-#    define NOGDI
-#  endif
-#  ifndef NOMINMAX
-#   define NOMINMAX
-#  endif
-#  ifndef WIN32_LEAN_AND_MEAN
-#    define WIN32_LEAN_AND_MEAN
-#  endif
-#  include <windows.h>
-#endif
-
 static void OCIO_reportError(const char *err)
 {
 	std::cerr << "OpenColorIO Error: " << err << std::endl;
@@ -135,26 +121,7 @@ OCIO_ConstConfigRcPtr *OCIOImpl::configCreateFromFile(const char *filename)
 	ConstConfigRcPtr *config = OBJECT_GUARDED_NEW(ConstConfigRcPtr);
 
 	try {
-#ifdef _WIN32
-		const int length_mb = strlen(filename);
-		const int length_wc = MultiByteToWideChar(CP_UTF8,
-		                                          0,
-		                                          filename,
-		                                          length_mb,
-		                                          NULL,
-		                                          0);
-		std::wstring wfilename(length_wc, 0);
-		MultiByteToWideChar(CP_UTF8,
-		                    0,
-		                    filename,
-		                    length_mb,
-		                    &wfilename[0],
-		                    length_wc);
-		std::fstream stream(wfilename);
-#else
-		std::fstream stream(filename);
-#endif
-		*config = Config::CreateFromStream(stream);
+		*config = Config::CreateFromFile(filename);
 
 		if (*config)
 			return (OCIO_ConstConfigRcPtr *) config;
@@ -655,7 +622,7 @@ void OCIOImpl::matrixTransformScale(float *m44, float *offset4, const float *sca
 
 const char *OCIOImpl::getVersionString(void)
 {
-	return OCIO_NAMESPACE::GetVersion();
+	return GetVersion();
 }
 
 int OCIOImpl::getVersionHex(void)
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index e383674..e4e93d3 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -635,7 +635,18 @@ void colormanagement_init(void)
 
 		if (configdir) {
 			BLI_join_dirfile(configfile, sizeof(configfile), configdir, BCM_CONFIG_FILE);
+
+#ifdef WIN32
+			{
+				/* quite a hack to support loading configuration from path with non-acii symbols */
+
+				char short_name[256];
+				BLI_get_short_name(short_name, configfile);
+				config = OCIO_configCreateFromFile(short_name);
+			}
+#else
 			config = OCIO_configCreateFromFile(configfile);
+#endif
 		}
 	}




More information about the Bf-blender-cvs mailing list