Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-08-14 15:04:23 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-08-14 15:16:11 +0300
commit7ae3aa7b63136ea590004ae2ca765697bf0756bc (patch)
tree5331d4248429cec3c564c19be2e6e9386d2df0cd /intern
parentd2195d9ef24a0c8f9098e4791cf18468ba805dba (diff)
Cleanup: don't unnecessarily use ustring in IES file parsing
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/render/light.cpp6
-rw-r--r--intern/cycles/render/light.h4
-rw-r--r--intern/cycles/render/nodes.cpp4
-rw-r--r--intern/cycles/util/util_ies.cpp8
-rw-r--r--intern/cycles/util/util_ies.h6
5 files changed, 15 insertions, 13 deletions
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 5c3f1c35bdc..8c7a21da561 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -944,7 +944,7 @@ void LightManager::tag_update(Scene * /*scene*/)
need_update = true;
}
-int LightManager::add_ies_from_file(ustring filename)
+int LightManager::add_ies_from_file(const string &filename)
{
string content;
@@ -953,10 +953,10 @@ int LightManager::add_ies_from_file(ustring filename)
content = "\n";
}
- return add_ies(ustring(content));
+ return add_ies(content);
}
-int LightManager::add_ies(ustring content)
+int LightManager::add_ies(const string &content)
{
uint hash = hash_string(content.c_str());
diff --git a/intern/cycles/render/light.h b/intern/cycles/render/light.h
index 79450ea5f8d..6dd23374818 100644
--- a/intern/cycles/render/light.h
+++ b/intern/cycles/render/light.h
@@ -92,8 +92,8 @@ class LightManager {
~LightManager();
/* IES texture management */
- int add_ies(ustring ies);
- int add_ies_from_file(ustring filename);
+ int add_ies(const string &ies);
+ int add_ies_from_file(const string &filename);
void remove_ies(int slot);
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress);
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 1a0225e19a8..9255181b421 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -1067,10 +1067,10 @@ void IESLightNode::get_slot()
if (slot == -1) {
if (ies.empty()) {
- slot = light_manager->add_ies_from_file(filename);
+ slot = light_manager->add_ies_from_file(filename.string());
}
else {
- slot = light_manager->add_ies(ies);
+ slot = light_manager->add_ies(ies.string());
}
}
}
diff --git a/intern/cycles/util/util_ies.cpp b/intern/cycles/util/util_ies.cpp
index 7c24a4ec28c..62d3d42186d 100644
--- a/intern/cycles/util/util_ies.cpp
+++ b/intern/cycles/util/util_ies.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <algorithm>
+
#include "util/util_foreach.h"
#include "util/util_ies.h"
#include "util/util_math.h"
@@ -28,7 +30,7 @@ CCL_NAMESPACE_BEGIN
// issue.
template class GuardedAllocator<char>;
-bool IESFile::load(ustring ies)
+bool IESFile::load(const string &ies)
{
clear();
if (!parse(ies) || !process()) {
@@ -76,7 +78,7 @@ class IESTextParser {
vector<char> text;
char *data;
- IESTextParser(ustring str) : text(str.begin(), str.end())
+ IESTextParser(const string &str) : text(str.begin(), str.end())
{
std::replace(text.begin(), text.end(), ',', ' ');
data = strstr(&text[0], "\nTILT=");
@@ -116,7 +118,7 @@ class IESTextParser {
}
};
-bool IESFile::parse(ustring ies)
+bool IESFile::parse(const string &ies)
{
if (ies.empty()) {
return false;
diff --git a/intern/cycles/util/util_ies.h b/intern/cycles/util/util_ies.h
index ab1b9ea57cf..95473103614 100644
--- a/intern/cycles/util/util_ies.h
+++ b/intern/cycles/util/util_ies.h
@@ -17,7 +17,7 @@
#ifndef __UTIL_IES_H__
#define __UTIL_IES_H__
-#include "util/util_param.h"
+#include "util/util_string.h"
#include "util/util_vector.h"
CCL_NAMESPACE_BEGIN
@@ -32,11 +32,11 @@ class IESFile {
int packed_size();
void pack(float *data);
- bool load(ustring ies);
+ bool load(const string &ies);
void clear();
protected:
- bool parse(ustring ies);
+ bool parse(const string &ies);
bool process();
bool process_type_b();
bool process_type_c();