From: Mario R. <mar...@go...> - 2007-10-28 20:55:14
|
Jorg Schuler wrote: > > OK, I'm pretty much convinced then -- thanks. Put the g_fail into ST_CAT_NUM and also if the switch falls through... > > Cheers, > > > JCS. I've changed all switches involving ST_CAT_SPECIAL and ST_CAT_NUM to return a warning if ST_CAT_NUM is used. The only one I am not sure about is in ST_to_T. This function used to return -1 for ST_CAT_SPECIAL (and it still does). But since I do not understand what the "ignore field" is, maybe there could be a better handling of ST_CAT_CPECIAL /* translates a ST_CAT_... (defined in display.h) into a * T_... (defined in display.h). Returns -1 in case a translation is not * possible */ T_item ST_to_T (ST_CAT_item st) { switch (st) { case ST_CAT_ARTIST: return T_ARTIST; case ST_CAT_ALBUM: return T_ALBUM; case ST_CAT_GENRE: return T_GENRE; case ST_CAT_COMPOSER: return T_COMPOSER; case ST_CAT_TITLE: return T_TITLE; case ST_CAT_YEAR: return T_YEAR; case ST_CAT_SPECIAL: break; default: g_return_val_if_reached (-1); } // ############################################################################ return -1; // <<<<<<<<<<<<<<<<<<<<<<<<< is this ok? // ############################################################################ } which is called from /* set string compare function according to whether the ignore field is set or not */ static void st_set_string_compare_func (guint inst, guint page_num) { gchar *buf; buf = g_strdup_printf ("sort_ign_field_%d", ST_to_T (page_num)); if (prefs_get_int (buf)) sorttab[inst]->string_compare_func = compare_string_fuzzy; else sorttab[inst]->string_compare_func = compare_string; g_free (buf); } |