Avoid static var for OpenEXR

This commit is contained in:
2015-07-12 01:43:32 +10:00
parent e42e01875e
commit a6259d4290
3 changed files with 14 additions and 16 deletions

View File

@@ -40,8 +40,8 @@
// #define JP2_FILEHEADER_SIZE 14 /* UNUSED */
static char JP2_HEAD[] = {0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A};
static char J2K_HEAD[] = {0xFF, 0x4F, 0xFF, 0x51, 0x00};
static const char JP2_HEAD[] = {0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A};
static const char J2K_HEAD[] = {0xFF, 0x4F, 0xFF, 0x51, 0x00};
/* We only need this because of how the presets are set */
/* this typedef is copied from 'openjpeg-1.5.0/applications/codec/image_to_j2k.c' */

View File

@@ -255,8 +255,7 @@ static void memory_source(j_decompress_ptr cinfo, const unsigned char *buffer, s
V += GETJOCTET(*next_input_byte++); )
static boolean
handle_app1(j_decompress_ptr cinfo)
static boolean handle_app1(j_decompress_ptr cinfo)
{
INT32 length; /* initialized by the macro */
INT32 i;

View File

@@ -763,12 +763,13 @@ static void imb_exr_get_views(MultiPartInputFile& file, StringVector& views)
}
/* Multilayer Blender files have the view name in all the passes (even the default view one) */
static const char *imb_exr_insert_view_name(const char *passname, const char *viewname)
static void imb_exr_insert_view_name(char *name_full, const char *passname, const char *viewname)
{
if (viewname == NULL || viewname[0] == '\0')
return passname;
BLI_assert(!ELEM(name_full, passname, viewname));
if (viewname == NULL || viewname[0] == '\0') {
BLI_strncpy(name_full, passname, sizeof(((ExrChannel *)NULL)->name));
}
static char retstr[EXR_PASS_MAXNAME];
const char delims[] = {'.', '\0'};
const char *sep;
const char *token;
@@ -777,13 +778,11 @@ static const char *imb_exr_insert_view_name(const char *passname, const char *vi
len = BLI_str_rpartition(passname, delims, &sep, &token);
if (sep) {
BLI_snprintf(retstr, sizeof(retstr), "%.*s.%s.%s", (int)len, passname, viewname, token);
BLI_snprintf(name_full, EXR_PASS_MAXNAME, "%.*s.%s.%s", (int)len, passname, viewname, token);
}
else {
BLI_snprintf(retstr, sizeof(retstr), "%s.%s", passname, viewname);
BLI_snprintf(name_full, EXR_PASS_MAXNAME, "%s.%s", passname, viewname);
}
return retstr;
}
/* adds flattened ExrChannels */
@@ -818,8 +817,7 @@ void IMB_exr_add_channel(void *handle,
/* name has to be unique, thus it's a combination of layer, pass, view, and channel */
if (layname && layname[0] != '\0') {
std::string raw_name = imb_exr_insert_view_name(echan->m->name.c_str(), echan->m->view.c_str());
BLI_strncpy(echan->name, raw_name.c_str(), sizeof(echan->name));
imb_exr_insert_view_name(echan->name, echan->m->name.c_str(), echan->m->view.c_str());
}
else if (data->multiView->size() > 1) {
std::string raw_name = insertViewName(echan->m->name, *data->multiView, echan->view_id);
@@ -1045,8 +1043,9 @@ float *IMB_exr_channel_rect(void *handle, const char *layname, const char *pass
/* name has to be unique, thus it's a combination of layer, pass, view, and channel */
if (layname && layname[0] != '\0') {
std::string raw_name = imb_exr_insert_view_name(name, viewname);
BLI_strncpy(name, raw_name.c_str(), sizeof(name));
char temp_buf[EXR_PASS_MAXNAME];
imb_exr_insert_view_name(temp_buf, name, viewname);
BLI_strncpy(name, temp_buf, sizeof(name));
}
else if (data->multiView->size() > 1) {
size_t view_id = std::max(0, imb_exr_get_multiView_id(*data->multiView, viewname));