mirror of https://github.com/tstellar/bygfoot.git
"Minor string array improvements."
This commit is contained in:
parent
1387c52dea
commit
6c959586c7
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
28
src/cup.c
28
src/cup.c
|
@ -268,7 +268,9 @@ cup_load_choose_team(Cup *cup, GPtrArray *teams, const CupChooseTeam *ct)
|
|||
g_ptr_array_add(
|
||||
teams, team_of_id(
|
||||
g_array_index(league->table.elements, TableElement, j).team_id));
|
||||
g_ptr_array_add(cup->team_names, team_of_id(g_array_index(league->table.elements, TableElement, j).team_id)->name);
|
||||
g_ptr_array_add(
|
||||
cup->team_names,
|
||||
g_strdup(team_of_id(g_array_index(league->table.elements, TableElement, j).team_id)->name->str));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -300,8 +302,9 @@ cup_load_choose_team(Cup *cup, GPtrArray *teams, const CupChooseTeam *ct)
|
|||
{
|
||||
g_ptr_array_add(teams,
|
||||
team_of_id(g_array_index(league->table.elements, TableElement, order[j]).team_id));
|
||||
g_ptr_array_add(cup->team_names,
|
||||
team_of_id(g_array_index(league->table.elements, TableElement, order[j]).team_id)->name);
|
||||
g_ptr_array_add(
|
||||
cup->team_names,
|
||||
g_strdup(team_of_id(g_array_index(league->table.elements, TableElement, order[j]).team_id)->name->str));
|
||||
number_of_teams++;
|
||||
|
||||
if(number_of_teams == ct->number_of_teams)
|
||||
|
@ -341,8 +344,8 @@ cup_load_choose_team(Cup *cup, GPtrArray *teams, const CupChooseTeam *ct)
|
|||
g_ptr_array_add(teams, &g_array_index(lig(0).teams,
|
||||
Team, permutation[i - ct->start_idx + 1]));
|
||||
g_ptr_array_add(cup->team_names,
|
||||
g_array_index(lig(0).teams,
|
||||
Team, permutation[i - ct->start_idx + 1]).name);
|
||||
g_strdup(g_array_index(lig(0).teams,
|
||||
Team, permutation[i - ct->start_idx + 1]).name->str));
|
||||
number_of_teams++;
|
||||
}
|
||||
|
||||
|
@ -378,7 +381,8 @@ cup_load_choose_team(Cup *cup, GPtrArray *teams, const CupChooseTeam *ct)
|
|||
(Team*)g_ptr_array_index(cup_teams_sorted, j), cup->group))
|
||||
{
|
||||
g_ptr_array_add(teams, g_ptr_array_index(cup_teams_sorted, j));
|
||||
g_ptr_array_add(cup->team_names, ((Team*)g_ptr_array_index(cup_teams_sorted, j))->name);
|
||||
g_ptr_array_add(cup->team_names,
|
||||
g_strdup(((Team*)g_ptr_array_index(cup_teams_sorted, j))->name->str));
|
||||
number_of_teams++;
|
||||
|
||||
if(number_of_teams == ct->number_of_teams)
|
||||
|
@ -423,9 +427,9 @@ cup_load_choose_team_generate(Cup *cup, CupRound *cup_round, const CupChooseTeam
|
|||
|
||||
for(j=0;j<sids->len;j++)
|
||||
{
|
||||
if(!query_cup_choose_team_is_league(((GString*)g_ptr_array_index(sids, j))->str))
|
||||
if(!query_cup_choose_team_is_league((gchar*)g_ptr_array_index(sids, j)))
|
||||
{
|
||||
xml_league_read(((GString*)g_ptr_array_index(sids, j))->str, leagues);
|
||||
xml_league_read((gchar*)g_ptr_array_index(sids, j), leagues);
|
||||
|
||||
for(k=0; k < g_array_index(leagues, League, leagues->len - 1).teams->len; k++)
|
||||
g_array_append_val(teams_local, g_array_index(
|
||||
|
@ -437,7 +441,7 @@ cup_load_choose_team_generate(Cup *cup, CupRound *cup_round, const CupChooseTeam
|
|||
}
|
||||
|
||||
g_array_free(leagues, TRUE);
|
||||
free_g_string_array(&sids);
|
||||
free_gchar_array(&sids);
|
||||
|
||||
/** No teams found. */
|
||||
if(teams_local->len == 0)
|
||||
|
@ -481,7 +485,7 @@ cup_load_choose_team_generate(Cup *cup, CupRound *cup_round, const CupChooseTeam
|
|||
g_array_append_val(cup_round->teams, g_array_index(teams_local, Team, permutation[j]));
|
||||
g_array_index(cup_round->teams, Team, cup_round->teams->len - 1).clid = cup->id;
|
||||
g_ptr_array_add(cup->team_names,
|
||||
g_array_index(cup_round->teams, Team, cup_round->teams->len - 1).name);
|
||||
g_strdup(g_array_index(cup_round->teams, Team, cup_round->teams->len - 1).name->str));
|
||||
|
||||
number_of_teams++;
|
||||
}
|
||||
|
@ -1020,10 +1024,10 @@ cup_get_highlight_colour(const Cup *cup)
|
|||
gchar buf[SMALL];
|
||||
|
||||
for(i=0;i<cup->properties->len;i++)
|
||||
if(g_str_has_prefix(((GString*)g_ptr_array_index(cup->properties, i))->str, "highlight"))
|
||||
if(g_str_has_prefix((gchar*)g_ptr_array_index(cup->properties, i), "highlight"))
|
||||
{
|
||||
sprintf(buf, "string_cup_%s",
|
||||
((GString*)g_ptr_array_index(cup->properties, i))->str);
|
||||
(gchar*)g_ptr_array_index(cup->properties, i));
|
||||
return const_app(buf);
|
||||
}
|
||||
|
||||
|
|
41
src/file.c
41
src/file.c
|
@ -201,31 +201,31 @@ file_check_home_dir_copy_definition_dir(const gchar *dirname, const gchar *basen
|
|||
{
|
||||
sprintf(buf, "%s%s%s%s%s%s%s", home, G_DIR_SEPARATOR_S,
|
||||
HOMEDIRNAME, G_DIR_SEPARATOR_S, basename, G_DIR_SEPARATOR_S,
|
||||
((GString*)g_ptr_array_index(dir_contents, i))->str);
|
||||
(gchar*)g_ptr_array_index(dir_contents, i));
|
||||
|
||||
if(g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, ".xml") &&
|
||||
if(g_str_has_suffix((gchar*)g_ptr_array_index(dir_contents, i), ".xml") &&
|
||||
!g_file_test(buf, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
|
||||
sprintf(buf2, "%s%s%s", dirname, G_DIR_SEPARATOR_S,
|
||||
((GString*)g_ptr_array_index(dir_contents, i))->str);
|
||||
(gchar*)g_ptr_array_index(dir_contents, i));
|
||||
file_copy_file(buf2, buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(buf, "%s%s%s", dirname, G_DIR_SEPARATOR_S,
|
||||
((GString*)g_ptr_array_index(dir_contents, i))->str);
|
||||
(gchar*)g_ptr_array_index(dir_contents, i));
|
||||
|
||||
if(g_file_test(buf, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
sprintf(buf2, "%s%s%s", basename, G_DIR_SEPARATOR_S,
|
||||
((GString*)g_ptr_array_index(dir_contents, i))->str);
|
||||
(gchar*)g_ptr_array_index(dir_contents, i));
|
||||
file_check_home_dir_copy_definition_dir(buf, buf2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free_g_string_array(&dir_contents);
|
||||
free_gchar_array(&dir_contents);
|
||||
}
|
||||
|
||||
/** Copy the xml definition files into the home dir. */
|
||||
|
@ -255,13 +255,12 @@ file_check_home_dir(void)
|
|||
/**
|
||||
Retrieve those files in the given directory
|
||||
that start with the given prefix and suffix. The file names are stored
|
||||
in an array of GStrings.
|
||||
in an array of strings.
|
||||
@param dir_name The full path to the directory.
|
||||
@param prefix The prefix that files must have to be included.
|
||||
@param suffix The suffix that files must have to be included.
|
||||
@return A GPtrArray with pointers to the GStrings of the file
|
||||
names. The GStrings and the array must be freed with free_g_string_array().
|
||||
@see free_g_string_array()
|
||||
@return A GPtrArray with pointers to the strings of the file
|
||||
names. The array must be freed with free_gchar_array().
|
||||
*/
|
||||
GPtrArray*
|
||||
file_dir_get_contents(const gchar *dir_name, const gchar *prefix, const gchar *suffix)
|
||||
|
@ -269,7 +268,6 @@ file_dir_get_contents(const gchar *dir_name, const gchar *prefix, const gchar *s
|
|||
GError *error = NULL;
|
||||
GDir *dir = g_dir_open(dir_name, 0, &error);
|
||||
GPtrArray *contents = g_ptr_array_new();
|
||||
GString *new = NULL;
|
||||
const gchar *file = NULL;
|
||||
|
||||
misc_print_error(&error, FALSE);
|
||||
|
@ -286,10 +284,8 @@ file_dir_get_contents(const gchar *dir_name, const gchar *prefix, const gchar *s
|
|||
{
|
||||
if(g_str_has_prefix(file, prefix) &&
|
||||
g_str_has_suffix(file, suffix))
|
||||
{
|
||||
new = g_string_new(file);
|
||||
g_ptr_array_add(contents, (gpointer)new);
|
||||
}
|
||||
g_ptr_array_add(contents, (gpointer)g_strdup(file));
|
||||
|
||||
file = g_dir_read_name(dir);
|
||||
}
|
||||
|
||||
|
@ -306,21 +302,18 @@ file_get_country_files(void)
|
|||
GList *elem = support_directories;
|
||||
GPtrArray *country_files = g_ptr_array_new();
|
||||
GPtrArray *dir_contents = NULL;
|
||||
GString *new_string = NULL;
|
||||
|
||||
while(elem != NULL)
|
||||
{
|
||||
dir_contents = file_dir_get_contents((gchar*)elem->data, "country_", ".xml");
|
||||
|
||||
for(i=0;i<dir_contents->len;i++)
|
||||
if(!query_misc_string_in_array(((GString*)g_ptr_array_index(dir_contents, i))->str,
|
||||
if(!query_misc_string_in_array((gchar*)g_ptr_array_index(dir_contents, i),
|
||||
country_files))
|
||||
{
|
||||
new_string = g_string_new(((GString*)g_ptr_array_index(dir_contents, i))->str);
|
||||
g_ptr_array_add(country_files, new_string);
|
||||
}
|
||||
g_ptr_array_add(country_files,
|
||||
g_strdup((gchar*)g_ptr_array_index(dir_contents, i)));
|
||||
|
||||
free_g_string_array(&dir_contents);
|
||||
free_gchar_array(&dir_contents);
|
||||
|
||||
elem = elem->next;
|
||||
}
|
||||
|
@ -537,7 +530,7 @@ file_compress_files(const gchar *destfile, const gchar *prefix)
|
|||
for(i=0;i<files->len;i++)
|
||||
{
|
||||
strcat(buf, " ");
|
||||
strcat(buf, ((GString*)g_ptr_array_index(files, i))->str);
|
||||
strcat(buf, (gchar*)g_ptr_array_index(files, i));
|
||||
}
|
||||
|
||||
file_my_system(buf);
|
||||
|
@ -547,7 +540,7 @@ file_compress_files(const gchar *destfile, const gchar *prefix)
|
|||
sprintf(buf, "%s%s%s*", dirname, G_DIR_SEPARATOR_S, basename);
|
||||
file_remove_files(buf);
|
||||
|
||||
free_g_string_array(&files);
|
||||
free_gchar_array(&files);
|
||||
|
||||
g_free(basename);
|
||||
g_free(dirname);
|
||||
|
|
|
@ -472,9 +472,9 @@ free_cup(Cup *cup)
|
|||
free_g_array(&cup->fixtures);
|
||||
|
||||
free_g_ptr_array(&cup->bye);
|
||||
free_g_ptr_array(&cup->team_names);
|
||||
free_gchar_array(&cup->team_names);
|
||||
free_g_ptr_array(&cup->teams);
|
||||
free_g_string_array(&cup->properties);
|
||||
free_gchar_array(&cup->properties);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -532,7 +532,7 @@ free_lg_commentary(gboolean reset)
|
|||
@param array The array to be freed.
|
||||
*/
|
||||
void
|
||||
free_g_string_array(GPtrArray **array)
|
||||
free_gchar_array(GPtrArray **array)
|
||||
{
|
||||
gint i;
|
||||
|
||||
|
@ -540,9 +540,10 @@ free_g_string_array(GPtrArray **array)
|
|||
return;
|
||||
|
||||
for(i=0;i<(*array)->len;i++)
|
||||
free_g_string((GString**)&g_ptr_array_index(*array, i));
|
||||
g_free(g_ptr_array_index(*array, i));
|
||||
|
||||
free_g_ptr_array(array);
|
||||
*array = NULL;
|
||||
}
|
||||
|
||||
/** Free a GString if it isn't NULL.
|
||||
|
|
|
@ -56,7 +56,7 @@ void
|
|||
free_variables(void);
|
||||
|
||||
void
|
||||
free_g_string_array(GPtrArray **array);
|
||||
free_gchar_array(GPtrArray **array);
|
||||
|
||||
void
|
||||
free_player_array(GArray **players);
|
||||
|
|
|
@ -24,7 +24,7 @@ language_set(gint index)
|
|||
misc_separate_strings(const_str("string_language_codes"));
|
||||
|
||||
if(index > 0)
|
||||
strcpy(buf, ((GString*)g_ptr_array_index(codes, index - 1))->str);
|
||||
strcpy(buf, (gchar*)g_ptr_array_index(codes, index - 1));
|
||||
else
|
||||
strcpy(buf, "");
|
||||
|
||||
|
@ -60,7 +60,7 @@ language_set(gint index)
|
|||
|
||||
lg_commentary_load_commentary_file_from_option();
|
||||
|
||||
free_g_string_array(&codes);
|
||||
free_gchar_array(&codes);
|
||||
}
|
||||
|
||||
/** Get the index of the given code in the codes
|
||||
|
@ -79,13 +79,13 @@ language_get_code_index(const gchar *code)
|
|||
strcpy(local_code, "C");
|
||||
|
||||
for(i=0;i<codes->len;i++)
|
||||
if(strcmp(local_code, ((GString*)g_ptr_array_index(codes, i))->str) == 0)
|
||||
if(strcmp(local_code, (gchar*)g_ptr_array_index(codes, i)) == 0)
|
||||
{
|
||||
return_value = i;
|
||||
break;
|
||||
}
|
||||
|
||||
free_g_string_array(&codes);
|
||||
free_gchar_array(&codes);
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
|
|
@ -462,7 +462,7 @@ league_get_team_movements_prom_rel(const League *league, GArray *team_movements)
|
|||
|
||||
for(j=0;j<dest_sids->len;j++)
|
||||
dest_idcs_int[j] =
|
||||
league_index_from_sid(((GString*)g_ptr_array_index(dest_sids, j))->str);
|
||||
league_index_from_sid((gchar*)g_ptr_array_index(dest_sids, j));
|
||||
|
||||
for(j=g_array_index(elements, PromRelElement, i).ranks[0];
|
||||
j<=g_array_index(elements, PromRelElement, i).ranks[1]; j++)
|
||||
|
@ -480,7 +480,7 @@ league_get_team_movements_prom_rel(const League *league, GArray *team_movements)
|
|||
g_array_append_val(team_movements, new_move);
|
||||
}
|
||||
|
||||
free_g_string_array(&dest_sids);
|
||||
free_gchar_array(&dest_sids);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -512,7 +512,7 @@ league_get_team_movements_prom_games(const League *league, GArray *team_movement
|
|||
|
||||
for(i=0;i<dest_sids->len;i++)
|
||||
dest_idcs_int[i] =
|
||||
league_index_from_sid(((GString*)g_ptr_array_index(dest_sids, i))->str);
|
||||
league_index_from_sid((gchar*)g_ptr_array_index(dest_sids, i));
|
||||
|
||||
for(i=start_idx;i<end_idx;i++)
|
||||
{
|
||||
|
@ -528,7 +528,7 @@ league_get_team_movements_prom_games(const League *league, GArray *team_movement
|
|||
g_array_append_val(team_movements, new_move);
|
||||
}
|
||||
|
||||
free_g_string_array(&dest_sids);
|
||||
free_gchar_array(&dest_sids);
|
||||
}
|
||||
|
||||
|
||||
|
|
12
src/misc.c
12
src/misc.c
|
@ -57,14 +57,13 @@ misc_swap_gpointer(gpointer *first, gpointer *second)
|
|||
white spaces.
|
||||
@param string The string containing white spaces.
|
||||
@return A GPtrArray containing all the strings without white spaces that were part of the original string.
|
||||
This array must be freed with free_g_string_array(). */
|
||||
This array must be freed with free_gchar_array(). */
|
||||
GPtrArray*
|
||||
misc_separate_strings(gchar *string)
|
||||
{
|
||||
gint i, cnt = 0, start = 0;
|
||||
gchar buf[BIG];
|
||||
GPtrArray *string_array = g_ptr_array_new();
|
||||
GString *new_string = NULL;
|
||||
|
||||
for(i=0;i<strlen(string);i++)
|
||||
if(g_ascii_isspace(string[i]))
|
||||
|
@ -87,10 +86,7 @@ misc_separate_strings(gchar *string)
|
|||
buf[cnt] = '\0';
|
||||
cnt = 0;
|
||||
if(strlen(buf) > 0)
|
||||
{
|
||||
new_string = g_string_new(buf);
|
||||
g_ptr_array_add(string_array, (gpointer)new_string);
|
||||
}
|
||||
g_ptr_array_add(string_array, (gpointer)g_strdup(buf));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,14 +215,14 @@ misc_float_compare(gfloat first, gfloat second)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** Check whether the string is in the GString array. */
|
||||
/** Check whether the string is in the string array. */
|
||||
gboolean
|
||||
query_misc_string_in_array(const gchar *string, GPtrArray *array)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for(i=0;i<array->len;i++)
|
||||
if(strcmp(string, ((GString*)g_ptr_array_index(array, i))->str) == 0)
|
||||
if(strcmp(string, (gchar*)g_ptr_array_index(array, i)) == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -162,7 +162,7 @@ query_team_is_in_cups(const Team *tm, gint group)
|
|||
if(cp(i).group == group)
|
||||
for(j=0;j<cp(i).team_names->len;j++)
|
||||
if(strcmp(tm->name->str,
|
||||
((GString*)g_ptr_array_index(cp(i).team_names, j))->str) == 0)
|
||||
(gchar*)g_ptr_array_index(cp(i).team_names, j)) == 0)
|
||||
{
|
||||
if(debug > 90)
|
||||
printf("team %s group %d found in %s \n", tm->name->str,
|
||||
|
@ -184,7 +184,7 @@ query_team_is_in_cup(const Team *tm, const Cup *cup)
|
|||
|
||||
for(i=0;i<cup->team_names->len;i++)
|
||||
if(strcmp(tm->name->str,
|
||||
((GString*)g_ptr_array_index(cup->team_names, i))->str) == 0)
|
||||
(gchar*)g_ptr_array_index(cup->team_names, i)) == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -2295,14 +2295,14 @@ treeview_create_country_list(const GPtrArray *country_list)
|
|||
|
||||
for(i=0;i<country_list->len;i++)
|
||||
{
|
||||
sscanf(((GString*)g_ptr_array_index(country_list, i))->str, "country_%[^.]%[.xml]",
|
||||
sscanf((gchar*)g_ptr_array_index(country_list, i), "country_%[^.]%[.xml]",
|
||||
buf2, trash);
|
||||
sprintf(buf, "flag_%s.png", buf2);
|
||||
|
||||
gtk_list_store_append(ls, &iter);
|
||||
treeview_helper_insert_icon(ls, &iter, 0, buf);
|
||||
gtk_list_store_set(ls, &iter, 1,
|
||||
((GString*)g_ptr_array_index(country_list, i))->str, -1);
|
||||
(gchar*)g_ptr_array_index(country_list, i), -1);
|
||||
}
|
||||
|
||||
return GTK_TREE_MODEL(ls);
|
||||
|
@ -2416,13 +2416,13 @@ treeview_create_language_list(void)
|
|||
for(i=0;i<names->len;i++)
|
||||
{
|
||||
gtk_list_store_append(ls, &iter);
|
||||
treeview_helper_insert_icon(ls, &iter, 0, ((GString*)g_ptr_array_index(symbols, i))->str);
|
||||
treeview_helper_insert_icon(ls, &iter, 0, (gchar*)g_ptr_array_index(symbols, i));
|
||||
gtk_list_store_set(ls, &iter, 1,
|
||||
((GString*)g_ptr_array_index(names, i))->str, -1);
|
||||
(gchar*)g_ptr_array_index(names, i), -1);
|
||||
}
|
||||
|
||||
free_g_string_array(&names);
|
||||
free_g_string_array(&symbols);
|
||||
free_gchar_array(&names);
|
||||
free_gchar_array(&symbols);
|
||||
|
||||
return GTK_TREE_MODEL(ls);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ window_show_startup(void)
|
|||
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_country), 0);
|
||||
|
||||
free_g_string_array(&country_files);
|
||||
free_gchar_array(&country_files);
|
||||
}
|
||||
|
||||
/** Show the file selection window. */
|
||||
|
|
24
src/xml.c
24
src/xml.c
|
@ -54,15 +54,15 @@ xml_load_leagues(const gchar *dirname, const gchar *basename)
|
|||
free_leagues_array(&ligs, TRUE);
|
||||
|
||||
for(i=0;i<dir_contents->len;i++)
|
||||
if(!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_table.xml") &&
|
||||
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_fixtures.xml") &&
|
||||
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_teams.xml") &&
|
||||
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_stat.xml") &&
|
||||
!g_strrstr(((GString*)g_ptr_array_index(dir_contents, i))->str, "_promcup"))
|
||||
xml_load_league(dirname, ((GString*)g_ptr_array_index(dir_contents, i))->str,
|
||||
if(!g_str_has_suffix((gchar*)g_ptr_array_index(dir_contents, i), "_table.xml") &&
|
||||
!g_str_has_suffix((gchar*)g_ptr_array_index(dir_contents, i), "_fixtures.xml") &&
|
||||
!g_str_has_suffix((gchar*)g_ptr_array_index(dir_contents, i), "_teams.xml") &&
|
||||
!g_str_has_suffix((gchar*)g_ptr_array_index(dir_contents, i), "_stat.xml") &&
|
||||
!g_strrstr((gchar*)g_ptr_array_index(dir_contents, i), "_promcup"))
|
||||
xml_load_league(dirname, (gchar*)g_ptr_array_index(dir_contents, i),
|
||||
dir_contents);
|
||||
|
||||
free_g_string_array(&dir_contents);
|
||||
free_gchar_array(&dir_contents);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -116,19 +116,19 @@ xml_load_cups(const gchar *dirname, const gchar *basename)
|
|||
|
||||
for(i=0;i<dir_contents->len;i++)
|
||||
{
|
||||
if(!g_strrstr(((GString*)g_ptr_array_index(dir_contents, i))->str, "_table") &&
|
||||
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_fixtures.xml") &&
|
||||
!g_str_has_suffix(((GString*)g_ptr_array_index(dir_contents, i))->str, "_teams.xml"))
|
||||
if(!g_strrstr((gchar*)g_ptr_array_index(dir_contents, i), "_table") &&
|
||||
!g_str_has_suffix((gchar*)g_ptr_array_index(dir_contents, i), "_fixtures.xml") &&
|
||||
!g_str_has_suffix((gchar*)g_ptr_array_index(dir_contents, i), "_teams.xml"))
|
||||
{
|
||||
new_cup = cup_new(FALSE);
|
||||
g_array_append_val(cps, new_cup);
|
||||
xml_load_cup(&g_array_index(cps, Cup, cps->len - 1), dirname,
|
||||
((GString*)g_ptr_array_index(dir_contents, i))->str,
|
||||
(gchar*)g_ptr_array_index(dir_contents, i),
|
||||
dir_contents);
|
||||
}
|
||||
}
|
||||
|
||||
free_g_string_array(&dir_contents);
|
||||
free_gchar_array(&dir_contents);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -253,7 +253,6 @@ xml_cup_read_text (GMarkupParseContext *context,
|
|||
gchar buf[text_len + 1];
|
||||
gint int_value;
|
||||
gfloat float_value;
|
||||
GString *new_property = NULL;
|
||||
|
||||
strncpy(buf, text, text_len);
|
||||
buf[text_len] = '\0';
|
||||
|
@ -274,10 +273,7 @@ xml_cup_read_text (GMarkupParseContext *context,
|
|||
else if(state == STATE_LAST_WEEK)
|
||||
new_cup.last_week = int_value;
|
||||
else if(state == STATE_PROPERTY)
|
||||
{
|
||||
new_property = g_string_new(buf);
|
||||
g_ptr_array_add(new_cup.properties, new_property);
|
||||
}
|
||||
g_ptr_array_add(new_cup.properties, g_strdup(buf));
|
||||
else if(state == STATE_ADD_WEEK)
|
||||
new_cup.add_week = int_value;
|
||||
else if(state == STATE_WEEK_GAP)
|
||||
|
|
|
@ -157,7 +157,6 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
|
|||
gchar buf[SMALL], buf2[SMALL];
|
||||
gint int_value = -1;
|
||||
gfloat float_value;
|
||||
GString *new_string = NULL;
|
||||
Table new_table;
|
||||
|
||||
strncpy(buf, text, text_len);
|
||||
|
@ -185,10 +184,7 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
|
|||
else if(state == TAG_CUP_ADD_WEEK)
|
||||
new_cup->add_week = int_value;
|
||||
else if(state == TAG_CUP_PROPERTY)
|
||||
{
|
||||
new_string = g_string_new(buf);
|
||||
g_ptr_array_add(new_cup->properties, new_string);
|
||||
}
|
||||
g_ptr_array_add(new_cup->properties, g_strdup(buf));
|
||||
else if(state == TAG_CUP_GROUP)
|
||||
new_cup->group = int_value;
|
||||
else if(state == TAG_CUP_TALENT_DIFF)
|
||||
|
@ -200,10 +196,7 @@ xml_loadsave_cup_text (GMarkupParseContext *context,
|
|||
else if(state == TAG_CUP_TEAM_ID_BYE)
|
||||
g_ptr_array_add(new_cup->bye, team_of_id(int_value));
|
||||
else if(state == TAG_CUP_TEAM_NAME)
|
||||
{
|
||||
new_string = g_string_new(buf);
|
||||
g_ptr_array_add(new_cup->team_names, new_string);
|
||||
}
|
||||
g_ptr_array_add(new_cup->team_names, g_strdup(buf));
|
||||
else if(state == TAG_CUP_CHOOSE_TEAM_SID)
|
||||
g_string_printf(new_choose_team.sid, "%s", buf);
|
||||
else if(state == TAG_CUP_CHOOSE_TEAM_NUMBER_OF_TEAMS)
|
||||
|
@ -327,8 +320,8 @@ xml_loadsave_cup_write(const gchar *prefix, const Cup *cup)
|
|||
TAG_CUP_NEXT_FIXTURE_UPDATE_WEEK_ROUND, I0);
|
||||
|
||||
for(i=0;i<cup->properties->len;i++)
|
||||
xml_write_g_string(fil, (GString*)g_ptr_array_index(cup->properties, i),
|
||||
TAG_CUP_PROPERTY, I0);
|
||||
xml_write_string(fil, (gchar*)g_ptr_array_index(cup->properties, i),
|
||||
TAG_CUP_PROPERTY, I0);
|
||||
|
||||
for(i=0;i<cup->rounds->len;i++)
|
||||
xml_loadsave_cup_write_round(fil, prefix, cup, i);
|
||||
|
@ -339,7 +332,7 @@ xml_loadsave_cup_write(const gchar *prefix, const Cup *cup)
|
|||
TAG_CUP_TEAM_ID_BYE, I1);
|
||||
|
||||
for(i=0;i<cup->team_names->len;i++)
|
||||
xml_write_g_string(fil, (GString*)g_ptr_array_index(cup->team_names, i),
|
||||
xml_write_string(fil, (gchar*)g_ptr_array_index(cup->team_names, i),
|
||||
TAG_CUP_TEAM_NAME, I1);
|
||||
|
||||
fprintf(fil, "</_%d>\n", TAG_CUP);
|
||||
|
|
|
@ -7,64 +7,98 @@
|
|||
<first_name>Armando</first_name>
|
||||
<first_name>Bernardo</first_name>
|
||||
<first_name>Carlos</first_name>
|
||||
<first_name>Charlie</first_name>
|
||||
<first_name>Cristian</first_name>
|
||||
<first_name>Daniel</first_name>
|
||||
<first_name>Danilo</first_name>
|
||||
<first_name>Diego</first_name>
|
||||
<first_name>Eduardo</first_name>
|
||||
<first_name>Ernesto</first_name>
|
||||
<first_name>Fabián</first_name>
|
||||
<first_name>Fabricio</first_name>
|
||||
<first_name>Federico</first_name>
|
||||
<first_name>Felipe</first_name>
|
||||
<first_name>Fernando</first_name>
|
||||
<first_name>Francisco</first_name>
|
||||
<first_name>Gabriel</first_name>
|
||||
<first_name>Germán</first_name>
|
||||
<first_name>Guillermo</first_name>
|
||||
<first_name>Gustavo</first_name>
|
||||
<first_name>Hugo</first_name>
|
||||
<first_name>Jorge</first_name>
|
||||
<first_name>José</first_name>
|
||||
<first_name>Leonardo</first_name>
|
||||
<first_name>Lucas</first_name>
|
||||
<first_name>Luís</first_name>
|
||||
<first_name>Marcelo</first_name>
|
||||
<first_name>Marcos</first_name>
|
||||
<first_name>Mario</first_name>
|
||||
<first_name>Mateo</first_name>
|
||||
<first_name>Martín</first_name>
|
||||
<first_name>Mateo</first_name>
|
||||
<first_name>Matías</first_name>
|
||||
<first_name>Mauro</first_name>
|
||||
<first_name>Michael</first_name>
|
||||
<first_name>Miguel</first_name>
|
||||
<first_name>Oscar</first_name>
|
||||
<first_name>Paulo</first_name>
|
||||
<first_name>Pedro</first_name>
|
||||
<first_name>Rafael</first_name>
|
||||
<first_name>Ramiro</first_name>
|
||||
<first_name>Rene</first_name>
|
||||
<first_name>Ricardo</first_name>
|
||||
<first_name>Richard</first_name>
|
||||
<first_name>Roberto</first_name>
|
||||
<first_name>Rodrigo</first_name>
|
||||
<first_name>Rubens</first_name>
|
||||
<first_name>Samuel</first_name>
|
||||
<first_name>Sergio</first_name>
|
||||
<first_name>Sebastián</first_name>
|
||||
<first_name>Silvio</first_name>
|
||||
<first_name>Simón</first_name>
|
||||
<first_name>Umberto</first_name>
|
||||
<first_name>Vicente</first_name>
|
||||
<first_name>Victor</first_name>
|
||||
<first_name>Víctor</first_name>
|
||||
<first_name>Waldemar</first_name>
|
||||
<first_name>Walter</first_name>
|
||||
<first_name>Wáshington</first_name>
|
||||
<first_name>Wiliam</first_name>
|
||||
|
||||
<first_name>Wiliam</first_name>
|
||||
|
||||
|
||||
<last_name>Abreu</last_name>
|
||||
<last_name>Alonso</last_name>
|
||||
<last_name>Alves</last_name>
|
||||
<last_name>Almeida</last_name>
|
||||
<last_name>Antunes</last_name>
|
||||
<last_name>Arantes</last_name>
|
||||
<last_name>Añasco</last_name>
|
||||
<last_name>Arambillete</last_name>
|
||||
<last_name>Aramburu</last_name>
|
||||
<last_name>Arantes</last_name>
|
||||
<last_name>Barbosa</last_name>
|
||||
<last_name>Benítez</last_name>
|
||||
<last_name>Borges</last_name>
|
||||
<last_name>Bueno</last_name>
|
||||
<last_name>Caballero</last_name>
|
||||
<last_name>Campos</last_name>
|
||||
<last_name>Castillo</last_name>
|
||||
<last_name>Castillos</last_name>
|
||||
<last_name>Cruz</last_name>
|
||||
<last_name>Da Costa</last_name>
|
||||
<last_name>Da Silva</last_name>
|
||||
<last_name>De León</last_name>
|
||||
<last_name>Díaz</last_name>
|
||||
<last_name>Diniz</last_name>
|
||||
<last_name>Dos Santos</last_name>
|
||||
<last_name>Escobar</last_name>
|
||||
<last_name>Fagúndez</last_name>
|
||||
<last_name>Faria</last_name>
|
||||
<last_name>Fonseca</last_name>
|
||||
<last_name>Gadea</last_name>
|
||||
<last_name>García</last_name>
|
||||
<last_name>Giménez</last_name>
|
||||
<last_name>Gómez</last_name>
|
||||
<last_name>Goncálvez</last_name>
|
||||
<last_name>González</last_name>
|
||||
<last_name>Herrera</last_name>
|
||||
<last_name>Leite</last_name>
|
||||
<last_name>Lima</last_name>
|
||||
<last_name>Márquez</last_name>
|
||||
|
@ -73,21 +107,27 @@
|
|||
<last_name>Méndez</last_name>
|
||||
<last_name>Mendoza</last_name>
|
||||
<last_name>Miranda</last_name>
|
||||
<last_name>Moreira</last_name>
|
||||
<last_name>Moreno</last_name>
|
||||
<last_name>Monteiro</last_name>
|
||||
<last_name>Olivera</last_name>
|
||||
<last_name>Pacheco</last_name>
|
||||
<last_name>Paes</last_name>
|
||||
<last_name>Palacios</last_name>
|
||||
<last_name>Paz</last_name>
|
||||
<last_name>Pérez</last_name>
|
||||
<last_name>Pinto</last_name>
|
||||
<last_name>Pintos</last_name>
|
||||
<last_name>Prado</last_name>
|
||||
<last_name>Rodríguez</last_name>
|
||||
<last_name>Santos</last_name>
|
||||
<last_name>Salaberry</last_name>
|
||||
<last_name>Santos</last_name>
|
||||
<last_name>Silva</last_name>
|
||||
<last_name>Silveira</last_name>
|
||||
<last_name>Suárez</last_name>
|
||||
<last_name>Souza</last_name>
|
||||
<last_name>Techera</last_name>
|
||||
<last_name>Telechea</last_name>
|
||||
<last_name>Torres</last_name>
|
||||
<last_name>Viera</last_name>
|
||||
<last_name>Viera</last_name>
|
||||
</names>
|
||||
|
|
Loading…
Reference in New Issue