Fix for [#35116] Freestyle StringUtils::toAscii breakes non-ascii path values.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Wed, 1 May 2013 13:34:56 +0000 (13:34 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Wed, 1 May 2013 13:34:56 +0000 (13:34 +0000)
Just removed all calls of StringUtils::toAscii() as well as the function definitions.

source/blender/freestyle/intern/application/AppCanvas.cpp
source/blender/freestyle/intern/application/AppConfig.cpp
source/blender/freestyle/intern/application/Controller.cpp
source/blender/freestyle/intern/blender_interface/BlenderTextureManager.cpp
source/blender/freestyle/intern/system/StringUtils.cpp
source/blender/freestyle/intern/system/StringUtils.h

index e385eb76fbea813d5225dba9718cbe9b8c02126c..e1f300b3ce03f191fa1ba0b72c9fecc573e8e88c 100644 (file)
@@ -39,7 +39,7 @@ AppCanvas::AppCanvas()
 :Canvas()
 {
        _pViewer = 0;
-       _MapsPath = StringUtils::toAscii(Config::Path::getInstance()->getMapsDir()).c_str();
+       _MapsPath = Config::Path::getInstance()->getMapsDir().c_str();
 }
 
 AppCanvas::AppCanvas(AppView *iViewer)
index 94bda945701caf09b771e6cba9828a609c77ce3c..bf6a502c3979509a8340e7c1bdffa75650a73a17 100644 (file)
@@ -83,15 +83,14 @@ Path *Path::getInstance()
 string Path::getEnvVar(const string& iEnvVarName)
 {
        string value;
-       if (!getenv(StringUtils::toAscii(iEnvVarName).c_str())) {
-               cerr << "Warning: You may want to set the $" <<
-                       StringUtils::toAscii(iEnvVarName) <<
+       if (!getenv(iEnvVarName.c_str())) {
+               cerr << "Warning: You may want to set the $" << iEnvVarName <<
                        " environment variable to use Freestyle." << endl <<
                        "         Otherwise, the current directory will be used instead." << endl;
                value = ".";
        }
        else {
-               value = getenv(StringUtils::toAscii(iEnvVarName).c_str());
+               value = getenv(iEnvVarName.c_str());
        }
        return value;
 }
index aaa8542d63b76e94dfd0b4201d5a7bb20e357848..7303ccc95f3bb393081d55d87e93d519ba2a6466 100644 (file)
@@ -280,7 +280,7 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer *srl)
        char cleaned[FILE_MAX];
        BLI_strncpy(cleaned, iFileName, FILE_MAX);
        BLI_cleanup_file(NULL, cleaned);
-       string basename = StringUtils::toAscii(string(cleaned));
+       string basename = string(cleaned);
 #endif
 
        _ListOfModels.push_back("Blender_models");
@@ -851,7 +851,7 @@ Render *Controller::RenderStrokes(Render *re)
 void Controller::InsertStyleModule(unsigned index, const char *iFileName)
 {
        if (!BLI_testextensie(iFileName, ".py")) {
-               cerr << "Error: Cannot load \"" << StringUtils::toAscii(string(iFileName)) << "\", unknown extension" << endl;
+               cerr << "Error: Cannot load \"" << string(iFileName) << "\", unknown extension" << endl;
                return;
        }
 
@@ -1015,10 +1015,10 @@ void Controller::init_options()
        Config::Path * cpath = Config::Path::getInstance();
 
        // Directories
-       ViewMapIO::Options::setModelsPath(StringUtils::toAscii(cpath->getModelsPath()));
-       PythonInterpreter::Options::setPythonPath(StringUtils::toAscii(cpath->getPythonPath()));
-       TextureManager::Options::setPatternsPath(StringUtils::toAscii(cpath->getPatternsPath()));
-       TextureManager::Options::setBrushesPath(StringUtils::toAscii(cpath->getModelsPath()));
+       ViewMapIO::Options::setModelsPath(cpath->getModelsPath());
+       PythonInterpreter::Options::setPythonPath(cpath->getPythonPath());
+       TextureManager::Options::setPatternsPath(cpath->getPatternsPath());
+       TextureManager::Options::setBrushesPath(cpath->getModelsPath());
 
        // ViewMap Format
        ViewMapIO::Options::rmFlags(ViewMapIO::Options::FLOAT_VECTORS);
index 7b397f5eea13d7702706ab4a08f1ddb8ad208afc..e58a219aede87c49e534ec4343d5624881e97147 100644 (file)
@@ -79,13 +79,13 @@ unsigned int BlenderTextureManager::loadBrush(string sname, Stroke::MediumType m
        switch (mediumType) {
        case Stroke::DRY_MEDIUM:
                //soc prepareTextureLuminance((const char*)path.toAscii(), texId);
-               prepareTextureLuminance(StringUtils::toAscii(path), texId);
+               prepareTextureLuminance(path, texId);
                break;
        case Stroke::HUMID_MEDIUM:
        case Stroke::OPAQUE_MEDIUM:
        default:
                //soc prepareTextureAlpha((const char*)path.toAscii(), texId);
-               prepareTextureAlpha(StringUtils::toAscii(path), texId);
+               prepareTextureAlpha(path, texId);
                break;
        }
        if (G.debug & G_DEBUG_FREESTYLE) {
index 20cec90fc9f32e8428f4875f01759d58099bf1c8..28876c4031f69aaf6e0f83159f96f381493237ed 100644 (file)
@@ -54,7 +54,7 @@ void getPathName(const string& path, const string& base, vector<string>& pathnam
 
                BLI_strncpy(cleaned, dir.c_str(), FILE_MAX);
                BLI_cleanup_file(NULL, cleaned);
-               res = toAscii(string(cleaned));
+               res = string(cleaned);
 
                if (!base.empty())
                        res += Config::DIR_SEP + base;
@@ -63,24 +63,6 @@ void getPathName(const string& path, const string& base, vector<string>& pathnam
        }
 }
 
-string toAscii(const string &str)
-{
-       stringstream out("");
-       char s;
-
-       for (unsigned int i = 0; i < str.size() ; i++) {
-               s = ((char)(str.at(i) & 0x7F));
-               out << s;
-       }
-
-       return out.str();
-}
-
-const char *toAscii(const char *str)
-{
-       return toAscii(string(str)).c_str();
-}
-
 } // end of namespace StringUtils
 
 } /* namespace Freestyle */
index 983e102d43924b05d97e37e965893e8d36194fec..92600eddc42072088c31f64364720d1ab0d73d05 100644 (file)
@@ -53,8 +53,6 @@ namespace StringUtils {
 
 LIB_SYSTEM_EXPORT
 void getPathName(const string& path, const string& base, vector<string>& pathnames);
-string toAscii(const string &str);
-const char *toAscii(const char *str);
 
 // STL related
 struct ltstr