diff options
author | Campbell Barton <campbell@blender.org> | 2022-04-26 06:59:54 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-04-26 06:59:54 +0300 |
commit | c63a6d3057d78af778d4628e4839706a4cd8c2ea (patch) | |
tree | 6a0161ad9bb615845c360c5d327a9e2325edf6d5 /source/blender/blenkernel/intern/text.c | |
parent | 0f583d9d604f45606e238f88eb2300eb75e492bb (diff) |
Cleanup: names in text functions
- Use filepath instead of file.
- Use relbase instead of relpath.
In both cases the new names are used more frequently throughout
exiting functions.
Diffstat (limited to 'source/blender/blenkernel/intern/text.c')
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 1ab4c9614de..6cdb5791c3b 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -454,7 +454,10 @@ bool BKE_text_reload(Text *text) return true; } -Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const bool is_internal) +Text *BKE_text_load_ex(Main *bmain, + const char *filepath, + const char *relbase, + const bool is_internal) { unsigned char *buffer; size_t buffer_len; @@ -462,9 +465,9 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const char filepath_abs[FILE_MAX]; BLI_stat_t st; - BLI_strncpy(filepath_abs, file, FILE_MAX); - if (relpath) { /* Can be NULL (background mode). */ - BLI_path_abs(filepath_abs, relpath); + BLI_strncpy(filepath_abs, filepath, FILE_MAX); + if (relbase) { /* Can be NULL (background mode). */ + BLI_path_abs(filepath_abs, relbase); } buffer = BLI_file_read_text_as_mem(filepath_abs, 0, &buffer_len); @@ -484,9 +487,9 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const } if (is_internal == false) { - const size_t file_len = strlen(file); - ta->filepath = MEM_mallocN(file_len + 1, "text_name"); - memcpy(ta->filepath, file, file_len + 1); + const size_t filepath_len = strlen(filepath); + ta->filepath = MEM_mallocN(filepath_len + 1, "text_name"); + memcpy(ta->filepath, filepath, filepath_len + 1); } else { ta->flags |= TXT_ISMEM | TXT_ISDIRTY; @@ -507,9 +510,9 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const return ta; } -Text *BKE_text_load(Main *bmain, const char *file, const char *relpath) +Text *BKE_text_load(Main *bmain, const char *filepath, const char *relbase) { - return BKE_text_load_ex(bmain, file, relpath, false); + return BKE_text_load_ex(bmain, filepath, relbase, false); } void BKE_text_clear(Text *text) /* called directly from rna */ @@ -530,20 +533,20 @@ int BKE_text_file_modified_check(Text *text) { BLI_stat_t st; int result; - char file[FILE_MAX]; + char filepath[FILE_MAX]; if (!text->filepath) { return 0; } - BLI_strncpy(file, text->filepath, FILE_MAX); - BLI_path_abs(file, ID_BLEND_PATH_FROM_GLOBAL(&text->id)); + BLI_strncpy(filepath, text->filepath, FILE_MAX); + BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&text->id)); - if (!BLI_exists(file)) { + if (!BLI_exists(filepath)) { return 2; } - result = BLI_stat(file, &st); + result = BLI_stat(filepath, &st); if (result == -1) { return -1; @@ -564,20 +567,20 @@ void BKE_text_file_modified_ignore(Text *text) { BLI_stat_t st; int result; - char file[FILE_MAX]; + char filepath[FILE_MAX]; if (!text->filepath) { return; } - BLI_strncpy(file, text->filepath, FILE_MAX); - BLI_path_abs(file, ID_BLEND_PATH_FROM_GLOBAL(&text->id)); + BLI_strncpy(filepath, text->filepath, FILE_MAX); + BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&text->id)); - if (!BLI_exists(file)) { + if (!BLI_exists(filepath)) { return; } - result = BLI_stat(file, &st); + result = BLI_stat(filepath, &st); if (result == -1 || (st.st_mode & S_IFMT) != S_IFREG) { return; |