1 --- a/intern/cycles/blender/blender_python.cpp
2 +++ b/intern/cycles/blender/blender_python.cpp
3 @@ -493,7 +493,7 @@ static PyObject *osl_update_node_func(Py
4 socket_type = "NodeSocketString";
5 data_type = BL::NodeSocket::type_STRING;
6 if(param->validdefault)
7 - default_string = param->sdefault[0];
8 + default_string = param->sdefault[0].string();
12 --- a/intern/cycles/graph/node_xml.cpp
13 +++ b/intern/cycles/graph/node_xml.cpp
14 @@ -250,7 +250,7 @@ void xml_read_node(XMLReader& reader, No
19 + if(!node->name.empty())
20 reader.node_map[node->name] = node;
23 --- a/intern/cycles/render/buffers.cpp
24 +++ b/intern/cycles/render/buffers.cpp
26 #include "util/util_opengl.h"
27 #include "util/util_time.h"
28 #include "util/util_types.h"
29 +#include "util/util_unique_ptr.h"
33 @@ -453,7 +454,7 @@ void DisplayBuffer::write(Device *device
34 device->pixels_copy_from(rgba, 0, w, h);
37 - ImageOutput *out = ImageOutput::create(filename);
38 + unique_ptr<ImageOutput> out(ImageOutput::create(filename));
39 ImageSpec spec(w, h, 4, TypeDesc::UINT8);
40 int scanlinesize = w*4*sizeof(uchar);
42 @@ -467,8 +468,6 @@ void DisplayBuffer::write(Device *device
50 device_memory& DisplayBuffer::rgba_data()
51 --- a/intern/cycles/render/image.cpp
52 +++ b/intern/cycles/render/image.cpp
54 #include "util/util_path.h"
55 #include "util/util_progress.h"
56 #include "util/util_texture.h"
57 +#include "util/util_unique_ptr.h"
60 #include <OSL/oslexec.h>
61 @@ -148,7 +149,7 @@ ImageDataType ImageManager::get_image_me
62 return IMAGE_DATA_TYPE_BYTE4;
65 - ImageInput *in = ImageInput::create(filename);
66 + unique_ptr<ImageInput> in(ImageInput::create(filename));
70 @@ -193,8 +194,6 @@ ImageDataType ImageManager::get_image_me
79 @@ -449,7 +448,7 @@ void ImageManager::tag_reload_image(cons
82 bool ImageManager::file_load_image_generic(Image *img,
84 + unique_ptr<ImageInput> *in,
88 @@ -465,7 +464,7 @@ bool ImageManager::file_load_image_gener
91 /* load image from file through OIIO */
92 - *in = ImageInput::create(img->filename);
93 + *in = unique_ptr<ImageInput>(ImageInput::create(img->filename));
97 @@ -477,8 +476,6 @@ bool ImageManager::file_load_image_gener
98 config.attribute("oiio:UnassociatedAlpha", 1);
100 if(!(*in)->open(img->filename, spec, config)) {
106 @@ -500,10 +497,7 @@ bool ImageManager::file_load_image_gener
107 if(!(components >= 1 && components <= 4)) {
117 @@ -519,7 +513,7 @@ bool ImageManager::file_load_image(Image
118 device_vector<DeviceType>& tex_img)
120 const StorageType alpha_one = (FileFormat == TypeDesc::UINT8)? 255 : 1;
121 - ImageInput *in = NULL;
122 + unique_ptr<ImageInput> in = NULL;
123 int width, height, depth, components;
124 if(!file_load_image_generic(img, &in, width, height, depth, components)) {
126 @@ -575,7 +569,6 @@ bool ImageManager::file_load_image(Image
128 cmyk = strcmp(in->format_name(), "jpeg") == 0 && components == 4;
133 if(FileFormat == TypeDesc::FLOAT) {
134 --- a/intern/cycles/render/image.h
135 +++ b/intern/cycles/render/image.h
137 #include "util/util_image.h"
138 #include "util/util_string.h"
139 #include "util/util_thread.h"
140 +#include "util/util_unique_ptr.h"
141 #include "util/util_vector.h"
144 @@ -133,7 +134,7 @@ private:
147 bool file_load_image_generic(Image *img,
149 + unique_ptr<ImageInput> *in,
154 +++ b/intern/cycles/util/util_unique_ptr.h
157 + * Copyright 2011-2013 Blender Foundation
159 + * Licensed under the Apache License, Version 2.0 (the "License");
160 + * you may not use this file except in compliance with the License.
161 + * You may obtain a copy of the License at
163 + * http://www.apache.org/licenses/LICENSE-2.0
165 + * Unless required by applicable law or agreed to in writing, software
166 + * distributed under the License is distributed on an "AS IS" BASIS,
167 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
168 + * See the License for the specific language governing permissions and
169 + * limitations under the License.
172 +#ifndef __UTIL_UNIQUE_PTR_H__
173 +#define __UTIL_UNIQUE_PTR_H__
179 +using std::unique_ptr;
183 +#endif /* __UTIL_UNIQUE_PTR_H__ */
184 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
185 +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
190 +// NOTE: Keep first, BLI_path_util conflicts with OIIO's format.
192 +#include <openimageio_api.h>
193 +#include <OpenImageIO/imageio.h>
197 #include "MEM_guardedalloc.h"
198 @@ -48,12 +53,10 @@ extern "C"
199 #include "IMB_colormanagement_intern.h"
202 -#include <openimageio_api.h>
203 -#include <OpenImageIO/imageio.h>
208 +using std::unique_ptr;
210 typedef unsigned char uchar;
212 @@ -197,7 +200,6 @@ int imb_save_photoshop(struct ImBuf *ibu
214 struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspace[IM_MAX_SPACE])
216 - ImageInput *in = NULL;
217 struct ImBuf *ibuf = NULL;
218 int width, height, components;
219 bool is_float, is_alpha;
220 @@ -210,7 +212,7 @@ struct ImBuf *imb_load_photoshop(const c
222 colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE);
224 - in = ImageInput::create(filename);
225 + unique_ptr<ImageInput> in(ImageInput::create(filename));
227 std::cerr << __func__ << ": ImageInput::create() failed:" << std::endl
228 << OIIO_NAMESPACE::geterror() << std::endl;
229 @@ -223,7 +225,6 @@ struct ImBuf *imb_load_photoshop(const c
230 if (!in->open(filename, spec, config)) {
231 std::cerr << __func__ << ": ImageInput::open() failed:" << std::endl
232 << in->geterror() << std::endl;
237 @@ -249,19 +250,17 @@ struct ImBuf *imb_load_photoshop(const c
238 if (!(components >= 1 && components <= 4)) {
247 - ibuf = imb_oiio_load_image_float(in, width, height, components, flags, is_alpha);
248 + ibuf = imb_oiio_load_image_float(in.get(), width, height, components, flags, is_alpha);
250 - ibuf = imb_oiio_load_image(in, width, height, components, flags, is_alpha);
251 + ibuf = imb_oiio_load_image(in.get(), width, height, components, flags, is_alpha);