Fix para_strerror() and use osl() wrapper for osl library calls.
authorAndre Noll <maan@systemlinux.org>
Thu, 11 Jun 2009 22:35:15 +0000 (00:35 +0200)
committerAndre Noll <maan@systemlinux.org>
Thu, 11 Jun 2009 22:56:38 +0000 (00:56 +0200)
19 files changed:
aac_afh.c
afs.c
afs.h
aft.c
attribute.c
blob.c
command.c
dccp_send.c
error.h
http_send.c
mood.c
mp3_afh.c
ogg_afh.c
playlist.c
score.c
send_common.c
server.c
udp_send.c
vss.c

index 80b50a4d55b6645aba8331c562b3667dc42663f7..fdc22276874e4830a5cfc483fe5c81f7b1d9af68 100644 (file)
--- a/aac_afh.c
+++ b/aac_afh.c
@@ -10,6 +10,7 @@
 
 /** \file aac_afh.c para_server's aac audio format handler */
 
 
 /** \file aac_afh.c para_server's aac audio format handler */
 
+#include <osl.h>
 #include "para.h"
 #include "error.h"
 #include "string.h"
 #include "para.h"
 #include "error.h"
 #include "string.h"
diff --git a/afs.c b/afs.c
index 6b86cb0aeeeb067afa9c12951c204e3b287e9873..8e374f1e7c1f835348fcf5f4a03080cb36f783f4 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -8,6 +8,7 @@
 
 #include <signal.h>
 #include <fnmatch.h>
 
 #include <signal.h>
 #include <fnmatch.h>
+#include <osl.h>
 #include "server.cmdline.h"
 #include "para.h"
 #include "error.h"
 #include "server.cmdline.h"
 #include "para.h"
 #include "error.h"
@@ -341,7 +342,7 @@ static int action_if_pattern_matches(struct osl_row *row, void *data)
        struct pattern_match_data *pmd = data;
        struct osl_object name_obj;
        const char *p, *name;
        struct pattern_match_data *pmd = data;
        struct osl_object name_obj;
        const char *p, *name;
-       int ret = osl_get_object(pmd->table, row, pmd->match_col_num, &name_obj);
+       int ret = osl(osl_get_object(pmd->table, row, pmd->match_col_num, &name_obj));
        const char *pattern_txt = (const char *)pmd->patterns.data;
 
        if (ret < 0)
        const char *pattern_txt = (const char *)pmd->patterns.data;
 
        if (ret < 0)
@@ -368,16 +369,15 @@ static int action_if_pattern_matches(struct osl_row *row, void *data)
  *
  * \param pmd Describes what to match and how.
  *
  *
  * \param pmd Describes what to match and how.
  *
