diff options
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 31 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 42 |
2 files changed, 20 insertions, 53 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 29cac294eaf..edef50c15a1 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -727,40 +727,45 @@ static void draw_columnheader_columns(const FileSelectParams *params, /** * Updates the stat string stored in file->entry if necessary. */ -static const char *filelist_get_details_column_string(FileAttributeColumnType column, - const FileDirEntry *file, - const bool small_size, - const bool update_stat_strings) +static const char *filelist_get_details_column_string( + FileAttributeColumnType column, + /* Generated string will be cached in the file, so non-const. */ + FileDirEntry *file, + const bool small_size, + const bool update_stat_strings) { switch (column) { case COLUMN_DATETIME: if (!(file->typeflag & FILE_TYPE_BLENDERLIB) && !FILENAME_IS_CURRPAR(file->relpath)) { - if ((file->entry->datetime_str[0] == '\0') || update_stat_strings) { + if ((file->draw_data.datetime_str[0] == '\0') || update_stat_strings) { char date[FILELIST_DIRENTRY_DATE_LEN], time[FILELIST_DIRENTRY_TIME_LEN]; bool is_today, is_yesterday; BLI_filelist_entry_datetime_to_string( - NULL, file->entry->time, small_size, time, date, &is_today, &is_yesterday); + NULL, file->time, small_size, time, date, &is_today, &is_yesterday); if (is_today || is_yesterday) { BLI_strncpy(date, is_today ? N_("Today") : N_("Yesterday"), sizeof(date)); } - BLI_snprintf( - file->entry->datetime_str, sizeof(file->entry->datetime_str), "%s %s", date, time); + BLI_snprintf(file->draw_data.datetime_str, + sizeof(file->draw_data.datetime_str), + "%s %s", + date, + time); } - return file->entry->datetime_str; + return file->draw_data.datetime_str; } break; case COLUMN_SIZE: if ((file->typeflag & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) || !(file->typeflag & (FILE_TYPE_DIR | FILE_TYPE_BLENDERLIB))) { - if ((file->entry->size_str[0] == '\0') || update_stat_strings) { + if ((file->draw_data.size_str[0] == '\0') || update_stat_strings) { BLI_filelist_entry_size_to_string( - NULL, file->entry->size, small_size, file->entry->size_str); + NULL, file->size, small_size, file->draw_data.size_str); } - return file->entry->size_str; + return file->draw_data.size_str; } break; default: @@ -772,7 +777,7 @@ static const char *filelist_get_details_column_string(FileAttributeColumnType co static void draw_details_columns(const FileSelectParams *params, const FileLayout *layout, - const FileDirEntry *file, + FileDirEntry *file, const int pos_x, const int pos_y, const uchar text_col[4]) diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index a847d60ba52..b81605d6379 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1382,40 +1382,6 @@ static void filelist_entry_clear(FileDirEntry *entry) BKE_icon_delete(entry->preview_icon_id); entry->preview_icon_id = 0; } - /* For now, consider FileDirEntryRevision::poin as not owned here, - * so no need to do anything about it */ - - if (!BLI_listbase_is_empty(&entry->variants)) { - FileDirEntryVariant *var; - - for (var = entry->variants.first; var; var = var->next) { - if (var->name) { - MEM_freeN(var->name); - } - if (var->description) { - MEM_freeN(var->description); - } - - if (!BLI_listbase_is_empty(&var->revisions)) { - FileDirEntryRevision *rev; - - for (rev = var->revisions.first; rev; rev = rev->next) { - if (rev->comment) { - MEM_freeN(rev->comment); - } - } - - BLI_freelistN(&var->revisions); - } - } - - /* TODO: tags! */ - - BLI_freelistN(&entry->variants); - } - else if (entry->entry) { - MEM_freeN(entry->entry); - } } static void filelist_entry_free(FileDirEntry *entry) @@ -1954,16 +1920,12 @@ static FileDirEntry *filelist_file_create_entry(FileList *filelist, const int in FileListInternEntry *entry = filelist->filelist_intern.filtered[index]; FileListEntryCache *cache = &filelist->filelist_cache; FileDirEntry *ret; - FileDirEntryRevision *rev; ret = MEM_callocN(sizeof(*ret), __func__); - rev = MEM_callocN(sizeof(*rev), __func__); - - rev->size = (uint64_t)entry->st.st_size; - rev->time = (int64_t)entry->st.st_mtime; + ret->size = (uint64_t)entry->st.st_size; + ret->time = (int64_t)entry->st.st_mtime; - ret->entry = rev; ret->relpath = BLI_strdup(entry->relpath); if (entry->free_name) { ret->name = BLI_strdup(entry->name); |