MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / fix_name_collisions

Function fix_name_collisions

libhb/preset.c:2807–2828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2805}
2806
2807static char * fix_name_collisions(hb_value_t * list, const char * name)
2808{
2809 char * new_name = strdup(name);
2810 int ii, jj, count;
2811
2812 count = hb_value_array_len(list);
2813 for (ii = 0, jj = 0; ii < count; ii++)
2814 {
2815 hb_value_t * item = hb_value_array_get(list, ii);
2816 const char * preset_name;
2817
2818 preset_name = hb_dict_get_string(item, "PresetName");
2819 if (!strcmp(new_name, preset_name))
2820 {
2821 // Collision, add a number and try again
2822 free(new_name);
2823 new_name = hb_strdup_printf("%s - %d", name, jj++);
2824 ii = -1;
2825 }
2826 }
2827 return new_name;
2828}
2829
2830static void import_folder_hierarchy_29_0_0(const char * name,
2831 hb_value_t * new_list, hb_value_t * folder)

Callers 2

import_hierarchy_29_0_0Function · 0.85

Calls 3

hb_value_array_lenFunction · 0.85
hb_value_array_getFunction · 0.85
hb_strdup_printfFunction · 0.85

Tested by

no test coverage detected