- * \return The return value of the underlying call to osl_rbtree_loop()
- * or osl_rbtree_loop_reverse().
+ * \return Standard.
  */
 int for_each_matching_row(struct pattern_match_data *pmd)
 {
        if (pmd->pm_flags & PM_REVERSE_LOOP)
  */
 int for_each_matching_row(struct pattern_match_data *pmd)
 {
        if (pmd->pm_flags & PM_REVERSE_LOOP)
-               return osl_rbtree_loop_reverse(pmd->table, pmd->loop_col_num, pmd,
-                       action_if_pattern_matches);
-       return osl_rbtree_loop(pmd->table, pmd->loop_col_num, pmd,
-                       action_if_pattern_matches);
+               return osl(osl_rbtree_loop_reverse(pmd->table, pmd->loop_col_num, pmd,
+                       action_if_pattern_matches));
+       return osl(osl_rbtree_loop(pmd->table, pmd->loop_col_num, pmd,
+                       action_if_pattern_matches));
 }
 
 /**
 }
 
 /**
diff --git a/afs.h b/afs.h
index d20b6f20f7697090f2c3d8420effcb35e10a7f8a..a58518bb4e455b2bc909bbf77f77b00408cb7a19 100644 (file)
--- a/afs.h
+++ b/afs.h
@@ -7,7 +7,6 @@
 /** \file afs.h Exported symbols of the audio file selector. */
 
 #include <regex.h>
 /** \file afs.h Exported symbols of the audio file selector. */
 
 #include <regex.h>
-#include <osl.h>
 #include "hash.h"
 
 /** Audio file selector data stored in the audio file table. */
 #include "hash.h"
 
 /** Audio file selector data stored in the audio file table. */
diff --git a/aft.c b/aft.c
index 12424c40e0dda04400698c6e14d71e69387ccfd9..db4c494d07bcd7c759de9708d1f2c30d4ba278aa 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -7,6 +7,7 @@
 /** \file aft.c Audio file table functions. */
 
 #include <dirent.h> /* readdir() */
 /** \file aft.c Audio file table functions. */
 
 #include <dirent.h> /* readdir() */
+#include <osl.h>
 #include "para.h"
 #include "error.h"
 #include "string.h"
 #include "para.h"
 #include "error.h"
 #include "string.h"
@@ -432,13 +433,13 @@ static void load_chunk_table(struct afh_info *afhi, char *buf)
  * \param path The full path of the audio file.
  * \param row Result pointer.
  *
  * \param path The full path of the audio file.
  * \param row Result pointer.
  *
- * \return The return value of the underlying call to osl_get_row().
+ * \return Standard.
  */
 int aft_get_row_of_path(const char *path, struct osl_row **row)
 {
        struct osl_object obj = {.data = (char *)path, .size = strlen(path) + 1};
 
  */
 int aft_get_row_of_path(const char *path, struct osl_row **row)
 {
        struct osl_object obj = {.data = (char *)path, .size = strlen(path) + 1};
 
-       return osl_get_row(audio_file_table, AFTCOL_PATH, &obj, row);
+       return osl(osl_get_row(audio_file_table, AFTCOL_PATH, &obj, row));
 }
 
 /**
 }
 
 /**
@@ -447,12 +448,12 @@ int aft_get_row_of_path(const char *path, struct osl_row **row)
  * \param hash The hash value of the desired audio file.
  * \param row resul pointer.
  *
  * \param hash The hash value of the desired audio file.
  * \param row resul pointer.
  *
- * \return The return value of the underlying call to osl_get_row().
+ * \return Standard.
  */
 int aft_get_row_of_hash(HASH_TYPE *hash, struct osl_row **row)
 {
        const struct osl_object obj = {.data = hash, .size = HASH_SIZE};
  */
 int aft_get_row_of_hash(HASH_TYPE *hash, struct osl_row **row)
 {
        const struct osl_object obj = {.data = hash, .size = HASH_SIZE};
-       return osl_get_row(audio_file_table, AFTCOL_HASH, &obj, row);
+       return osl(osl_get_row(audio_file_table, AFTCOL_HASH, &obj, row));
 }
 
 /**
 }
 
 /**
@@ -461,11 +462,11 @@ int aft_get_row_of_hash(HASH_TYPE *hash, struct osl_row **row)
  * \param row Pointer to a row in the audio file table.
  * \param obj Result pointer.
  *
  * \param row Pointer to a row in the audio file table.
  * \param obj Result pointer.
  *
- * \return The return value of the underlying call to osl_get_object().
+ * \return Standard.
  */
 int get_afsi_object_of_row(const struct osl_row *row, struct osl_object *obj)
 {
  */
 int get_afsi_object_of_row(const struct osl_row *row, struct osl_object *obj)
 {
-       return osl_get_object(audio_file_table, row, AFTCOL_AFSI, obj);
+       return osl(osl_get_object(audio_file_table, row, AFTCOL_AFSI, obj));
 }
 
 /**
 }
 
 /**
@@ -534,8 +535,8 @@ int get_afsi_of_path(const char *path, struct afs_info *afsi)
 int get_audio_file_path_of_row(const struct osl_row *row, char **path)
 {
        struct osl_object path_obj;
 int get_audio_file_path_of_row(const struct osl_row *row, char **path)
 {
        struct osl_object path_obj;
-       int ret = osl_get_object(audio_file_table, row, AFTCOL_PATH,
-               &path_obj);
+       int ret = osl(osl_get_object(audio_file_table, row, AFTCOL_PATH,
+               &path_obj));
        if (ret < 0)
                return ret;
        *path = path_obj.data;
        if (ret < 0)
                return ret;
        *path = path_obj.data;
@@ -552,9 +553,10 @@ int get_audio_file_path_of_row(const struct osl_row *row, char **path)
  *
  * \sa get_hash_of_row().
  */
  *
  * \sa get_hash_of_row().
  */
-static int get_hash_object_of_aft_row(const struct osl_row *row, struct osl_object *obj)
+static int get_hash_object_of_aft_row(const struct osl_row *row,
+               struct osl_object *obj)
 {
 {
-       return osl_get_object(audio_file_table, row, AFTCOL_HASH, obj);
+       return osl(osl_get_object(audio_file_table, row, AFTCOL_HASH, obj));
 }
 
 /**
 }
 
 /**
@@ -592,8 +594,8 @@ static int get_hash_of_row(const struct osl_row *row, HASH_TYPE **hash)
 int get_afhi_of_row(const struct osl_row *row, struct afh_info *afhi)
 {
        struct osl_object obj;
 int get_afhi_of_row(const struct osl_row *row, struct afh_info *afhi)
 {
        struct osl_object obj;
-       int ret = osl_get_object(audio_file_table, row, AFTCOL_AFHI,
-               &obj);
+       int ret = osl(osl_get_object(audio_file_table, row, AFTCOL_AFHI,
+               &obj));
        if (ret < 0)
                return ret;
        load_afhi(obj.data, afhi);
        if (ret < 0)
                return ret;
        load_afhi(obj.data, afhi);
@@ -1383,8 +1385,8 @@ static void com_ls_callback(int fd, const struct osl_object *query)
        if (opts->flags & LS_FLAG_ADMISSIBLE_ONLY)
                ret = admissible_file_loop(opts, prepare_ls_row);
        else
        if (opts->flags & LS_FLAG_ADMISSIBLE_ONLY)
                ret = admissible_file_loop(opts, prepare_ls_row);
        else
-               ret = osl_rbtree_loop(audio_file_table, AFTCOL_PATH, opts,
-                       prepare_ls_row);
+               ret = osl(osl_rbtree_loop(audio_file_table, AFTCOL_PATH, opts,
+                       prepare_ls_row));
        if (ret < 0)
                goto out;
        if (!opts->num_matching_paths)
        if (ret < 0)
                goto out;
        if (!opts->num_matching_paths)
@@ -1532,12 +1534,12 @@ int com_ls(int fd, int argc, char * const * const argv)
  * \param private_data An arbitrary data pointer, passed to \a func.
  * \param func The custom function to be called.
  *
  * \param private_data An arbitrary data pointer, passed to \a func.
  * \param func The custom function to be called.
  *
- * \return The return value of the underlying call to osl_rbtree_loop().
+ * \return Standard.
  */
 int audio_file_loop(void *private_data, osl_rbtree_loop_func *func)
 {
  */
 int audio_file_loop(void *private_data, osl_rbtree_loop_func *func)
 {
-       return osl_rbtree_loop(audio_file_table, AFTCOL_HASH, private_data,
-               func);
+       return osl(osl_rbtree_loop(audio_file_table, AFTCOL_HASH, private_data,
+               func));
 }
 
 static struct osl_row *find_hash_sister(HASH_TYPE *hash)
 }
 
 static struct osl_row *find_hash_sister(HASH_TYPE *hash)
@@ -1697,7 +1699,7 @@ static void com_add_callback(int fd, const struct osl_object *query)
        PARA_INFO_LOG("request to add %s\n", path);
        hs = find_hash_sister(hash);
        ret = aft_get_row_of_path(path, &pb);
        PARA_INFO_LOG("request to add %s\n", path);
        hs = find_hash_sister(hash);
        ret = aft_get_row_of_path(path, &pb);
-       if (ret < 0 && ret != -E_OSL_RB_KEY_NOT_FOUND)
+       if (ret < 0 && ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
                goto out;
        if (hs && pb && hs == pb && !(flags & ADD_FLAG_FORCE)) {
                if (flags & ADD_FLAG_VERBOSE)
                goto out;
        if (hs && pb && hs == pb && !(flags & ADD_FLAG_FORCE)) {
                if (flags & ADD_FLAG_VERBOSE)
@@ -1714,23 +1716,23 @@ static void com_add_callback(int fd, const struct osl_object *query)
                                if (ret < 0)
                                        goto out;
                        }
                                if (ret < 0)
                                        goto out;
                        }
-                       ret = osl_del_row(audio_file_table, pb);
+                       ret = osl(osl_del_row(audio_file_table, pb));
                        if (ret < 0)
                                goto out;
                        pb = NULL;
                }
                /* file rename, update hs' path */
                if (flags & ADD_FLAG_VERBOSE) {
                        if (ret < 0)
                                goto out;
                        pb = NULL;
                }
                /* file rename, update hs' path */
                if (flags & ADD_FLAG_VERBOSE) {
-                       ret = osl_get_object(audio_file_table, hs,
-                               AFTCOL_PATH, &obj);
+                       ret = osl(osl_get_object(audio_file_table, hs,
+                               AFTCOL_PATH, &obj));
                        if (ret < 0)
                                goto out;
                        ret = para_printf(&msg, "renamed from %s\n", (char *)obj.data);
                        if (ret < 0)
                                goto out;
                }
                        if (ret < 0)
                                goto out;
                        ret = para_printf(&msg, "renamed from %s\n", (char *)obj.data);
                        if (ret < 0)
                                goto out;
                }
-               ret = osl_update_object(audio_file_table, hs, AFTCOL_PATH,
-                       &objs[AFTCOL_PATH]);
+               ret = osl(osl_update_object(audio_file_table, hs, AFTCOL_PATH,
+                       &objs[AFTCOL_PATH]));
                if (ret < 0)
                        goto out;
                afs_event(AUDIO_FILE_RENAME, &msg, hs);
                if (ret < 0)
                        goto out;
                afs_event(AUDIO_FILE_RENAME, &msg, hs);
@@ -1774,12 +1776,12 @@ static void com_add_callback(int fd, const struct osl_object *query)
                        if (ret < 0)
                                goto out;
                }
                        if (ret < 0)
                                goto out;
                }
-               ret = osl_update_object(audio_file_table, row, AFTCOL_AFHI,
-                       &objs[AFTCOL_AFHI]);
+               ret = osl(osl_update_object(audio_file_table, row, AFTCOL_AFHI,
+                       &objs[AFTCOL_AFHI]));
                if (ret < 0)
                        goto out;
                if (ret < 0)
                        goto out;
-               ret = osl_update_object(audio_file_table, row, AFTCOL_CHUNKS,
-                       &objs[AFTCOL_CHUNKS]);
+               ret = osl(osl_update_object(audio_file_table, row, AFTCOL_CHUNKS,
+                       &objs[AFTCOL_CHUNKS]));
                if (ret < 0)
                        goto out;
                afs_event(AFHI_CHANGE, &msg, row);
                if (ret < 0)
                        goto out;
                afs_event(AFHI_CHANGE, &msg, row);
@@ -1797,7 +1799,7 @@ static void com_add_callback(int fd, const struct osl_object *query)
        objs[AFTCOL_AFSI].data = &afsi_buf;
        objs[AFTCOL_AFSI].size = AFSI_SIZE;
        save_afsi(&default_afsi, &objs[AFTCOL_AFSI]);
        objs[AFTCOL_AFSI].data = &afsi_buf;
        objs[AFTCOL_AFSI].size = AFSI_SIZE;
        save_afsi(&default_afsi, &objs[AFTCOL_AFSI]);
-       ret = osl_add_and_get_row(audio_file_table, objs, &aft_row);
+       ret = osl(osl_add_and_get_row(audio_file_table, objs, &aft_row));
        afs_event(AUDIO_FILE_ADD, &msg, aft_row);
 out:
        if (ret < 0)
        afs_event(AUDIO_FILE_ADD, &msg, aft_row);
 out:
        if (ret < 0)
@@ -1860,7 +1862,7 @@ static int add_one_audio_file(const char *path, void *private_data)
        query.size = strlen(path) + 1;
        ret = send_callback_request(path_brother_callback, &query,
                get_row_pointer_from_result, &pb);
        query.size = strlen(path) + 1;
        ret = send_callback_request(path_brother_callback, &query,
                get_row_pointer_from_result, &pb);
-       if (ret < 0 && ret != -E_OSL_RB_KEY_NOT_FOUND)
+       if (ret < 0 && ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
                goto out_free;
        ret = 1;
        if (pb && (pad->flags & ADD_FLAG_LAZY)) { /* lazy is really cheap */
                goto out_free;
        ret = 1;
        if (pb && (pad->flags & ADD_FLAG_LAZY)) { /* lazy is really cheap */
@@ -2224,7 +2226,7 @@ static int remove_audio_file(__a_unused struct osl_table *table,
                        return ret;
        }
        afs_event(AUDIO_FILE_REMOVE, &crd->pb, row);
                        return ret;
        }
        afs_event(AUDIO_FILE_REMOVE, &crd->pb, row);
-       ret = osl_del_row(audio_file_table, row);
+       ret = osl(osl_del_row(audio_file_table, row));
        if (ret < 0)
                para_printf(&crd->pb, "%s: %s\n", name, para_strerror(-ret));
        else
        if (ret < 0)
                para_printf(&crd->pb, "%s: %s\n", name, para_strerror(-ret));
        else
@@ -2563,7 +2565,7 @@ static int aft_open(const char *dir)
        int ret;
 
        audio_file_table_desc.dir = dir;
        int ret;
 
        audio_file_table_desc.dir = dir;
-       ret = osl_open_table(&audio_file_table_desc, &audio_file_table);
+       ret = osl(osl_open_table(&audio_file_table_desc, &audio_file_table));
        if (ret >= 0) {
                unsigned num;
                osl_get_num_rows(audio_file_table, &num);
        if (ret >= 0) {
                unsigned num;
                osl_get_num_rows(audio_file_table, &num);
@@ -2580,7 +2582,7 @@ static int aft_open(const char *dir)
 static int aft_create(const char *dir)
 {
        audio_file_table_desc.dir = dir;
 static int aft_create(const char *dir)
 {
        audio_file_table_desc.dir = dir;
-       return osl_create_table(&audio_file_table_desc);
+       return osl(osl_create_table(&audio_file_table_desc));
 }
 
 static int clear_attribute(struct osl_row *row, void *data)
 }
 
 static int clear_attribute(struct osl_row *row, void *data)
index ec2eae73ab9c59297bd0d0df14062579ff06e26b..4784aee96caef2cf6f2a2e809b4998bcc446aa69 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 /** \file attribute.c Attribute handling functions. */
  */
 
 /** \file attribute.c Attribute handling functions. */
+#include <osl.h>
 #include "para.h"
 #include "error.h"
 #include "string.h"
 #include "para.h"
 #include "error.h"
 #include "string.h"
@@ -89,11 +90,11 @@ int get_attribute_bitnum_by_name(const char *att_name, unsigned char *bitnum)
        struct osl_object obj = {.data = (char *)att_name,
                .size = strlen(att_name) + 1};
        struct osl_row *row;
        struct osl_object obj = {.data = (char *)att_name,
                .size = strlen(att_name) + 1};
        struct osl_row *row;
-       int ret = osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row);
+       int ret = osl(osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row));
 
        if (ret < 0)
                return ret;
 
        if (ret < 0)
                return ret;
-       ret = osl_get_object(attribute_table, row, ATTCOL_BITNUM, &obj);
+       ret = osl(osl_get_object(attribute_table, row, ATTCOL_BITNUM, &obj));
        if (ret < 0)
                return ret;
        *bitnum = *(unsigned char *)obj.data;
        if (ret < 0)
                return ret;
        *bitnum = *(unsigned char *)obj.data;
@@ -131,7 +132,7 @@ static int print_attribute(struct osl_table *table, struct osl_row *row,
 
        if (!(laad->flags & LSATT_FLAG_LONG))
                return para_printf(&laad->pb, "%s\n", name);
 
        if (!(laad->flags & LSATT_FLAG_LONG))
                return para_printf(&laad->pb, "%s\n", name);
-       ret = osl_get_object(table, row, ATTCOL_BITNUM, &bitnum_obj);
+       ret = osl(osl_get_object(table, row, ATTCOL_BITNUM, &bitnum_obj));
        if (ret < 0) {
                para_printf(&laad->pb, "%s: %s\n", name, para_strerror(-ret));
                return ret;
        if (ret < 0) {
                para_printf(&laad->pb, "%s: %s\n", name, para_strerror(-ret));
                return ret;
@@ -230,11 +231,11 @@ static void com_setatt_callback(__a_unused int fd, const struct osl_object *quer
                p[len - 1] = '\0';
                obj.data = p;
                obj.size = len + 1;
                p[len - 1] = '\0';
                obj.data = p;
                obj.size = len + 1;
-               ret = osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row);
+               ret = osl(osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row));
                if (ret < 0)
                        goto out;
                if (ret < 0)
                        goto out;
-               ret = osl_get_object(attribute_table, row, ATTCOL_BITNUM,
-                       &obj);
+               ret = osl(osl_get_object(attribute_table, row, ATTCOL_BITNUM,
+                       &obj));
                if (ret < 0)
                        goto out;
                if (c == '+')
                if (ret < 0)
                        goto out;
                if (c == '+')
@@ -317,15 +318,15 @@ static void com_addatt_callback(int fd, const struct osl_object *query)
                                goto out;
                        continue;
                }
                                goto out;
                        continue;
                }
-               if (ret != -E_OSL_RB_KEY_NOT_FOUND) /* error */
+               if (ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND)) /* error */
                        goto out;
                objs[ATTCOL_BITNUM].size = 1;
                /* find smallest unused attribute */
                for (bitnum = 0; bitnum < 64; bitnum++) {
                        objs[ATTCOL_BITNUM].data = &bitnum;
                        goto out;
                objs[ATTCOL_BITNUM].size = 1;
                /* find smallest unused attribute */
                for (bitnum = 0; bitnum < 64; bitnum++) {
                        objs[ATTCOL_BITNUM].data = &bitnum;
-                       ret = osl_get_row(attribute_table, ATTCOL_BITNUM,
-                               &objs[ATTCOL_BITNUM], &row);
-                       if (ret == -E_OSL_RB_KEY_NOT_FOUND)
+                       ret = osl(osl_get_row(attribute_table, ATTCOL_BITNUM,
+                               &objs[ATTCOL_BITNUM], &row));
+                       if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
                                break; /* this bitnum is unused, use it */
                        if (ret < 0) /* error */
                                goto out;
                                break; /* this bitnum is unused, use it */
                        if (ret < 0) /* error */
                                goto out;
@@ -337,7 +338,7 @@ static void com_addatt_callback(int fd, const struct osl_object *query)
                }
                objs[ATTCOL_NAME].data = p;
                objs[ATTCOL_NAME].size = len + 1;
                }
                objs[ATTCOL_NAME].data = p;
                objs[ATTCOL_NAME].size = len + 1;
-               ret = osl_add_row(attribute_table, objs);
+               ret = osl(osl_add_row(attribute_table, objs));
                if (ret < 0)
                        goto out;
                aed.name = p;
                if (ret < 0)
                        goto out;
                aed.name = p;
@@ -380,12 +381,12 @@ static void com_mvatt_callback(int fd, const struct osl_object *query)
        };
        int ret;
 
        };
        int ret;
 
-       ret = osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row);
+       ret = osl(osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row));
        if (ret < 0)
                goto out;
        obj.data = new;
        obj.size = strlen(new) + 1;
        if (ret < 0)
                goto out;
        obj.data = new;
        obj.size = strlen(new) + 1;
