From 716a8241d387180fd8ad69cdec33633bc7a0f963 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 23 Jun 2020 09:54:14 +1000 Subject: Cleanup: rename 'name' to 'filepath' for DNA types Using 'name' for the full path of a file reads badly, especially when id.name is used in related code. --- source/blender/blenkernel/intern/font.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/blender/blenkernel/intern/font.c') diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 5771eb053f7..dfa5ff6975f 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -78,7 +78,7 @@ static void vfont_init_data(ID *id) if (vfd) { vfont->data = vfd; - BLI_strncpy(vfont->name, FO_BUILTIN_NAME, sizeof(vfont->name)); + BLI_strncpy(vfont->filepath, FO_BUILTIN_NAME, sizeof(vfont->filepath)); } /* Free the packed file */ @@ -177,7 +177,7 @@ static int builtin_font_size = 0; bool BKE_vfont_is_builtin(struct VFont *vfont) { - return STREQ(vfont->name, FO_BUILTIN_NAME); + return STREQ(vfont->filepath, FO_BUILTIN_NAME); } void BKE_vfont_builtin_register(void *mem, int size) @@ -237,20 +237,20 @@ static VFontData *vfont_get_data(VFont *vfont) } } else { - pf = BKE_packedfile_new(NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); + pf = BKE_packedfile_new(NULL, vfont->filepath, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); if (vfont->temp_pf == NULL) { vfont->temp_pf = BKE_packedfile_new( - NULL, vfont->name, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); + NULL, vfont->filepath, ID_BLEND_PATH_FROM_GLOBAL(&vfont->id)); } } if (!pf) { - CLOG_WARN(&LOG, "Font file doesn't exist: %s", vfont->name); + CLOG_WARN(&LOG, "Font file doesn't exist: %s", vfont->filepath); /* DON'T DO THIS * missing file shouldn't modify path! - campbell */ #if 0 - strcpy(vfont->name, FO_BUILTIN_NAME); + strcpy(vfont->filepath, FO_BUILTIN_NAME); #endif pf = get_builtin_packedfile(); } @@ -301,7 +301,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath) if (vfd->name[0] != '\0') { BLI_strncpy(vfont->id.name + 2, vfd->name, sizeof(vfont->id.name) - 2); } - BLI_strncpy(vfont->name, filepath, sizeof(vfont->name)); + BLI_strncpy(vfont->filepath, filepath, sizeof(vfont->filepath)); /* if autopack is on store the packedfile in de font structure */ if (!is_builtin && (G.fileflags & G_FILE_AUTOPACK)) { @@ -333,7 +333,7 @@ VFont *BKE_vfont_load_exists_ex(struct Main *bmain, const char *filepath, bool * /* first search an identical filepath */ for (vfont = bmain->fonts.first; vfont; vfont = vfont->id.next) { - BLI_strncpy(strtest, vfont->name, sizeof(vfont->name)); + BLI_strncpy(strtest, vfont->filepath, sizeof(vfont->filepath)); BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &vfont->id)); if (BLI_path_cmp(strtest, str) == 0) { -- cgit v1.2.3