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>2015-10-06 11:49:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-10-06 11:49:58 +0300
commit359d1bd580c138c2b76b2afaed2a9069d5676707 (patch)
tree85d1403f1f4a08862387ff2eee9f9a917981d126 /source/blender/blenkernel
parent9f15bcb218ef32d5f15e1e13235d2d7fa667e04a (diff)
Cleanup: use BLI_path_basename
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/image.c11
-rw-r--r--source/blender/blenkernel/intern/movieclip.c11
-rw-r--r--source/blender/blenkernel/intern/sound.c11
3 files changed, 6 insertions, 27 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index c314131e246..c421c67d9e5 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -704,8 +704,7 @@ void BKE_image_alpha_mode_from_extension(Image *image)
Image *BKE_image_load(Main *bmain, const char *filepath)
{
Image *ima;
- int file, len;
- const char *libname;
+ int file;
char str[FILE_MAX];
BLI_strncpy(str, filepath, sizeof(str));
@@ -717,13 +716,7 @@ Image *BKE_image_load(Main *bmain, const char *filepath)
return NULL;
close(file);
- /* create a short library name */
- len = strlen(filepath);
-
- while (len > 0 && filepath[len - 1] != '/' && filepath[len - 1] != '\\') len--;
- libname = filepath + len;
-
- ima = image_alloc(bmain, libname, IMA_SRC_FILE, IMA_TYPE_IMAGE);
+ ima = image_alloc(bmain, BLI_path_basename(filepath), IMA_SRC_FILE, IMA_TYPE_IMAGE);
BLI_strncpy(ima->name, filepath, sizeof(ima->name));
if (BLI_testextensie_array(filepath, imb_ext_movie))
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index ed92c942b57..a23e9400b82 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -603,8 +603,7 @@ static void detect_clip_source(MovieClip *clip)
MovieClip *BKE_movieclip_file_add(Main *bmain, const char *name)
{
MovieClip *clip;
- int file, len;
- const char *libname;
+ int file;
char str[FILE_MAX];
BLI_strncpy(str, name, sizeof(str));
@@ -619,13 +618,7 @@ MovieClip *BKE_movieclip_file_add(Main *bmain, const char *name)
/* ** add new movieclip ** */
/* create a short library name */
- len = strlen(name);
-
- while (len > 0 && name[len - 1] != '/' && name[len - 1] != '\\')
- len--;
- libname = name + len;
-
- clip = movieclip_alloc(bmain, libname);
+ clip = movieclip_alloc(bmain, BLI_path_basename(name));
BLI_strncpy(clip->name, name, sizeof(clip->name));
detect_clip_source(clip);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index a800d8f3f38..7e7cc8745fd 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -74,11 +74,8 @@ static char **audio_device_names = NULL;
bSound *BKE_sound_new_file(struct Main *bmain, const char *filepath)
{
bSound *sound;
-
- char str[FILE_MAX];
const char *path;
-
- size_t len;
+ char str[FILE_MAX];
BLI_strncpy(str, filepath, sizeof(str));
@@ -86,11 +83,7 @@ bSound *BKE_sound_new_file(struct Main *bmain, const char *filepath)
BLI_path_abs(str, path);
- len = strlen(filepath);
- while (len > 0 && filepath[len - 1] != '/' && filepath[len - 1] != '\\')
- len--;
-
- sound = BKE_libblock_alloc(bmain, ID_SO, filepath + len);
+ sound = BKE_libblock_alloc(bmain, ID_SO, BLI_path_basename(filepath));
BLI_strncpy(sound->name, filepath, FILE_MAX);
/* sound->type = SOUND_TYPE_FILE; */ /* XXX unused currently */