From 4682a0882f02c50b20aa3c4bf9abe9f7ec2e834b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 24 Mar 2022 16:33:32 +1100 Subject: Cleanup: use "filepath" instead of "filename" for full paths Reserve "filename" when only the name component is used. --- source/blender/imbuf/IMB_openexr.h | 6 ++-- .../blender/imbuf/intern/openexr/openexr_api.cpp | 34 +++++++++++----------- .../blender/imbuf/intern/openexr/openexr_stub.cpp | 6 ++-- 3 files changed, 23 insertions(+), 23 deletions(-) (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/IMB_openexr.h b/source/blender/imbuf/IMB_openexr.h index a41053b99bf..32f393fc017 100644 --- a/source/blender/imbuf/IMB_openexr.h +++ b/source/blender/imbuf/IMB_openexr.h @@ -44,12 +44,12 @@ void IMB_exr_add_channel(void *handle, * Read from file. */ bool IMB_exr_begin_read( - void *handle, const char *filename, int *width, int *height, bool parse_channels); + void *handle, const char *filepath, int *width, int *height, bool parse_channels); /** * Used for output files (from #RenderResult) (single and multi-layer, single and multi-view). */ bool IMB_exr_begin_write(void *handle, - const char *filename, + const char *filepath, int width, int height, int compress, @@ -59,7 +59,7 @@ bool IMB_exr_begin_write(void *handle, * (FSA and Save Buffers). */ void IMB_exrtile_begin_write( - void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley); + void *handle, const char *filepath, int mipmap, int width, int height, int tilex, int tiley); /** * Still clumsy name handling, layers/channels can be ordered as list in list later. diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index aff9257d1f2..9948aaac5da 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -155,15 +155,15 @@ class IMemStream : public Imf::IStream { class IFileStream : public Imf::IStream { public: - IFileStream(const char *filename) : IStream(filename) + IFileStream(const char *filepath) : IStream(filepath) { /* utf-8 file path support on windows */ #if defined(WIN32) - wchar_t *wfilename = alloc_utf16_from_8(filename, 0); - ifs.open(wfilename, std::ios_base::binary); - free(wfilename); + wchar_t *wfilepath = alloc_utf16_from_8(filepath, 0); + ifs.open(wfilepath, std::ios_base::binary); + free(wfilepath); #else - ifs.open(filename, std::ios_base::binary); + ifs.open(filepath, std::ios_base::binary); #endif if (!ifs) { @@ -261,15 +261,15 @@ class OMemStream : public OStream { class OFileStream : public OStream { public: - OFileStream(const char *filename) : OStream(filename) + OFileStream(const char *filepath) : OStream(filepath) { /* utf-8 file path support on windows */ #if defined(WIN32) - wchar_t *wfilename = alloc_utf16_from_8(filename, 0); - ofs.open(wfilename, std::ios_base::binary); - free(wfilename); + wchar_t *wfilepath = alloc_utf16_from_8(filepath, 0); + ofs.open(wfilepath, std::ios_base::binary); + free(wfilepath); #else - ofs.open(filename, std::ios_base::binary); + ofs.open(filepath, std::ios_base::binary); #endif if (!ofs) { @@ -834,7 +834,7 @@ void IMB_exr_add_channel(void *handle, } bool IMB_exr_begin_write(void *handle, - const char *filename, + const char *filepath, int width, int height, int compress, @@ -872,7 +872,7 @@ bool IMB_exr_begin_write(void *handle, /* avoid crash/abort when we don't have permission to write here */ /* manually create ofstream, so we can handle utf-8 filepaths on windows */ try { - data->ofile_stream = new OFileStream(filename); + data->ofile_stream = new OFileStream(filepath); data->ofile = new OutputFile(*(data->ofile_stream), header); } catch (const std::exception &exc) { @@ -889,7 +889,7 @@ bool IMB_exr_begin_write(void *handle, } void IMB_exrtile_begin_write( - void *handle, const char *filename, int mipmap, int width, int height, int tilex, int tiley) + void *handle, const char *filepath, int mipmap, int width, int height, int tilex, int tiley) { ExrHandle *data = (ExrHandle *)handle; Header header(width, height); @@ -941,7 +941,7 @@ void IMB_exrtile_begin_write( /* avoid crash/abort when we don't have permission to write here */ /* manually create ofstream, so we can handle utf-8 filepaths on windows */ try { - data->ofile_stream = new OFileStream(filename); + data->ofile_stream = new OFileStream(filepath); data->mpofile = new MultiPartOutputFile(*(data->ofile_stream), &headers[0], headers.size()); } catch (const std::exception &) { @@ -954,19 +954,19 @@ void IMB_exrtile_begin_write( } bool IMB_exr_begin_read( - void *handle, const char *filename, int *width, int *height, const bool parse_channels) + void *handle, const char *filepath, int *width, int *height, const bool parse_channels) { ExrHandle *data = (ExrHandle *)handle; ExrChannel *echan; /* 32 is arbitrary, but zero length files crashes exr. */ - if (!(BLI_exists(filename) && BLI_file_size(filename) > 32)) { + if (!(BLI_exists(filepath) && BLI_file_size(filepath) > 32)) { return false; } /* avoid crash/abort when we don't have permission to write here */ try { - data->ifile_stream = new IFileStream(filename); + data->ifile_stream = new IFileStream(filepath); data->ifile = new MultiPartInputFile(*(data->ifile_stream)); } catch (const std::exception &) { diff --git a/source/blender/imbuf/intern/openexr/openexr_stub.cpp b/source/blender/imbuf/intern/openexr/openexr_stub.cpp index 2a655360aa5..f8f204af70c 100644 --- a/source/blender/imbuf/intern/openexr/openexr_stub.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_stub.cpp @@ -29,7 +29,7 @@ void IMB_exr_add_channel(void * /*handle*/, } bool IMB_exr_begin_read(void * /*handle*/, - const char * /*filename*/, + const char * /*filepath*/, int * /*width*/, int * /*height*/, const bool /*add_channels*/) @@ -37,7 +37,7 @@ bool IMB_exr_begin_read(void * /*handle*/, return false; } bool IMB_exr_begin_write(void * /*handle*/, - const char * /*filename*/, + const char * /*filepath*/, int /*width*/, int /*height*/, int /*compress*/, @@ -46,7 +46,7 @@ bool IMB_exr_begin_write(void * /*handle*/, return false; } void IMB_exrtile_begin_write(void * /*handle*/, - const char * /*filename*/, + const char * /*filepath*/, int /*mipmap*/, int /*width*/, int /*height*/, -- cgit v1.2.3