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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-11-11 08:14:06 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-11 08:14:06 +0300
commit99f56b4c16323f96c0cbf54e392fb509fcac5bda (patch)
tree645445ce12f3517b9daa7276beca916cfa167b69 /source/blender/imbuf
parenta5f8071bdf7893ef487c677b460793e8bef55402 (diff)
Cleanup: use 'filepath' instead of 'name' for ImBuf utilities
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/IMB_imbuf.h10
-rw-r--r--source/blender/imbuf/intern/util.c65
2 files changed, 38 insertions, 37 deletions
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index bb28c4b1234..d947f4229a0 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -473,22 +473,22 @@ bool IMB_prepare_write_ImBuf(const bool isfloat, struct ImBuf *ibuf);
*
* \attention Defined in util.c
*/
-bool IMB_ispic(const char *name);
-bool IMB_ispic_type_matches(const char *name, int filetype);
+bool IMB_ispic(const char *filepath);
+bool IMB_ispic_type_matches(const char *filepath, int filetype);
int IMB_ispic_type_from_memory(const unsigned char *mem, const size_t mem_size);
-int IMB_ispic_type(const char *name);
+int IMB_ispic_type(const char *filepath);
/**
*
* \attention Defined in util.c
*/
-bool IMB_isanim(const char *name);
+bool IMB_isanim(const char *filepath);
/**
*
* \attention Defined in util.c
*/
-int imb_get_anim_type(const char *name);
+int imb_get_anim_type(const char *filepath);
/**
*
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index ae904c5d133..73d1cadaa69 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -120,25 +120,26 @@ const char *imb_ext_audio[] = {
/* Increased from 32 to 64 because of the bitmaps header size. */
#define HEADER_SIZE 64
-static bool imb_ispic_read_header_from_filename(const char *name, unsigned char buf[HEADER_SIZE])
+static bool imb_ispic_read_header_from_filepath(const char *filepath,
+ unsigned char buf[HEADER_SIZE])
{
BLI_stat_t st;
int fp;
- BLI_assert(!BLI_path_is_rel(name));
+ BLI_assert(!BLI_path_is_rel(filepath));
if (UTIL_DEBUG) {
- printf("%s: loading %s\n", __func__, name);
+ printf("%s: loading %s\n", __func__, filepath);
}
- if (BLI_stat(name, &st) == -1) {
+ if (BLI_stat(filepath, &st) == -1) {
return false;
}
if (((st.st_mode) & S_IFMT) != S_IFREG) {
return false;
}
- if ((fp = BLI_open(name, O_BINARY | O_RDONLY, 0)) == -1) {
+ if ((fp = BLI_open(filepath, O_BINARY | O_RDONLY, 0)) == -1) {
return false;
}
@@ -177,19 +178,19 @@ int IMB_ispic_type_from_memory(const unsigned char *mem, const size_t mem_size)
return 0;
}
-int IMB_ispic_type(const char *name)
+int IMB_ispic_type(const char *filepath)
{
unsigned char buf[HEADER_SIZE];
- if (!imb_ispic_read_header_from_filename(name, buf)) {
+ if (!imb_ispic_read_header_from_filepath(filepath, buf)) {
return 0;
}
return IMB_ispic_type_from_memory(buf, HEADER_SIZE);
}
-bool IMB_ispic_type_matches(const char *name, int filetype)
+bool IMB_ispic_type_matches(const char *filepath, int filetype)
{
unsigned char buf[HEADER_SIZE];
- if (!imb_ispic_read_header_from_filename(name, buf)) {
+ if (!imb_ispic_read_header_from_filepath(filepath, buf)) {
return 0;
}
@@ -208,17 +209,17 @@ bool IMB_ispic_type_matches(const char *name, int filetype)
#undef HEADER_SIZE
-bool IMB_ispic(const char *name)
+bool IMB_ispic(const char *filepath)
{
- return (IMB_ispic_type(name) != 0);
+ return (IMB_ispic_type(filepath) != 0);
}
-static bool isavi(const char *name)
+static bool isavi(const char *filepath)
{
#ifdef WITH_AVI
- return AVI_is_avi(name);
+ return AVI_is_avi(filepath);
#else
- (void)name;
+ (void)filepath;
return false;
#endif
}
@@ -277,7 +278,7 @@ const char *IMB_ffmpeg_last_error(void)
return ffmpeg_last_error;
}
-static int isffmpeg(const char *filename)
+static int isffmpeg(const char *filepath)
{
AVFormatContext *pFormatCtx = NULL;
unsigned int i;
@@ -285,7 +286,7 @@ static int isffmpeg(const char *filename)
AVCodec *pCodec;
AVCodecContext *pCodecCtx;
- if (BLI_path_extension_check_n(filename,
+ if (BLI_path_extension_check_n(filepath,
".swf",
".jpg",
".jp2",
@@ -302,7 +303,7 @@ static int isffmpeg(const char *filename)
return 0;
}
- if (avformat_open_input(&pFormatCtx, filename, NULL, NULL) != 0) {
+ if (avformat_open_input(&pFormatCtx, filepath, NULL, NULL) != 0) {
if (UTIL_DEBUG) {
fprintf(stderr, "isffmpeg: av_open_input_file failed\n");
}
@@ -318,7 +319,7 @@ static int isffmpeg(const char *filename)
}
if (UTIL_DEBUG) {
- av_dump_format(pFormatCtx, 0, filename, 0);
+ av_dump_format(pFormatCtx, 0, filepath, 0);
}
/* Find the first video stream */
@@ -357,60 +358,60 @@ static int isffmpeg(const char *filename)
}
#endif
-int imb_get_anim_type(const char *name)
+int imb_get_anim_type(const char *filepath)
{
int type;
BLI_stat_t st;
- BLI_assert(!BLI_path_is_rel(name));
+ BLI_assert(!BLI_path_is_rel(filepath));
if (UTIL_DEBUG) {
- printf("%s: %s\n", __func__, name);
+ printf("%s: %s\n", __func__, filepath);
}
#ifndef _WIN32
# ifdef WITH_FFMPEG
/* stat test below fails on large files > 4GB */
- if (isffmpeg(name)) {
+ if (isffmpeg(filepath)) {
return ANIM_FFMPEG;
}
# endif
- if (BLI_stat(name, &st) == -1) {
+ if (BLI_stat(filepath, &st) == -1) {
return 0;
}
if (((st.st_mode) & S_IFMT) != S_IFREG) {
return 0;
}
- if (isavi(name)) {
+ if (isavi(filepath)) {
return ANIM_AVI;
}
- if (ismovie(name)) {
+ if (ismovie(filepath)) {
return ANIM_MOVIE;
}
#else
- if (BLI_stat(name, &st) == -1) {
+ if (BLI_stat(filepath, &st) == -1) {
return 0;
}
if (((st.st_mode) & S_IFMT) != S_IFREG) {
return 0;
}
- if (ismovie(name)) {
+ if (ismovie(filepath)) {
return ANIM_MOVIE;
}
# ifdef WITH_FFMPEG
- if (isffmpeg(name)) {
+ if (isffmpeg(filepath)) {
return ANIM_FFMPEG;
}
# endif
- if (isavi(name)) {
+ if (isavi(filepath)) {
return ANIM_AVI;
}
#endif
- type = IMB_ispic(name);
+ type = IMB_ispic(filepath);
if (type) {
return ANIM_SEQUENCE;
}
@@ -418,11 +419,11 @@ int imb_get_anim_type(const char *name)
return ANIM_NONE;
}
-bool IMB_isanim(const char *filename)
+bool IMB_isanim(const char *filepath)
{
int type;
- type = imb_get_anim_type(filename);
+ type = imb_get_anim_type(filepath);
return (type && type != ANIM_SEQUENCE);
}