-       ret = osl_update_object(attribute_table, row, ATTCOL_NAME, &obj);
+       ret = osl(osl_update_object(attribute_table, row, ATTCOL_NAME, &obj));
 out:
        if (ret < 0)
                para_printf(&pb, "%s\n", para_strerror(-ret));
 out:
        if (ret < 0)
                para_printf(&pb, "%s\n", para_strerror(-ret));
@@ -429,7 +430,7 @@ static int remove_attribute(struct osl_table *table, struct osl_row *row,
        ret = get_attribute_bitnum_by_name(name, &red.bitnum);
        if (ret < 0)
                return para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
        ret = get_attribute_bitnum_by_name(name, &red.bitnum);
        if (ret < 0)
                return para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
-       ret = osl_del_row(table, row);
+       ret = osl(osl_del_row(table, row));
        if (ret < 0)
                return para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
        ret = para_printf(&raad->pb, "removed attribute %s\n", name);
        if (ret < 0)
                return para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
        ret = para_printf(&raad->pb, "removed attribute %s\n", name);
@@ -533,10 +534,10 @@ int get_attribute_text(uint64_t *atts, const char *delim, char **text)
 
                if (!(*atts & (one << i)))
                        continue;
 
                if (!(*atts & (one << i)))
                        continue;
-               ret = osl_get_row(attribute_table, ATTCOL_BITNUM, &obj, &row);
+               ret = osl(osl_get_row(attribute_table, ATTCOL_BITNUM, &obj, &row));
                if (ret < 0)
                        goto err;
                if (ret < 0)
                        goto err;
-               ret = osl_get_object(attribute_table, row, ATTCOL_NAME, &obj);
+               ret = osl(osl_get_object(attribute_table, row, ATTCOL_NAME, &obj));
                if (ret < 0)
                        goto err;
                if (*text) {
                if (ret < 0)
                        goto err;
                if (*text) {
@@ -579,7 +580,7 @@ static int attribute_open(const char *dir)
        int ret;
 
        attribute_table_desc.dir = dir;
        int ret;
 
        attribute_table_desc.dir = dir;
-       ret = osl_open_table(&attribute_table_desc, &attribute_table);
+       ret = osl(osl_open_table(&attribute_table_desc, &attribute_table));
        greatest_att_bitnum = -1; /* no atts available */
        if (ret >= 0) {
                find_greatest_att_bitnum();
        greatest_att_bitnum = -1; /* no atts available */
        if (ret >= 0) {
                find_greatest_att_bitnum();
@@ -594,7 +595,7 @@ static int attribute_open(const char *dir)
 static int attribute_create(const char *dir)
 {
        attribute_table_desc.dir = dir;
 static int attribute_create(const char *dir)
 {
        attribute_table_desc.dir = dir;
-       return osl_create_table(&attribute_table_desc);
+       return osl(osl_create_table(&attribute_table_desc));
 }
 
 /**
 }
 
 /**
diff --git a/blob.c b/blob.c
index 5ac35895bc57a34a11201afdd9bb99e998ef595f..f635eb0df3230904bdd1be1ebbef07ce7221a4b0 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -7,6 +7,7 @@
 /** \file blob.c Macros and functions for blob handling. */
 
 #include <fnmatch.h>
 /** \file blob.c Macros and functions for blob handling. */
 
 #include <fnmatch.h>
+#include <osl.h>
 #include "para.h"
 #include "error.h"
 #include "string.h"
 #include "para.h"
 #include "error.h"
 #include "string.h"
@@ -94,7 +95,7 @@ static int print_blob(struct osl_table *table, struct osl_row *row,
 
        if (!(lbad->flags & BLOB_LS_FLAG_LONG))
                return para_printf(&lbad->pb, "%s\n", name);
 
        if (!(lbad->flags & BLOB_LS_FLAG_LONG))
                return para_printf(&lbad->pb, "%s\n", name);
-       ret = osl_get_object(table, row, BLOBCOL_ID, &obj);
+       ret = osl(osl_get_object(table, row, BLOBCOL_ID, &obj));
        if (ret < 0) {
                para_printf(&lbad->pb, "%s: %s\n", name, para_strerror(-ret));
                return ret;
        if (ret < 0) {
                para_printf(&lbad->pb, "%s: %s\n", name, para_strerror(-ret));
                return ret;
@@ -179,12 +180,12 @@ static int cat_blob(struct osl_table *table, struct osl_row *row,
        int ret = 0, ret2;
        struct osl_object obj;
 
        int ret = 0, ret2;
        struct osl_object obj;
 
-       ret = osl_open_disk_object(table, row, BLOBCOL_DEF, &obj);
+       ret = osl(osl_open_disk_object(table, row, BLOBCOL_DEF, &obj));
        if (ret < 0)
                return ret;
        if (obj.size)
                ret = pass_buffer_as_shm(obj.data, obj.size, data);
        if (ret < 0)
                return ret;
        if (obj.size)
                ret = pass_buffer_as_shm(obj.data, obj.size, data);
-       ret2 = osl_close_disk_object(&obj);
+       ret2 = osl(osl_close_disk_object(&obj));
        return (ret < 0)? ret : ret2;
 }
 
        return (ret < 0)? ret : ret2;
 }
 
@@ -223,7 +224,7 @@ static int remove_blob(struct osl_table *table, struct osl_row *row,
                const char *name, void *data)
 {
        struct rmblob_data *rmbd = data;
                const char *name, void *data)
 {
        struct rmblob_data *rmbd = data;
-       int ret = osl_del_row(table, row);
+       int ret = osl(osl_del_row(table, row));
        if (ret < 0) {
                para_printf(&rmbd->pb, "%s: %s\n", name, para_strerror(-ret));
                return ret;
        if (ret < 0) {
                para_printf(&rmbd->pb, "%s: %s\n", name, para_strerror(-ret));
                return ret;
@@ -290,7 +291,7 @@ static void com_addblob_callback(struct osl_table *table, __a_unused int fd,
        unsigned num_rows;
        int ret;
 
        unsigned num_rows;
        int ret;
 
-       ret = osl_get_num_rows(table, &num_rows);
+       ret = osl(osl_get_num_rows(table, &num_rows));
        if (ret < 0)
                goto out;
        if (!num_rows) { /* this is the first entry ever added */
        if (ret < 0)
                goto out;
        if (!num_rows) { /* this is the first entry ever added */
@@ -302,34 +303,34 @@ static void com_addblob_callback(struct osl_table *table, __a_unused int fd,
                objs[BLOBCOL_NAME].size = 1;
                objs[BLOBCOL_DEF].data = "";
                objs[BLOBCOL_DEF].size = 1;
                objs[BLOBCOL_NAME].size = 1;
                objs[BLOBCOL_DEF].data = "";
                objs[BLOBCOL_DEF].size = 1;
-               ret = osl_add_row(table, objs);
+               ret = osl(osl_add_row(table, objs));
                if (ret < 0)
                        goto out;
        } else {
                /* check if name already exists */
                struct osl_row *row;
                struct osl_object obj = {.data = name, .size = name_len};
                if (ret < 0)
                        goto out;
        } else {
                /* check if name already exists */
                struct osl_row *row;
                struct osl_object obj = {.data = name, .size = name_len};
-               ret = osl_get_row(table, BLOBCOL_NAME, &obj, &row);
-               if (ret < 0 && ret != -E_OSL_RB_KEY_NOT_FOUND)
+               ret = osl(osl_get_row(table, BLOBCOL_NAME, &obj, &row));
+               if (ret < 0 && ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
                        goto out;
                if (ret >= 0) { /* we already have a blob with this name */
                        obj.data = name + name_len;
                        obj.size = query->size - name_len;
                        goto out;
                if (ret >= 0) { /* we already have a blob with this name */
                        obj.data = name + name_len;
                        obj.size = query->size - name_len;
-                       ret = osl_update_object(table, row, BLOBCOL_DEF, &obj);
+                       ret = osl(osl_update_object(table, row, BLOBCOL_DEF, &obj));
                        goto out;
                }
                /* new blob, get id of the dummy row and increment it */
                obj.data = "";
                obj.size = 1;
                        goto out;
                }
                /* new blob, get id of the dummy row and increment it */
                obj.data = "";
                obj.size = 1;
-               ret = osl_get_row(table, BLOBCOL_NAME, &obj, &row);
+               ret = osl(osl_get_row(table, BLOBCOL_NAME, &obj, &row));
                if (ret < 0)
                        goto out;
                if (ret < 0)
                        goto out;
-               ret = osl_get_object(table, row, BLOBCOL_ID, &obj);
+               ret = osl(osl_get_object(table, row, BLOBCOL_ID, &obj));
                if (ret < 0)
                        goto out;
                id = *(uint32_t *)obj.data + 1;
                obj.data = &id;
                if (ret < 0)
                        goto out;
                id = *(uint32_t *)obj.data + 1;
                obj.data = &id;
-               ret = osl_update_object(table, row, BLOBCOL_ID, &obj);
+               ret = osl(osl_update_object(table, row, BLOBCOL_ID, &obj));
                if (ret < 0)
                        goto out;
        }
                if (ret < 0)
                        goto out;
        }
@@ -340,7 +341,7 @@ static void com_addblob_callback(struct osl_table *table, __a_unused int fd,
        objs[BLOBCOL_NAME].size = name_len;
        objs[BLOBCOL_DEF].data = name + name_len;
        objs[BLOBCOL_DEF].size = query->size - name_len;
        objs[BLOBCOL_NAME].size = name_len;
        objs[BLOBCOL_DEF].data = name + name_len;
        objs[BLOBCOL_DEF].size = query->size - name_len;
-       ret = osl_add_row(table, objs);
+       ret = osl(osl_add_row(table, objs));
        if (ret < 0)
                goto out;
        afs_event(BLOB_ADD, NULL, table);
        if (ret < 0)
                goto out;
        afs_event(BLOB_ADD, NULL, table);
@@ -371,13 +372,13 @@ static void com_mvblob_callback(struct osl_table *table, __a_unused int fd,
        struct osl_object obj = {.data = src, .size = strlen(src) + 1};
        char *dest = src + obj.size;
        struct osl_row *row;
        struct osl_object obj = {.data = src, .size = strlen(src) + 1};
        char *dest = src + obj.size;
        struct osl_row *row;
-       int ret = osl_get_row(table, BLOBCOL_NAME, &obj, &row);
+       int ret = osl(osl_get_row(table, BLOBCOL_NAME, &obj, &row));
 
        if (ret < 0)
                goto out;
        obj.data = dest;
        obj.size = strlen(dest) + 1;
 
        if (ret < 0)
                goto out;
        obj.data = dest;
        obj.size = strlen(dest) + 1;
-       ret = osl_update_object(table, row, BLOBCOL_NAME, &obj);
+       ret = osl(osl_update_object(table, row, BLOBCOL_NAME, &obj));
        if (ret < 0)
                goto out;
        afs_event(BLOB_RENAME, NULL, table);
        if (ret < 0)
                goto out;
        afs_event(BLOB_RENAME, NULL, table);
@@ -415,10 +416,10 @@ static int blob_get_name_by_id(struct osl_table *table, uint32_t id,
        *name = NULL;
        if (!id)
                return 1;
        *name = NULL;
        if (!id)
                return 1;
-       ret = osl_get_row(table, BLOBCOL_ID, &obj, &row);
+       ret = osl(osl_get_row(table, BLOBCOL_ID, &obj, &row));
        if (ret < 0)
                return ret;
        if (ret < 0)
                return ret;
-       ret = osl_get_object(table, row, BLOBCOL_NAME, &obj);
+       ret = osl(osl_get_object(table, row, BLOBCOL_NAME, &obj));
        if (ret < 0)
                return ret;
        *name = (char *)obj.data;
        if (ret < 0)
                return ret;
        *name = (char *)obj.data;
@@ -443,10 +444,10 @@ static int blob_get_def_by_name(struct osl_table *table, char *name,
        def->data = NULL;
        if (!*name)
                return 1;
        def->data = NULL;
        if (!*name)
                return 1;
-       ret = osl_get_row(table, BLOBCOL_NAME, &obj, &row);
+       ret = osl(osl_get_row(table, BLOBCOL_NAME, &obj, &row));
        if (ret < 0)
                return ret;
        if (ret < 0)
                return ret;
-       return osl_open_disk_object(table, row, BLOBCOL_DEF, def);
+       return osl(osl_open_disk_object(table, row, BLOBCOL_DEF, def));
 }
 
 /** Define the \p get_def_by_id function for this blob type. */
 }
 
 /** Define the \p get_def_by_id function for this blob type. */
@@ -466,10 +467,10 @@ static int blob_get_def_by_id(struct osl_table *table, uint32_t id,
        def->data = NULL;
        if (!id)
                return 1;
        def->data = NULL;
        if (!id)
                return 1;
-       ret = osl_get_row(table, BLOBCOL_ID, &obj, &row);
+       ret = osl(osl_get_row(table, BLOBCOL_ID, &obj, &row));
        if (ret < 0)
                return ret;
        if (ret < 0)
                return ret;
-       return osl_open_disk_object(table, row, BLOBCOL_DEF, def);
+       return osl(osl_open_disk_object(table, row, BLOBCOL_DEF, def));
 }
 
 /** Define the \p get_def_by_id function for this blob type. */
 }
 
 /** Define the \p get_def_by_id function for this blob type. */
@@ -483,11 +484,11 @@ static int blob_get_name_and_def_by_row(struct osl_table *table,
                const struct osl_row *row, char **name, struct osl_object *def)
 {
        struct osl_object obj;
                const struct osl_row *row, char **name, struct osl_object *def)
 {
        struct osl_object obj;
-       int ret = osl_get_object(table, row, BLOBCOL_NAME, &obj);
+       int ret = osl(osl_get_object(table, row, BLOBCOL_NAME, &obj));
        if (ret < 0)
                return ret;
        *name = obj.data;
        if (ret < 0)
                return ret;
        *name = obj.data;
-       return osl_open_disk_object(table, row, BLOBCOL_DEF, def);
+       return osl(osl_open_disk_object(table, row, BLOBCOL_DEF, def));
 }
 /** Define the \p get_name_and_def_by_row function for this blob type. */
 #define DEFINE_GET_NAME_AND_DEF_BY_ROW(table_name, cmd_prefix) \
 }
 /** Define the \p get_name_and_def_by_row function for this blob type. */
 #define DEFINE_GET_NAME_AND_DEF_BY_ROW(table_name, cmd_prefix) \
@@ -520,7 +521,7 @@ static int blob_open(struct osl_table **table,
 {
        int ret;
        desc->dir = dir;
 {
        int ret;
        desc->dir = dir;
-       ret = osl_open_table(desc, table);
+       ret = osl(osl_open_table(desc, table));
        if (ret >= 0)
                return ret;
        *table = NULL;
        if (ret >= 0)
                return ret;
        *table = NULL;
index 1ca54da90191fd270c98b3001d16a4b5f5c04c53..603715b4442006650317d0320d3475eadb6bf760 100644 (file)
--- a/command.c
+++ b/command.c
@@ -11,6 +11,7 @@
 #include <sys/types.h>
 #include <dirent.h>
 #include <openssl/rc4.h>
 #include <sys/types.h>
 #include <dirent.h>
 #include <openssl/rc4.h>
+#include <osl.h>
 
 #include "para.h"
 #include "error.h"
 
 #include "para.h"
 #include "error.h"
index 9b72b7c90e089f6b09f711094634f69f826df3ab..1e62d289538ad52cb2325dfd262bb59687eeb15e 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <sys/types.h>
 #include <dirent.h>
 
 #include <sys/types.h>
 #include <dirent.h>
+#include <osl.h>
 
 #include "para.h"
 #include "error.h"
 
 #include "para.h"
 #include "error.h"
diff --git a/error.h b/error.h
index ba18c6dcf81382f4fb4bccaa090704857c6cc9fe..fb46ec548714c6e30ddcc01f2cd891ad1fd9f419 100644 (file)
--- a/error.h
+++ b/error.h
@@ -6,8 +6,6 @@
 
 /** \file error.h List of error messages for all subsystems. */
 
 
 /** \file error.h List of error messages for all subsystems. */
 
-#include <osl.h>
-
 /** \cond */
 
 /* List of all subsystems that use paraslash's error facility. */
 /** \cond */
 
 /* List of all subsystems that use paraslash's error facility. */
@@ -483,8 +481,10 @@ _static_inline_ int is_errno(int num, int _errno)
 _static_inline_ const char *para_strerror(int num)
 {
        assert(num > 0);
 _static_inline_ const char *para_strerror(int num)
 {
        assert(num > 0);
+#ifdef _OSL_H
        if (IS_OSL_ERROR(num))
                return osl_strerror(num & ((1 << OSL_ERROR_BIT) - 1));
        if (IS_OSL_ERROR(num))
                return osl_strerror(num & ((1 << OSL_ERROR_BIT) - 1));
+#endif
        if (IS_SYSTEM_ERROR(num))
                return strerror(num & ((1 << SYSTEM_ERROR_BIT) - 1));
        return para_errlist[ERRNUM_TO_SS(num)][ERRNUM_TO_INDEX(num)];
        if (IS_SYSTEM_ERROR(num))
                return strerror(num & ((1 << SYSTEM_ERROR_BIT) - 1));
        return para_errlist[ERRNUM_TO_SS(num)][ERRNUM_TO_INDEX(num)];
@@ -496,10 +496,10 @@ _static_inline_ const char *para_strerror(int num)
  * \param ret The return value of an osl library function.
  *
  * This should be used for all calls to osl functions that return an osl error
  * \param ret The return value of an osl library function.
  *
  * This should be used for all calls to osl functions that return an osl error
- * code. It changes the return value to \p -E_OSL appropriately so that it can
- * be used for printing the correct error message.
+ * code. It changes the return value appropriately so that it can be used for
+ * printing the correct error message vi para_strerror().
  *
  *
- * \return \a ret if \a ret >= 0, \p -E_OSL otherwise.
+ * \return \a ret if \a ret >= 0, a paraslash error code otherwise.
  */
 _static_inline_ int osl(int ret)
 {
  */
 _static_inline_ int osl(int ret)
 {
@@ -508,7 +508,6 @@ _static_inline_ int osl(int ret)
        return OSL_ERRNO_TO_PARA_ERROR(-ret);
 }
 
        return OSL_ERRNO_TO_PARA_ERROR(-ret);
 }
 
-
 /**
  * Define the error list for one subsystem.
  #
 /**
  * Define the error list for one subsystem.
  #
index 5b98bbf4522c71d76a81d77e3de69f0545371ed0..feb1a84233ee67ff03e537c97f14cc0d9abb44e8 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <sys/types.h>
 #include <dirent.h>
 
 #include <sys/types.h>
 #include <dirent.h>
+#include <osl.h>
 
 #include "para.h"
 #include "error.h"
 
 #include "para.h"
 #include "error.h"
diff --git a/mood.c b/mood.c
index 540d0c70bc7d20b0951e0dffa5deb10c7394104c..feeae8bdcb1e9a6a7026be1b1de32b75643b37ac 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -7,6 +7,7 @@
 /** \file mood.c Paraslash's mood handling functions. */
 
 #include <fnmatch.h>
 /** \file mood.c Paraslash's mood handling functions. */
 
 #include <fnmatch.h>
+#include <osl.h>
 #include "para.h"
 #include "error.h"
 #include "string.h"
 #include "para.h"
 #include "error.h"
 #include "string.h"
@@ -972,7 +973,7 @@ int change_current_mood(char *mood_name)
                        .data = mood_name,
                        .size = strlen(mood_name) + 1
                };
                        .data = mood_name,
                        .size = strlen(mood_name) + 1
                };
-               ret = osl_get_row(moods_table, BLOBCOL_NAME, &obj, &row);
+               ret = osl(osl_get_row(moods_table, BLOBCOL_NAME, &obj, &row));
                if (ret < 0) {
                        PARA_NOTICE_LOG("no such mood: %s\n", mood_name);
                        return ret;
                if (ret < 0) {
                        PARA_NOTICE_LOG("no such mood: %s\n", mood_name);
                        return ret;
index 2d18d5e5de7df641f6cbe7b7ad937cb3f2d69e3e..969a230c8d5172bb5a0fe73e8c64eb23aea9230b 100644 (file)
--- a/mp3_afh.c
+++ b/mp3_afh.c
@@ -16,6 +16,7 @@
  *                      Johannes Overmann <overmann@iname.com>
  */
 
  *                      Johannes Overmann <overmann@iname.com>
  */
 
+#include <osl.h>
 #include "para.h"
 #include "error.h"
 #include "afh.h"
 #include "para.h"
 #include "error.h"
 #include "afh.h"
index 55cf4ced1b50b1d9661eb9590abcd90105351f81..40aa6b64e9e81d58345ee4039ca68cc6a466c764 100644 (file)
--- a/ogg_afh.c
+++ b/ogg_afh.c
@@ -9,6 +9,7 @@
 #include <ogg/ogg.h>
 #include <vorbis/codec.h>
 #include <vorbis/vorbisfile.h>
 #include <ogg/ogg.h>
 #include <vorbis/codec.h>
 #include <vorbis/vorbisfile.h>
+#include <osl.h>
 
 #include "para.h"
 #include "afh.h"
 
 #include "para.h"
 #include "afh.h"
index a9925cd3079a341135d398a664e167691d1406c6..d1e16f8e131814f5c70b53239b747077f65d0c1e 100644 (file)
@@ -4,6 +4,7 @@
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
+#include <osl.h>
 #include "para.h"
 #include "error.h"
 #include "string.h"
 #include "para.h"
 #include "error.h"
 #include "string.h"
@@ -174,7 +175,7 @@ int playlist_open(char *name)
 
        obj.data = name;
        obj.size = strlen(obj.data);
 
        obj.data = name;
        obj.size = strlen(obj.data);
-       ret = osl_get_row(playlists_table, BLOBCOL_NAME, &obj, &row);
+       ret = osl(osl_get_row(playlists_table, BLOBCOL_NAME, &obj, &row));
        if (ret < 0) {
                PARA_NOTICE_LOG("failed to load playlist %s\n", name);
                return ret;
        if (ret < 0) {
                PARA_NOTICE_LOG("failed to load playlist %s\n", name);
                return ret;
diff --git a/score.c b/score.c
index 89a0fbe9cb61fa89ad67e3ecd2d1f5518b5029e3..3557b042a31e5d84df636062cb54c15cd04ebe3c 100644 (file)
--- a/score.c
+++ b/score.c
@@ -5,6 +5,7 @@
  */
 
 /** \file score.c Scoring functions to determine the audio file streaming order. */
  */
 
 /** \file score.c Scoring functions to determine the audio file streaming order. */
+#include <osl.h>
 #include "para.h"
 #include "error.h"
 #include "string.h"
 #include "para.h"
 #include "error.h"
 #include "string.h"
@@ -93,7 +94,7 @@ static struct osl_table_description score_table_desc = {
  */
 int get_num_admissible_files(unsigned *num)
 {
  */
 int get_num_admissible_files(unsigned *num)
 {
-       return osl_get_num_rows(score_table, num);
+       return osl(osl_get_num_rows(score_table, num));
 }
 
 /**
 }
 
 /**
@@ -109,7 +110,7 @@ int get_num_admissible_files(unsigned *num)
 static int get_score_of_row(void *score_row, long *score)
 {
        struct osl_object obj;
 static int get_score_of_row(void *score_row, long *score)
 {
        struct osl_object obj;
-       int ret = osl_get_object(score_table, score_row, SCORECOL_SCORE, &obj);
+       int ret = osl(osl_get_object(score_table, score_row, SCORECOL_SCORE, &obj));
 
        if (ret >= 0)
                *score = *(long *)obj.data;
 
        if (ret >= 0)
                *score = *(long *)obj.data;
@@ -141,7 +142,7 @@ int score_add(const struct osl_row *aft_row, long score)
        *(int *)(score_objs[SCORECOL_SCORE].data) = score;
 
 //     PARA_DEBUG_LOG("adding %p\n", *(void **) (score_objs[SCORECOL_AFT_ROW].data));
        *(int *)(score_objs[SCORECOL_SCORE].data) = score;
 
 //     PARA_DEBUG_LOG("adding %p\n", *(void **) (score_objs[SCORECOL_AFT_ROW].data));
-       ret = osl_add_row(score_table, score_objs);
+       ret = osl(osl_add_row(score_table, score_objs));
        if (ret < 0) {
                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
                free(score_objs[SCORECOL_SCORE].data);
        if (ret < 0) {
                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
                free(score_objs[SCORECOL_SCORE].data);
@@ -152,7 +153,7 @@ int score_add(const struct osl_row *aft_row, long score)
 static int get_nth_score(unsigned n, long *score)
 {
        struct osl_row *row;
 static int get_nth_score(unsigned n, long *score)
 {
        struct osl_row *row;
-       int ret = osl_get_nth_row(score_table, SCORECOL_SCORE, n, &row);
+       int ret = osl(osl_get_nth_row(score_table, SCORECOL_SCORE, n, &row));
 
        if (ret < 0)
                return ret;
 
        if (ret < 0)
                return ret;
@@ -180,9 +181,9 @@ int score_update(const struct osl_row *aft_row, long percent)
        unsigned n, new_pos;
        struct osl_object obj = {.data = (struct osl_row *)aft_row,
                .size = sizeof(aft_row)};
        unsigned n, new_pos;
        struct osl_object obj = {.data = (struct osl_row *)aft_row,
                .size = sizeof(aft_row)};
-       int ret = osl_get_row(score_table, SCORECOL_AFT_ROW, &obj, &row);
+       int ret = osl(osl_get_row(score_table, SCORECOL_AFT_ROW, &obj, &row));
 
 
-       if (ret == -E_OSL_RB_KEY_NOT_FOUND) /* not an error */
+       if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND)) /* not an error */
                return 1;
        if (ret < 0)
                return ret;
                return 1;
        if (ret < 0)
                return ret;
@@ -198,7 +199,7 @@ int score_update(const struct osl_row *aft_row, long percent)
        obj.data = para_malloc(obj.size);
        *(long *)obj.data = new_score;
        PARA_DEBUG_LOG("new score: %ld, rank %u/%u\n", new_score, new_pos, n);
        obj.data = para_malloc(obj.size);
        *(long *)obj.data = new_score;
        PARA_DEBUG_LOG("new score: %ld, rank %u/%u\n", new_score, new_pos, n);
-       return osl_update_object(score_table, row, SCORECOL_SCORE, &obj);
+       return osl(osl_update_object(score_table, row, SCORECOL_SCORE, &obj));
 }
 
 /**
 }
 
 /**
@@ -219,7 +220,7 @@ int get_score_and_aft_row(struct osl_row *score_row, long *score,
 
        if (ret < 0)
                return ret;
 
        if (ret < 0)
                return ret;
-       ret = osl_get_object(score_table, score_row, SCORECOL_AFT_ROW, &obj);
+       ret = osl(osl_get_object(score_table, score_row, SCORECOL_AFT_ROW, &obj));
        if (ret < 0)
                return ret;
        *aft_row = obj.data;
        if (ret < 0)
                return ret;
        *aft_row = obj.data;
@@ -231,8 +232,7 @@ static int get_score_row_from_aft_row(const struct osl_row *aft_row,
 {
        struct osl_object obj = {.data = (struct osl_row *)aft_row,
                .size = sizeof(aft_row)};
 {
        struct osl_object obj = {.data = (struct osl_row *)aft_row,
                .size = sizeof(aft_row)};
-       return osl_get_row(score_table, SCORECOL_AFT_ROW, &obj, score_row);
-
+       return osl(osl_get_row(score_table, SCORECOL_AFT_ROW, &obj, score_row));
 }
 
 /**
 }
 
 /**
@@ -250,7 +250,7 @@ static int get_score_row_from_aft_row(const struct osl_row *aft_row,
  */
 int admissible_file_loop(void *data, osl_rbtree_loop_func *func)
 {
  */
 int admissible_file_loop(void *data, osl_rbtree_loop_func *func)
 {
-       return osl_rbtree_loop(score_table, SCORECOL_SCORE, data, func);
+       return osl(osl_rbtree_loop(score_table, SCORECOL_SCORE, data, func));
 }
 
 /**
 }
 
 /**
@@ -265,7 +265,7 @@ int admissible_file_loop(void *data, osl_rbtree_loop_func *func)
  */
 int admissible_file_loop_reverse(void *data, osl_rbtree_loop_func *func)
 {
  */
 int admissible_file_loop_reverse(void *data, osl_rbtree_loop_func *func)
 {
-       return osl_rbtree_loop_reverse(score_table, SCORECOL_SCORE, data, func);
+       return osl(osl_rbtree_loop_reverse(score_table, SCORECOL_SCORE, data, func));
 }
 
 /**
 }
 
 /**
@@ -281,11 +281,11 @@ int score_get_best(struct osl_row **aft_row, long *score)
 {
        struct osl_row *row;
        struct osl_object obj;
 {
        struct osl_row *row;
        struct osl_object obj;
-       int ret = osl_rbtree_last_row(score_table, SCORECOL_SCORE, &row);
+       int ret = osl(osl_rbtree_last_row(score_table, SCORECOL_SCORE, &row));
 
        if (ret < 0)
                return ret;
 
        if (ret < 0)
                return ret;
-       ret = osl_get_object(score_table, row, SCORECOL_AFT_ROW, &obj);
+       ret = osl(osl_get_object(score_table, row, SCORECOL_AFT_ROW, &obj));
        if (ret < 0)
                return ret;
        *aft_row = obj.data;
        if (ret < 0)
                return ret;
        *aft_row = obj.data;
@@ -309,7 +309,7 @@ int score_delete(const struct osl_row *aft_row)
 
        if (ret < 0)
                return ret;
 
        if (ret < 0)
                return ret;
-       return osl_del_row(score_table, score_row);
+       return osl(osl_del_row(score_table, score_row));
 }
 
 /**
 }
 
 /**
@@ -327,13 +327,13 @@ int row_belongs_to_score_table(const struct osl_row *aft_row, unsigned *rank)
        struct osl_row *score_row;
        int ret = get_score_row_from_aft_row(aft_row, &score_row);
 
        struct osl_row *score_row;
        int ret = get_score_row_from_aft_row(aft_row, &score_row);
 
-       if (ret == -E_OSL_RB_KEY_NOT_FOUND)
+       if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
                return 0;
        if (ret < 0)
                return ret;
        if (!rank)
                return 1;
                return 0;
        if (ret < 0)
                return ret;
        if (!rank)
                return 1;
-       ret = osl_get_rank(score_table, score_row, SCORECOL_SCORE, rank);
+       ret = osl(osl_get_rank(score_table, score_row, SCORECOL_SCORE, rank));
        if (ret < 0)
                return ret;
        return 1;
        if (ret < 0)
                return ret;
        return 1;
@@ -356,7 +356,7 @@ static void score_close(void)
 static int score_open(__a_unused const char *dir)
 {
        score_table_desc.dir = NULL; /* this table has only volatile columns */
 static int score_open(__a_unused const char *dir)
 {
        score_table_desc.dir = NULL; /* this table has only volatile columns */
-       return osl_open_table(&score_table_desc, &score_table);
+       return osl(osl_open_table(&score_table_desc, &score_table));
 }
 
 /**
 }
 
 /**
index d14080ce5362a34fad78b5bc149f7738fda6875c..12d7ee1dadd5d591e185354961b0ca4dbcce1430 100644 (file)
@@ -7,6 +7,7 @@
 /** \file send_common.c Functions used by more than one paraslash sender. */
 
 #include <dirent.h>
 /** \file send_common.c Functions used by more than one paraslash sender. */
 
 #include <dirent.h>
+#include <osl.h>
 #include "para.h"
 #include "error.h"
 #include "string.h"
 #include "para.h"
 #include "error.h"
 #include "string.h"
index 2e5f5f748887f91e257f8065c134d53253f1b7af..89f1e20ff9739359bf01025f59c81d88981cce4c 100644 (file)
--- a/server.c
+++ b/server.c
@@ -65,6 +65,7 @@
 #include <signal.h>
 #include <dirent.h>
 #include <sys/time.h>
 #include <signal.h>
 #include <dirent.h>
 #include <sys/time.h>
+#include <osl.h>
 
 #include "para.h"
 #include "error.h"
 
 #include "para.h"
 #include "error.h"
index 7217c960c6597123701338aa2dfedcbcc31115b3..499af66e2addfcce8991fb21f5a0e58de4de4d6f 100644 (file)
@@ -11,6 +11,7 @@
 #include <dirent.h>
 #include <sys/socket.h>
 #include <net/if.h>
 #include <dirent.h>
 #include <sys/socket.h>
 #include <net/if.h>
+#include <osl.h>
 
 #include "server.cmdline.h"
 #include "para.h"
 
 #include "server.cmdline.h"
 #include "para.h"
diff --git a/vss.c b/vss.c
index 6304fc531d63e5dbbfca69d2bec9bcac60c419d0..da8510ee7b1dcf8babee2234bd29c851fd9babd8 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -12,6 +12,7 @@
  */
 
 #include <dirent.h>
  */
 
 #include <dirent.h>
+#include <osl.h>
 
 #include "para.h"
 #include "error.h"
 
 #include "para.h"
 #include "error.h"