Cleanup: rename "name" to "filepath"
Missed in recent cleanup.
This commit is contained in:
parent
7ec1456b43
commit
e5e17c5a81
|
@ -888,15 +888,19 @@ bool BKE_image_render_write_exr(ReportList *reports,
|
|||
|
||||
/* Render output. */
|
||||
|
||||
static void image_render_print_save_message(ReportList *reports, const char *name, int ok, int err)
|
||||
static void image_render_print_save_message(ReportList *reports,
|
||||
const char *filepath,
|
||||
int ok,
|
||||
int err)
|
||||
{
|
||||
if (ok) {
|
||||
/* no need to report, just some helpful console info */
|
||||
printf("Saved: '%s'\n", name);
|
||||
printf("Saved: '%s'\n", filepath);
|
||||
}
|
||||
else {
|
||||
/* report on error since users will want to know what failed */
|
||||
BKE_reportf(reports, RPT_ERROR, "Render error (%s) cannot save: '%s'", strerror(err), name);
|
||||
BKE_reportf(
|
||||
reports, RPT_ERROR, "Render error (%s) cannot save: '%s'", strerror(err), filepath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -904,7 +908,7 @@ static int image_render_write_stamp_test(ReportList *reports,
|
|||
const Scene *scene,
|
||||
const RenderResult *rr,
|
||||
ImBuf *ibuf,
|
||||
const char *name,
|
||||
const char *filepath,
|
||||
const ImageFormatData *imf,
|
||||
const bool stamp)
|
||||
{
|
||||
|
@ -912,13 +916,13 @@ static int image_render_write_stamp_test(ReportList *reports,
|
|||
|
||||
if (stamp) {
|
||||
/* writes the name of the individual cameras */
|
||||
ok = BKE_imbuf_write_stamp(scene, rr, ibuf, name, imf);
|
||||
ok = BKE_imbuf_write_stamp(scene, rr, ibuf, filepath, imf);
|
||||
}
|
||||
else {
|
||||
ok = BKE_imbuf_write(ibuf, name, imf);
|
||||
ok = BKE_imbuf_write(ibuf, filepath, imf);
|
||||
}
|
||||
|
||||
image_render_print_save_message(reports, name, ok, errno);
|
||||
image_render_print_save_message(reports, filepath, ok, errno);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ static const char *path_basename(const char *path)
|
|||
/* -------------------------------------------------------------------- */
|
||||
/* Write a PNG from RGBA pixels */
|
||||
|
||||
static bool write_png(const char *name, const uint *pixels, const int width, const int height)
|
||||
static bool write_png(const char *filepath, const uint *pixels, const int width, const int height)
|
||||
{
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
|
@ -94,15 +94,15 @@ static bool write_png(const char *name, const uint *pixels, const int width, con
|
|||
const int compression = 9;
|
||||
int i;
|
||||
|
||||
fp = fopen(name, "wb");
|
||||
fp = fopen(filepath, "wb");
|
||||
if (fp == NULL) {
|
||||
printf("%s: Cannot open file for writing '%s'\n", __func__, name);
|
||||
printf("%s: Cannot open file for writing '%s'\n", __func__, filepath);
|
||||
return false;
|
||||
}
|
||||
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (png_ptr == NULL) {
|
||||
printf("%s: Cannot png_create_write_struct for file: '%s'\n", __func__, name);
|
||||
printf("%s: Cannot png_create_write_struct for file: '%s'\n", __func__, filepath);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
@ -110,14 +110,14 @@ static bool write_png(const char *name, const uint *pixels, const int width, con
|
|||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL) {
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
||||
printf("%s: Cannot png_create_info_struct for file: '%s'\n", __func__, name);
|
||||
printf("%s: Cannot png_create_info_struct for file: '%s'\n", __func__, filepath);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr))) {
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
printf("%s: Cannot setjmp for file: '%s'\n", __func__, name);
|
||||
printf("%s: Cannot setjmp for file: '%s'\n", __func__, filepath);
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ static bool write_png(const char *name, const uint *pixels, const int width, con
|
|||
/* allocate memory for an array of row-pointers */
|
||||
row_pointers = (png_bytepp)malloc(height * sizeof(png_bytep));
|
||||
if (row_pointers == NULL) {
|
||||
printf("%s: Cannot allocate row-pointers array for file '%s'\n", __func__, name);
|
||||
printf("%s: Cannot allocate row-pointers array for file '%s'\n", __func__, filepath);
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
if (fp) {
|
||||
fclose(fp);
|
||||
|
|
|
@ -256,7 +256,7 @@ struct ImBuf *imb_load_filepath_thumbnail_webp(const char *filepath,
|
|||
char colorspace[],
|
||||
size_t *r_width,
|
||||
size_t *r_height);
|
||||
bool imb_savewebp(struct ImBuf *ibuf, const char *name, int flags);
|
||||
bool imb_savewebp(struct ImBuf *ibuf, const char *filepath, int flags);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
extern "C" {
|
||||
|
||||
bool imb_save_dds(struct ImBuf *ibuf, const char *name, int /*flags*/)
|
||||
bool imb_save_dds(struct ImBuf *ibuf, const char *filepath, int /*flags*/)
|
||||
{
|
||||
return false; /* TODO: finish this function. */
|
||||
|
||||
|
@ -44,11 +44,11 @@ bool imb_save_dds(struct ImBuf *ibuf, const char *name, int /*flags*/)
|
|||
std::ofstream fildes;
|
||||
|
||||
#if defined(WIN32)
|
||||
wchar_t *wname = alloc_utf16_from_8(name, 0);
|
||||
wchar_t *wname = alloc_utf16_from_8(filepath, 0);
|
||||
fildes.open(wname);
|
||||
free(wname);
|
||||
#else
|
||||
fildes.open(name);
|
||||
fildes.open(filepath);
|
||||
#endif
|
||||
|
||||
/* write header */
|
||||
|
|
|
@ -13,7 +13,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
bool imb_is_a_dds(const unsigned char *mem, size_t size);
|
||||
bool imb_save_dds(struct ImBuf *ibuf, const char *name, int flags);
|
||||
bool imb_save_dds(struct ImBuf *ibuf, const char *filepath, int flags);
|
||||
struct ImBuf *imb_load_dds(const unsigned char *mem,
|
||||
size_t size,
|
||||
int flags,
|
||||
|
|
|
@ -715,13 +715,13 @@ static int init_jpeg(FILE *outfile, struct jpeg_compress_struct *cinfo, struct I
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool save_stdjpeg(const char *name, struct ImBuf *ibuf)
|
||||
static bool save_stdjpeg(const char *filepath, struct ImBuf *ibuf)
|
||||
{
|
||||
FILE *outfile;
|
||||
struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo;
|
||||
struct my_error_mgr jerr;
|
||||
|
||||
if ((outfile = BLI_fopen(name, "wb")) == nullptr) {
|
||||
if ((outfile = BLI_fopen(filepath, "wb")) == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -735,7 +735,7 @@ static bool save_stdjpeg(const char *name, struct ImBuf *ibuf)
|
|||
*/
|
||||
jpeg_destroy_compress(cinfo);
|
||||
fclose(outfile);
|
||||
remove(name);
|
||||
remove(filepath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -458,7 +458,7 @@ static void openexr_header_metadata_callback(void *data,
|
|||
header->insert(propname, StringAttribute(prop));
|
||||
}
|
||||
|
||||
static bool imb_save_openexr_half(ImBuf *ibuf, const char *name, const int flags)
|
||||
static bool imb_save_openexr_half(ImBuf *ibuf, const char *filepath, const int flags)
|
||||
{
|
||||
const int channels = ibuf->channels;
|
||||
const bool is_alpha = (channels >= 4) && (ibuf->planes == 32);
|
||||
|
@ -492,7 +492,7 @@ static bool imb_save_openexr_half(ImBuf *ibuf, const char *name, const int flags
|
|||
file_stream = new OMemStream(ibuf);
|
||||
}
|
||||
else {
|
||||
file_stream = new OFileStream(name);
|
||||
file_stream = new OFileStream(filepath);
|
||||
}
|
||||
OutputFile file(*file_stream, header);
|
||||
|
||||
|
@ -571,7 +571,7 @@ static bool imb_save_openexr_half(ImBuf *ibuf, const char *name, const int flags
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool imb_save_openexr_float(ImBuf *ibuf, const char *name, const int flags)
|
||||
static bool imb_save_openexr_float(ImBuf *ibuf, const char *filepath, const int flags)
|
||||
{
|
||||
const int channels = ibuf->channels;
|
||||
const bool is_alpha = (channels >= 4) && (ibuf->planes == 32);
|
||||
|
@ -604,7 +604,7 @@ static bool imb_save_openexr_float(ImBuf *ibuf, const char *name, const int flag
|
|||
file_stream = new OMemStream(ibuf);
|
||||
}
|
||||
else {
|
||||
file_stream = new OFileStream(name);
|
||||
file_stream = new OFileStream(filepath);
|
||||
}
|
||||
OutputFile file(*file_stream, header);
|
||||
|
||||
|
@ -652,7 +652,7 @@ static bool imb_save_openexr_float(ImBuf *ibuf, const char *name, const int flag
|
|||
return true;
|
||||
}
|
||||
|
||||
bool imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags)
|
||||
bool imb_save_openexr(struct ImBuf *ibuf, const char *filepath, int flags)
|
||||
{
|
||||
if (flags & IB_mem) {
|
||||
imb_addencodedbufferImBuf(ibuf);
|
||||
|
@ -660,15 +660,15 @@ bool imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags)
|
|||
}
|
||||
|
||||
if (ibuf->foptions.flag & OPENEXR_HALF) {
|
||||
return imb_save_openexr_half(ibuf, name, flags);
|
||||
return imb_save_openexr_half(ibuf, filepath, flags);
|
||||
}
|
||||
|
||||
/* when no float rect, we save as half (16 bits is sufficient) */
|
||||
if (ibuf->rect_float == nullptr) {
|
||||
return imb_save_openexr_half(ibuf, name, flags);
|
||||
return imb_save_openexr_half(ibuf, filepath, flags);
|
||||
}
|
||||
|
||||
return imb_save_openexr_float(ibuf, name, flags);
|
||||
return imb_save_openexr_float(ibuf, filepath, flags);
|
||||
}
|
||||
|
||||
/* ******* Nicer API, MultiLayer and with Tile file support ************************************ */
|
||||
|
|
|
@ -22,7 +22,7 @@ void imb_exitopenexr(void);
|
|||
*/
|
||||
bool imb_is_a_openexr(const unsigned char *mem, size_t size);
|
||||
|
||||
bool imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags);
|
||||
bool imb_save_openexr(struct ImBuf *ibuf, const char *filepath, int flags);
|
||||
|
||||
struct ImBuf *imb_load_openexr(const unsigned char *mem, size_t size, int flags, char *colorspace);
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ struct ImBuf *imb_load_filepath_thumbnail_webp(const char *filepath,
|
|||
return ibuf;
|
||||
}
|
||||
|
||||
bool imb_savewebp(struct ImBuf *ibuf, const char *name, int /*flags*/)
|
||||
bool imb_savewebp(struct ImBuf *ibuf, const char *filepath, int /*flags*/)
|
||||
{
|
||||
const int bytesperpixel = (ibuf->planes + 7) >> 3;
|
||||
uchar *encoded_data, *last_row;
|
||||
|
@ -201,15 +201,16 @@ bool imb_savewebp(struct ImBuf *ibuf, const char *name, int /*flags*/)
|
|||
}
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "WebP: Unsupported bytes per pixel: %d for file: '%s'\n", bytesperpixel, name);
|
||||
fprintf(
|
||||
stderr, "WebP: Unsupported bytes per pixel: %d for file: '%s'\n", bytesperpixel, filepath);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (encoded_data != nullptr) {
|
||||
FILE *fp = BLI_fopen(name, "wb");
|
||||
FILE *fp = BLI_fopen(filepath, "wb");
|
||||
if (!fp) {
|
||||
free(encoded_data);
|
||||
fprintf(stderr, "WebP: Cannot open file for writing: '%s'\n", name);
|
||||
fprintf(stderr, "WebP: Cannot open file for writing: '%s'\n", filepath);
|
||||
return false;
|
||||
}
|
||||
fwrite(encoded_data, encoded_data_size, 1, fp);
|
||||
|
|
|
@ -527,17 +527,17 @@ static void wm_init_userdef(Main *bmain)
|
|||
* \{ */
|
||||
|
||||
/* intended to check for non-blender formats but for now it only reads blends */
|
||||
static int wm_read_exotic(const char *name)
|
||||
static int wm_read_exotic(const char *filepath)
|
||||
{
|
||||
/* make sure we're not trying to read a directory.... */
|
||||
|
||||
int namelen = strlen(name);
|
||||
if (namelen > 0 && ELEM(name[namelen - 1], '/', '\\')) {
|
||||
int filepath_len = strlen(filepath);
|
||||
if (filepath_len > 0 && ELEM(filepath[filepath_len - 1], '/', '\\')) {
|
||||
return BKE_READ_EXOTIC_FAIL_PATH;
|
||||
}
|
||||
|
||||
/* open the file. */
|
||||
const int filedes = BLI_open(name, O_BINARY | O_RDONLY, 0);
|
||||
const int filedes = BLI_open(filepath, O_BINARY | O_RDONLY, 0);
|
||||
if (filedes == -1) {
|
||||
return BKE_READ_EXOTIC_FAIL_OPEN;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue