doxygen: Add \ref to references.
[paraslash.git] / score.c
diff --git a/score.c b/score.c
index bc40668f6fd59605b5d4df0de12b113d69b23075..30761e7556274effe0867335822ab2dc1916e065 100644 (file)
--- a/score.c
+++ b/score.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007-2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2007 Andre Noll <maan@tuebingen.mpg.de>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -7,6 +7,7 @@
 /** \file score.c Scoring functions to determine the audio file streaming order. */
 #include <regex.h>
 #include <osl.h>
+#include <lopsub.h>
 
 #include "para.h"
 #include "error.h"
@@ -33,13 +34,11 @@ static int ptr_compare(const struct osl_object *obj1, const struct osl_object *o
  * This function first compares the score values as usual integers. If they compare as
  * equal, the address of \a obj1 and \a obj2 are compared. So this compare function
  * returns zero if and only if \a obj1 and \a obj2 point to the same memory area.
- *
- * \sa osl_compare_function.
  */
 static int score_compare(const struct osl_object *obj1, const struct osl_object *obj2)
 {
-       int d1 = *(int*)obj1->data;
-       int d2 = *(int*)obj2->data;
+       long d1 = *(long *)obj1->data;
+       long d2 = *(long *)obj2->data;
        int ret = NUM_COMPARE(d2, d1);
 
        if (ret)
@@ -71,7 +70,7 @@ static struct osl_column_description score_cols[] = {
        },
        [SCORECOL_SCORE] = {
                .storage_type = OSL_NO_STORAGE,
-               .storage_flags = OSL_RBTREE | OSL_FIXED_SIZE,
+               .storage_flags = OSL_RBTREE | OSL_FIXED_SIZE | OSL_UNIQUE,
                .name = "score",
                .compare_function = score_compare,
                .data_size = sizeof(long)
@@ -91,8 +90,6 @@ static struct osl_table_description score_table_desc = {
  * \param num Result is returned here.
  *
  * \return Positive on success, negative on errors.
- *
- * \sa osl_get_num_rows().
  */
 int get_num_admissible_files(unsigned *num)
 {
@@ -141,7 +138,7 @@ int score_add(const struct osl_row *aft_row, long score)
        size = score_table_desc.column_descriptions[SCORECOL_SCORE].data_size;
        score_objs[SCORECOL_SCORE].data = para_malloc(size);
        score_objs[SCORECOL_SCORE].size = size;
-       *(int *)(score_objs[SCORECOL_SCORE].data) = score;
+       *(long *)(score_objs[SCORECOL_SCORE].data) = score;
 
 //     PARA_DEBUG_LOG("adding %p\n", *(void **) (score_objs[SCORECOL_AFT_ROW].data));
        ret = osl(osl_add_row(score_table, score_objs));
@@ -168,13 +165,11 @@ static int get_nth_score(unsigned n, long *score)
  * \param aft_row Determines the audio file to change.
  * \param percent The position to re-insert the audio file.
  *
- * The percent parameter must be between \p 0 and 100 and. A value of zero
- * means to re-insert the audio file into the score table with a score lower
- * than any other admissible file.
+ * The percent parameter must be between 0 and 100. A value of zero means to
+ * re-insert the audio file into the score table with a score lower than any
+ * other admissible file.
  *
- * \return Positive on success, negative on errors. Possible errors: Errors
- * returned by osl_get_row(), get_num_admissible_files(), osl_get_nth_row(),
- * osl_get_object(), osl_update_object().
+ * \return Positive on success, negative on errors.
  */
 int score_update(const struct osl_row *aft_row, long percent)
 {
@@ -247,29 +242,12 @@ static int get_score_row_from_aft_row(const struct osl_row *aft_row,
  *
  * This is used for the ls command. The \a data parameter is passed as the
  * second argument to \a func.
- *
- * \sa admissible_file_loop_reverse().
  */
 int admissible_file_loop(void *data, osl_rbtree_loop_func *func)
 {
        return osl(osl_rbtree_loop(score_table, SCORECOL_SCORE, data, func));
 }
 
-/**
- * Loop over all files in the score table in reverse order.
- *
- * \param data As in admissible_file_loop().
- * \param func As in admissible_file_loop().
- *
- * \return Same return value as admissible_file_loop().
- *
- * \sa admissible_file_loop(), osl_rbtree_loop_reverse().
- */
-int admissible_file_loop_reverse(void *data, osl_rbtree_loop_func *func)
-{
-       return osl(osl_rbtree_loop_reverse(score_table, SCORECOL_SCORE, data, func));
-}
-
 /**
  * Get the admissible audio file with highest score.
  *
@@ -302,7 +280,7 @@ int score_get_best(struct osl_row **aft_row, long *score)
  * \return Positive on success, negative on errors. Possible errors:
  * Errors returned by osl_get_row() and osl_del_row().
  *
- * \sa score_add(), score_shutdown().
+ * \sa \ref score_add().
  */
 int score_delete(const struct osl_row *aft_row)
 {