Cleanup: improve code-comments, naming, use defines, correct spelling
This commit is contained in:
@@ -2010,7 +2010,7 @@ static bool lib_override_library_resync(Main *bmain,
|
||||
|
||||
id_override_new->override_library->flag = id_override_old->override_library->flag;
|
||||
|
||||
/* NOTE: Since `runtime.tag` is not copied from old to new liboverride, the potenial
|
||||
/* NOTE: Since `runtime.tag` is not copied from old to new liboverride, the potential
|
||||
* `LIBOVERRIDE_TAG_RESYNC_ISOLATED_FROM_ROOT` is kept on the old, to-be-freed
|
||||
* liboverride, and the new one is assumed to be properly part of its hierarchy again. */
|
||||
|
||||
@@ -2196,7 +2196,7 @@ static bool lib_override_library_resync(Main *bmain,
|
||||
id->tag &= ~LIB_TAG_MISSING;
|
||||
}
|
||||
else if (id->override_library->runtime != nullptr) {
|
||||
/* Cleanup of this temporary tag, since that somewhat broken liboverride is explicitely
|
||||
/* Cleanup of this temporary tag, since that somewhat broken liboverride is explicitly
|
||||
* kept for now. */
|
||||
id->override_library->runtime->tag &= ~LIBOVERRIDE_TAG_RESYNC_ISOLATED_FROM_ROOT;
|
||||
}
|
||||
|
||||
@@ -38,25 +38,22 @@ void BLI_setenv_if_new(const char *env, const char *val) ATTR_NONNULL(1);
|
||||
const char *BLI_getenv(const char *env) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* Converts `/foo/bar.txt` to `/foo/` and `bar.txt`
|
||||
*
|
||||
* - Won't change \a string.
|
||||
* - Won't create any directories.
|
||||
* - Doesn't use CWD, or deal with relative paths.
|
||||
* Copies directory and file components from `filepath` into `dir` and `file`, e.g.
|
||||
* `/foo/bar.txt` to `/foo/` and `bar.txt`
|
||||
*/
|
||||
void BLI_path_split_dir_file(const char *string,
|
||||
void BLI_path_split_dir_file(const char *filepath,
|
||||
char *dir,
|
||||
size_t dirlen,
|
||||
char *file,
|
||||
size_t filelen) ATTR_NONNULL(1, 2, 4);
|
||||
/**
|
||||
* Copies the parent directory part of string into `dir`, max length `dirlen`.
|
||||
* Copies the parent directory part of filepath into `dir`, max length `dirlen`.
|
||||
*/
|
||||
void BLI_path_split_dir_part(const char *string, char *dir, size_t dirlen) ATTR_NONNULL(1, 2);
|
||||
void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dirlen) ATTR_NONNULL(1, 2);
|
||||
/**
|
||||
* Copies the leaf filename part of string into `file`, max length `filelen`.
|
||||
* Copies the leaf filename part of filepath into `file`, max length `filelen`.
|
||||
*/
|
||||
void BLI_path_split_file_part(const char *string, char *file, size_t filelen) ATTR_NONNULL(1, 2);
|
||||
void BLI_path_split_file_part(const char *filepath, char *file, size_t filelen) ATTR_NONNULL(1, 2);
|
||||
/**
|
||||
* Returns a pointer to the last extension (e.g. the position of the last period).
|
||||
* Returns a pointer to the nil byte when no extension is found.
|
||||
|
||||
@@ -1478,43 +1478,43 @@ static size_t path_split_dir_file_offset(const char *string)
|
||||
}
|
||||
|
||||
void BLI_path_split_dir_file(
|
||||
const char *string, char *dir, const size_t dirlen, char *file, const size_t filelen)
|
||||
const char *filepath, char *dir, const size_t dirlen, char *file, const size_t filelen)
|
||||
{
|
||||
#ifdef DEBUG_STRSIZE
|
||||
memset(dir, 0xff, sizeof(*dir) * dirlen);
|
||||
memset(file, 0xff, sizeof(*file) * filelen);
|
||||
#endif
|
||||
const size_t lslash = path_split_dir_file_offset(string);
|
||||
const size_t lslash = path_split_dir_file_offset(filepath);
|
||||
if (lslash) { /* +1 to include the slash and the last char. */
|
||||
BLI_strncpy(dir, string, MIN2(dirlen, lslash + 1));
|
||||
BLI_strncpy(dir, filepath, MIN2(dirlen, lslash + 1));
|
||||
}
|
||||
else {
|
||||
dir[0] = '\0';
|
||||
}
|
||||
BLI_strncpy(file, string + lslash, filelen);
|
||||
BLI_strncpy(file, filepath + lslash, filelen);
|
||||
}
|
||||
|
||||
void BLI_path_split_dir_part(const char *string, char *dir, const size_t dirlen)
|
||||
void BLI_path_split_dir_part(const char *filepath, char *dir, const size_t dirlen)
|
||||
{
|
||||
#ifdef DEBUG_STRSIZE
|
||||
memset(dir, 0xff, sizeof(*dir) * dirlen);
|
||||
#endif
|
||||
const size_t lslash = path_split_dir_file_offset(string);
|
||||
const size_t lslash = path_split_dir_file_offset(filepath);
|
||||
if (lslash) { /* +1 to include the slash and the last char. */
|
||||
BLI_strncpy(dir, string, MIN2(dirlen, lslash + 1));
|
||||
BLI_strncpy(dir, filepath, MIN2(dirlen, lslash + 1));
|
||||
}
|
||||
else {
|
||||
dir[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
void BLI_path_split_file_part(const char *string, char *file, const size_t filelen)
|
||||
void BLI_path_split_file_part(const char *filepath, char *file, const size_t filelen)
|
||||
{
|
||||
#ifdef DEBUG_STRSIZE
|
||||
memset(file, 0xff, sizeof(*file) * filelen);
|
||||
#endif
|
||||
const size_t lslash = path_split_dir_file_offset(string);
|
||||
BLI_strncpy(file, string + lslash, filelen);
|
||||
const size_t lslash = path_split_dir_file_offset(filepath);
|
||||
BLI_strncpy(file, filepath + lslash, filelen);
|
||||
}
|
||||
|
||||
const char *BLI_path_extension_or_end(const char *filepath)
|
||||
|
||||
@@ -1283,7 +1283,7 @@ static void sequencer_add_image_strip_load_files(wmOperator *op,
|
||||
{
|
||||
const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders");
|
||||
/* size of Strip->dir. */
|
||||
char directory[768];
|
||||
char directory[FILE_MAXDIR];
|
||||
BLI_path_split_dir_part(load_data->path, directory, sizeof(directory));
|
||||
SEQ_add_image_set_directory(seq, directory);
|
||||
|
||||
|
||||
@@ -1525,7 +1525,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
||||
|
||||
/* Save proportional edit settings.
|
||||
* Skip saving proportional edit if it was not actually used.
|
||||
* Note that this value is being saved even if the operation is cancelled. This is to maintain a
|
||||
* Note that this value is being saved even if the operation is canceled. This is to maintain a
|
||||
* behavior already used by users. */
|
||||
if (!(t->options & CTX_NO_PET)) {
|
||||
if (t->flag & T_PROP_EDIT_ALL) {
|
||||
|
||||
@@ -943,7 +943,7 @@ class UVMinimumEnclosingSquareFinder {
|
||||
/**
|
||||
* Find the minimum bounding square that encloses the UVs as specified in `r_phis`.
|
||||
* If that square is smaller than `r_max_u` and `r_max_v`, then update `r_phis` accordingly.
|
||||
* \return True iff `r_phis`, `r_max_u` and `r_max_v` are modified.
|
||||
* \return True if `r_phis`, `r_max_u` and `r_max_v` are modified.
|
||||
*/
|
||||
static bool rotate_inside_square(const Span<UVAABBIsland *> island_indices,
|
||||
const Span<PackIsland *> islands,
|
||||
|
||||
Reference in New Issue
Block a user