comparison foosdk/sdk/foobar2000/helpers/file_move_helper.cpp @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #include "StdAfx.h"
2
3 #include "file_move_helper.h"
4 #include <SDK/file_operation_callback.h>
5
6 bool file_move_helper::g_on_deleted(const pfc::list_base_const_t<const char *> & p_files)
7 {
8 file_operation_callback::g_on_files_deleted(p_files);
9 return true;
10 }
11
12 t_size file_move_helper::g_filter_dead_files_sorted_make_mask(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead,bit_array_var & p_mask)
13 {
14 t_size n, m = p_data.get_count();
15 t_size found = 0;
16 for(n=0;n<m;n++)
17 {
18 t_size dummy;
19 bool dead = p_dead.bsearch_t(metadb::path_compare,p_data.get_item(n)->get_path(),dummy);
20 if (dead) found++;
21 p_mask.set(n,dead);
22 }
23 return found;
24 }
25
26 t_size file_move_helper::g_filter_dead_files_sorted(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead)
27 {
28 pfc::bit_array_bittable mask(p_data.get_count());
29 t_size found = g_filter_dead_files_sorted_make_mask(p_data,p_dead,mask);
30 if (found > 0) p_data.remove_mask(mask);
31 return found;
32 }
33
34 t_size file_move_helper::g_filter_dead_files(pfc::list_base_t<metadb_handle_ptr> & p_data,const pfc::list_base_const_t<const char*> & p_dead)
35 {
36 pfc::ptr_list_t<const char> temp;
37 temp.add_items(p_dead);
38 temp.sort_t(metadb::path_compare);
39 return g_filter_dead_files_sorted(p_data,temp);
40 }
41