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>2021-03-08 06:44:57 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-03-08 06:44:57 +0300
commitb4f5128b21f1e1348defc68a96f4d4c2b1053fbe (patch)
treec7d9abb645e3d8dcbca10ea33f0e60e827ee57f9 /source/blender
parent242a278b56114d15b91ad4fa0d370a0c44e87ec3 (diff)
Cleanup: rename offs to offset
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenlib/BLI_string_utils.h2
-rw-r--r--source/blender/blenlib/intern/string_utils.c28
-rw-r--r--source/blender/blenloader/intern/readfile.c12
-rw-r--r--source/blender/blenloader/intern/readfile.h4
4 files changed, 25 insertions, 21 deletions
diff --git a/source/blender/blenlib/BLI_string_utils.h b/source/blender/blenlib/BLI_string_utils.h
index 46fb096599f..1057e71a6b2 100644
--- a/source/blender/blenlib/BLI_string_utils.h
+++ b/source/blender/blenlib/BLI_string_utils.h
@@ -90,7 +90,7 @@ bool BLI_uniquename(struct ListBase *list,
void *vlink,
const char *defname,
char delim,
- int name_offs,
+ int name_offset,
size_t len);
#ifdef __cplusplus
diff --git a/source/blender/blenlib/intern/string_utils.c b/source/blender/blenlib/intern/string_utils.c
index dbe5c96260b..c847f7e1921 100644
--- a/source/blender/blenlib/intern/string_utils.c
+++ b/source/blender/blenlib/intern/string_utils.c
@@ -339,16 +339,16 @@ bool BLI_uniquename_cb(UniquenameCheckCallback unique_check,
*
* For places where this is used, see constraint.c for example...
*
- * \param name_offs: should be calculated using offsetof(structname, membername)
- * macro from stddef.h
+ * \param name_offset: should be calculated using `offsetof(structname, membername)`
+ * macro from `stddef.h`
*/
-static bool uniquename_find_dupe(ListBase *list, void *vlink, const char *name, int name_offs)
+static bool uniquename_find_dupe(ListBase *list, void *vlink, const char *name, int name_offset)
{
Link *link;
for (link = list->first; link; link = link->next) {
if (link != vlink) {
- if (STREQ(POINTER_OFFSET((const char *)link, name_offs), name)) {
+ if (STREQ(POINTER_OFFSET((const char *)link, name_offset), name)) {
return true;
}
}
@@ -362,9 +362,9 @@ static bool uniquename_unique_check(void *arg, const char *name)
struct {
ListBase *lb;
void *vlink;
- int name_offs;
+ int name_offset;
} *data = arg;
- return uniquename_find_dupe(data->lb, data->vlink, name, data->name_offs);
+ return uniquename_find_dupe(data->lb, data->vlink, name, data->name_offset);
}
/**
@@ -375,20 +375,20 @@ static bool uniquename_unique_check(void *arg, const char *name)
* \param vlink: The block to check the name for
* \param defname: To initialize block name if latter is empty
* \param delim: Delimits numeric suffix in name
- * \param name_offs: Offset of name within block structure
+ * \param name_offset: Offset of name within block structure
* \param name_len: Maximum length of name area
*/
bool BLI_uniquename(
- ListBase *list, void *vlink, const char *defname, char delim, int name_offs, size_t name_len)
+ ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_len)
{
struct {
ListBase *lb;
void *vlink;
- int name_offs;
+ int name_offset;
} data;
data.lb = list;
data.vlink = vlink;
- data.name_offs = name_offs;
+ data.name_offset = name_offset;
BLI_assert(name_len > 1);
@@ -397,8 +397,12 @@ bool BLI_uniquename(
return false;
}
- return BLI_uniquename_cb(
- uniquename_unique_check, &data, defname, delim, POINTER_OFFSET(vlink, name_offs), name_len);
+ return BLI_uniquename_cb(uniquename_unique_check,
+ &data,
+ defname,
+ delim,
+ POINTER_OFFSET(vlink, name_offset),
+ name_len);
}
/* ------------------------------------------------------------------------- */
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 2200f7c291b..2eba9af233c 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -967,15 +967,15 @@ static BHead *blo_bhead_read_full(FileData *fd, BHead *thisblock)
/* Warning! Caller's responsibility to ensure given bhead **is** an ID one! */
const char *blo_bhead_id_name(const FileData *fd, const BHead *bhead)
{
- return (const char *)POINTER_OFFSET(bhead, sizeof(*bhead) + fd->id_name_offs);
+ return (const char *)POINTER_OFFSET(bhead, sizeof(*bhead) + fd->id_name_offset);
}
/* Warning! Caller's responsibility to ensure given bhead **is** an ID one! */
AssetMetaData *blo_bhead_id_asset_data_address(const FileData *fd, const BHead *bhead)
{
BLI_assert(BKE_idtype_idcode_is_valid(bhead->code));
- return (fd->id_asset_data_offs >= 0) ?
- *(AssetMetaData **)POINTER_OFFSET(bhead, sizeof(*bhead) + fd->id_asset_data_offs) :
+ return (fd->id_asset_data_offset >= 0) ?
+ *(AssetMetaData **)POINTER_OFFSET(bhead, sizeof(*bhead) + fd->id_asset_data_offset) :
NULL;
}
@@ -1054,9 +1054,9 @@ static bool read_file_dna(FileData *fd, const char **r_error_message)
fd->reconstruct_info = DNA_reconstruct_info_create(
fd->filesdna, fd->memsdna, fd->compflags);
/* used to retrieve ID names from (bhead+1) */
- fd->id_name_offs = DNA_elem_offset(fd->filesdna, "ID", "char", "name[]");
- BLI_assert(fd->id_name_offs != -1);
- fd->id_asset_data_offs = DNA_elem_offset(
+ fd->id_name_offset = DNA_elem_offset(fd->filesdna, "ID", "char", "name[]");
+ BLI_assert(fd->id_name_offset != -1);
+ fd->id_asset_data_offset = DNA_elem_offset(
fd->filesdna, "ID", "AssetMetaData", "*asset_data");
return true;
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index b81d8bd9a2b..7c14c7a19bf 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -110,10 +110,10 @@ typedef struct FileData {
int fileversion;
/** Used to retrieve ID names from (bhead+1). */
- int id_name_offs;
+ int id_name_offset;
/** Used to retrieve asset data from (bhead+1). NOTE: This may not be available in old files,
* will be -1 then! */
- int id_asset_data_offs;
+ int id_asset_data_offset;
/** For do_versions patching. */
int globalf, fileflags;