[Bf-blender-cvs] [536c3b6578f] master: Cleanup: rename readfile API functions
Campbell Barton
noreply at git.blender.org
Fri Feb 22 00:34:52 CET 2019
Commit: 536c3b6578fbe403bd34827066c23d777d92e22b
Author: Campbell Barton
Date: Fri Feb 22 10:31:17 2019 +1100
Branches: master
https://developer.blender.org/rB536c3b6578fbe403bd34827066c23d777d92e22b
Cleanup: rename readfile API functions
- blo_bhead_first (was blo_firstbhead)
- blo_bhead_next (was blo_nextbhead)
- blo_bhead_prev (was blo_prevbhead)
- blo_bhead_id_name (was bhead_id_name)
- blo_filedata_free (was blo_freefiledata)
- blo_filedata_from_file (was blo_openblenderfile)
- blo_filedata_from_memory (was blo_openblendermemory)
- blo_filedata_from_memfile (was blo_openblendermemory)
===================================================================
M source/blender/blenloader/intern/readblenentry.c
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/readfile.h
===================================================================
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 2916308df32..e343c421a39 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -73,7 +73,7 @@ BlendHandle *BLO_blendhandle_from_file(const char *filepath, ReportList *reports
{
BlendHandle *bh;
- bh = (BlendHandle *)blo_openblenderfile(filepath, reports);
+ bh = (BlendHandle *)blo_filedata_from_file(filepath, reports);
return bh;
}
@@ -89,7 +89,7 @@ BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize)
{
BlendHandle *bh;
- bh = (BlendHandle *)blo_openblendermemory(mem, memsize, NULL);
+ bh = (BlendHandle *)blo_filedata_from_memory(mem, memsize, NULL);
return bh;
}
@@ -100,7 +100,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
BHead *bhead;
fprintf(fp, "[\n");
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == ENDB)
break;
else {
@@ -139,9 +139,9 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
BHead *bhead;
int tot = 0;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == ofblocktype) {
- const char *idname = bhead_id_name(fd, bhead);
+ const char *idname = blo_bhead_id_name(fd, bhead);
BLI_linklist_prepend(&names, strdup(idname + 2));
tot++;
@@ -172,9 +172,9 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
PreviewImage *new_prv = NULL;
int tot = 0;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == ofblocktype) {
- const char *idname = bhead_id_name(fd, bhead);
+ const char *idname = blo_bhead_id_name(fd, bhead);
switch (GS(idname)) {
case ID_MA: /* fall through */
case ID_TE: /* fall through */
@@ -203,7 +203,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
uint *rect = NULL;
size_t len = new_prv->w[0] * new_prv->h[0] * sizeof(uint);
new_prv->rect[0] = MEM_callocN(len, __func__);
- bhead = blo_nextbhead(fd, bhead);
+ bhead = blo_bhead_next(fd, bhead);
rect = (uint *)(bhead + 1);
BLI_assert(len == bhead->len);
memcpy(new_prv->rect[0], rect, len);
@@ -220,7 +220,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
uint *rect = NULL;
size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(uint);
new_prv->rect[1] = MEM_callocN(len, __func__);
- bhead = blo_nextbhead(fd, bhead);
+ bhead = blo_bhead_next(fd, bhead);
rect = (uint *)(bhead + 1);
BLI_assert(len == bhead->len);
memcpy(new_prv->rect[1], rect, len);
@@ -265,7 +265,7 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
LinkNode *names = NULL;
BHead *bhead;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == ENDB) {
break;
}
@@ -294,7 +294,7 @@ void BLO_blendhandle_close(BlendHandle *bh)
{
FileData *fd = (FileData *)bh;
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
}
/**********/
@@ -315,12 +315,12 @@ BlendFileData *BLO_read_from_file(
BlendFileData *bfd = NULL;
FileData *fd;
- fd = blo_openblenderfile(filepath, reports);
+ fd = blo_filedata_from_file(filepath, reports);
if (fd) {
fd->reports = reports;
fd->skip_flags = skip_flags;
bfd = blo_read_file_internal(fd, filepath);
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
}
return bfd;
@@ -343,12 +343,12 @@ BlendFileData *BLO_read_from_memory(
BlendFileData *bfd = NULL;
FileData *fd;
- fd = blo_openblendermemory(mem, memsize, reports);
+ fd = blo_filedata_from_memory(mem, memsize, reports);
if (fd) {
fd->reports = reports;
fd->skip_flags = skip_flags;
bfd = blo_read_file_internal(fd, "");
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
}
return bfd;
@@ -450,7 +450,7 @@ BlendFileData *BLO_read_from_memfile(
* will be cleared together with oldmain... */
blo_join_main(&old_mainlist);
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
}
return bfd;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 82dc9ce7a7e..208c4e7e300 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -554,7 +554,7 @@ static void read_file_version(FileData *fd, Main *main)
{
BHead *bhead;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == GLOB) {
FileGlobal *fg = read_struct(fd, bhead, "Global");
if (fg) {
@@ -583,7 +583,7 @@ static void read_file_bhead_idname_map_create(FileData *fd)
int code_prev = ENDB;
uint reserve = 0;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (code_prev != bhead->code) {
code_prev = bhead->code;
is_link = BKE_idcode_is_valid(code_prev) ? BKE_idcode_is_linkable(code_prev) : false;
@@ -598,14 +598,14 @@ static void read_file_bhead_idname_map_create(FileData *fd)
fd->bhead_idname_hash = BLI_ghash_str_new_ex(__func__, reserve);
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (code_prev != bhead->code) {
code_prev = bhead->code;
is_link = BKE_idcode_is_valid(code_prev) ? BKE_idcode_is_linkable(code_prev) : false;
}
if (is_link) {
- BLI_ghash_insert(fd->bhead_idname_hash, (void *)bhead_id_name(fd, bhead), bhead);
+ BLI_ghash_insert(fd->bhead_idname_hash, (void *)blo_bhead_id_name(fd, bhead), bhead);
}
}
}
@@ -826,7 +826,7 @@ static BHeadN *get_bhead(FileData *fd)
return new_bhead;
}
-BHead *blo_firstbhead(FileData *fd)
+BHead *blo_bhead_first(FileData *fd)
{
BHeadN *new_bhead;
BHead *bhead = NULL;
@@ -846,7 +846,7 @@ BHead *blo_firstbhead(FileData *fd)
return bhead;
}
-BHead *blo_prevbhead(FileData *UNUSED(fd), BHead *thisblock)
+BHead *blo_bhead_prev(FileData *UNUSED(fd), BHead *thisblock)
{
BHeadN *bheadn = (BHeadN *)POINTER_OFFSET(thisblock, -offsetof(BHeadN, bhead));
BHeadN *prev = bheadn->prev;
@@ -854,7 +854,7 @@ BHead *blo_prevbhead(FileData *UNUSED(fd), BHead *thisblock)
return (prev) ? &prev->bhead : NULL;
}
-BHead *blo_nextbhead(FileData *fd, BHead *thisblock)
+BHead *blo_bhead_next(FileData *fd, BHead *thisblock)
{
BHeadN *new_bhead = NULL;
BHead *bhead = NULL;
@@ -881,7 +881,7 @@ BHead *blo_nextbhead(FileData *fd, BHead *thisblock)
}
/* Warning! Caller's responsibility to ensure given bhead **is** and ID one! */
-const char *bhead_id_name(const FileData *fd, const BHead *bhead)
+const char *blo_bhead_id_name(const FileData *fd, const BHead *bhead)
{
return (const char *)POINTER_OFFSET(bhead, sizeof(*bhead) + fd->id_name_offs);
}
@@ -937,7 +937,7 @@ static bool read_file_dna(FileData *fd, const char **r_error_message)
BHead *bhead;
int subversion = 0;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == GLOB) {
/* Before this, the subversion didn't exist in 'FileGlobal' so the subversion
* value isn't accessible for the purpose of DNA versioning in this case. */
@@ -983,7 +983,7 @@ static int *read_file_thumbnail(FileData *fd)
BHead *bhead;
int *blend_thumb = NULL;
- for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) {
+ for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) {
if (bhead->code == TEST) {
const bool do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) != 0;
int *data = (int *)(bhead + 1);
@@ -1129,13 +1129,13 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports)
BKE_reportf(reports, RPT_ERROR,
"Failed to read blend file '%s': %s",
fd->relabase, error_message);
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
fd = NULL;
}
}
else {
BKE_reportf(reports, RPT_ERROR, "Failed to read blend file '%s', not a blend file", fd->relabase);
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
fd = NULL;
}
@@ -1144,7 +1144,7 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports)
/* cannot be called with relative paths anymore! */
/* on each new library added, it now checks for the current FileData and expands relativeness */
-FileData *blo_openblenderfile(const char *filepath, ReportList *reports)
+FileData *blo_filedata_from_file(const char *filepath, ReportList *reports)
{
gzFile gzfile;
errno = 0;
@@ -1168,10 +1168,10 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports)
}
/**
- * Same as blo_openblenderfile(), but does not reads DNA data, only header. Use it for light access
+ * Same as blo_filedata_from_file(), but does not reads DNA data, only header. Use it for light access
* (e.g. thumbnail reading).
*/
-static FileData *blo_openblenderfile_minimal(const char *filepath)
+static FileData *blo_filedata_from_file_minimal(const char *filepath)
{
gzFile gzfile;
errno = 0;
@@ -1188,7 +1188,7 @@ static FileData *blo_openblenderfile_minimal(const char *filepath)
return fd;
}
- blo_freefiledata(fd);
+ blo_filedata_free(fd);
}
return NULL;
@@ -1234,7 +1234,7 @@ static int fd_read_gzip_from_memory_init(FileData *fd)
return 1;
}
-FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *reports)
+FileData *blo_filedata_from_memory(const void *mem, in
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list