X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=aft.c;h=179777ba8c8999dc633cf8578f08951ff7dd995c;hp=1d2d6d8dae69d152df2d9db6ec05988c4cac7f5b;hb=e8ca7526ddebc98f3023736f77fa13b65034767b;hpb=73299ebf0a43f0cbf299585f0d5d6ff09e3b93eb diff --git a/aft.c b/aft.c index 1d2d6d8d..179777ba 100644 --- a/aft.c +++ b/aft.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2013 Andre Noll + * Copyright (C) 2007-2014 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -163,7 +163,7 @@ enum afsi_offsets { AFSI_SIZE = 32 }; -/** +/* * Convert a struct afs_info to an osl object. * * \param afsi Pointer to the audio file info to be converted. @@ -171,7 +171,7 @@ enum afsi_offsets { * * \sa load_afsi(). */ -void save_afsi(struct afs_info *afsi, struct osl_object *obj) +static void save_afsi(struct afs_info *afsi, struct osl_object *obj) { char *buf = obj->data; @@ -186,17 +186,17 @@ void save_afsi(struct afs_info *afsi, struct osl_object *obj) memset(buf + AFSI_AUDIO_FORMAT_UNUSED_OFFSET, 0, 2); } -/** - * Get the audio file selector info struct stored in an osl object. +/* + * Get the audio file selector info struct stored in an osl object. * * \param afsi Points to the audio_file info structure to be filled in. * \param obj The osl object holding the data. * - * \return Positive on success, negative on errors. Possible errors: \p E_BAD_AFS. + * \return Standard. * * \sa save_afsi(). */ -int load_afsi(struct afs_info *afsi, struct osl_object *obj) +static int load_afsi(struct afs_info *afsi, struct osl_object *obj) { char *buf = obj->data; if (obj->size < AFSI_SIZE) @@ -493,15 +493,16 @@ static int aft_get_row_of_hash(unsigned char *hash, struct osl_row **row) return osl(osl_get_row(audio_file_table, AFTCOL_HASH, &obj, row)); } -/** - * Get the osl object holding the audio file selector info of a row. +/* + * Get the audio file selector info object of a row. * * \param row Pointer to a row in the audio file table. * \param obj Result pointer. * * \return Standard. */ -int get_afsi_object_of_row(const struct osl_row *row, struct osl_object *obj) +static int get_afsi_object_of_row(const struct osl_row *row, + struct osl_object *obj) { return osl(osl_get_object(audio_file_table, row, AFTCOL_AFSI, obj)); } @@ -541,15 +542,15 @@ int get_afsi_of_row(const struct osl_row *row, struct afs_info *afsi) return load_afsi(afsi, &obj); } -/** +/* * Get the audio file selector info, given the path of an audio table. * * \param path The full path of the audio file. * \param afsi Result pointer. * - * \return Positive on success, negative on errors. + * \return Standard. */ -int get_afsi_of_path(const char *path, struct afs_info *afsi) +static int get_afsi_of_path(const char *path, struct afs_info *afsi) { struct osl_object obj; int ret = get_afsi_object_of_path(path, &obj); @@ -1876,12 +1877,8 @@ static int add_one_audio_file(const char *path, void *private_data) ret = 1; if (pb && (pad->flags & ADD_FLAG_LAZY)) { /* lazy is really cheap */ if (pad->flags & ADD_FLAG_VERBOSE) - send_ret = pad->cc->use_sideband? - send_sb_va(&pad->cc->scc, SBD_OUTPUT, - "lazy-ignore: %s\n", path) - : - sc_send_va_buffer(&pad->cc->scc, - "lazy-ignore: %s\n", path); + send_ret = send_sb_va(&pad->cc->scc, SBD_OUTPUT, + "lazy-ignore: %s\n", path); goto out_free; } /* We still want to add this file. Compute its hash. */ @@ -1901,12 +1898,8 @@ static int add_one_audio_file(const char *path, void *private_data) ret = 1; if (pb && hs && hs == pb && !(pad->flags & ADD_FLAG_FORCE)) { if (pad->flags & ADD_FLAG_VERBOSE) - send_ret = pad->cc->use_sideband? - send_sb_va(&pad->cc->scc, SBD_OUTPUT, - "%s exists, not forcing update\n", path) - : - sc_send_va_buffer(&pad->cc->scc, - "%s exists, not forcing update\n", path); + send_ret = send_sb_va(&pad->cc->scc, SBD_OUTPUT, + "%s exists, not forcing update\n", path); goto out_unmap; } /* @@ -1923,12 +1916,8 @@ static int add_one_audio_file(const char *path, void *private_data) munmap(map.data, map.size); close(fd); if (pad->flags & ADD_FLAG_VERBOSE) { - send_ret = pad->cc->use_sideband? - send_sb_va(&pad->cc->scc, SBD_OUTPUT, - "adding %s\n", path) - : - sc_send_va_buffer(&pad->cc->scc, - "adding %s\n", path); + send_ret = send_sb_va(&pad->cc->scc, SBD_OUTPUT, + "adding %s\n", path); if (send_ret < 0) goto out_free; } @@ -1943,14 +1932,8 @@ out_unmap: munmap(map.data, map.size); out_free: if (ret < 0 && send_ret >= 0) - send_ret = pad->cc->use_sideband? - send_sb_va(&pad->cc->scc, SBD_ERROR_LOG, - "failed to add %s (%s)\n", path, - para_strerror(-ret)) - : - sc_send_va_buffer(&pad->cc->scc, - "failed to add %s (%s)\n", path, - para_strerror(-ret)); + send_ret = send_sb_va(&pad->cc->scc, SBD_ERROR_LOG, + "failed to add %s (%s)\n", path, para_strerror(-ret)); free(obj.data); clear_afhi(afhi_ptr); /* Stop adding files only on send errors. */ @@ -1994,11 +1977,7 @@ int com_add(struct command_context *cc) char *path; ret = verify_path(cc->argv[i], &path); if (ret < 0) { - ret = cc->use_sideband? - send_sb_va(&cc->scc, SBD_ERROR_LOG, "%s: %s\n", - cc->argv[i], para_strerror(-ret)) - : - sc_send_va_buffer(&cc->scc, "%s: %s\n", + ret = send_sb_va(&cc->scc, SBD_ERROR_LOG, "%s: %s\n", cc->argv[i], para_strerror(-ret)); if (ret < 0) return ret; @@ -2006,14 +1985,9 @@ int com_add(struct command_context *cc) } ret = stat(path, &statbuf); if (ret < 0) { - ret = cc->use_sideband? - send_sb_va(&cc->scc, SBD_ERROR_LOG, - "failed to stat %s (%s)\n", path, - strerror(errno)) - : - sc_send_va_buffer(&cc->scc, - "failed to stat %s (%s)\n", path, - strerror(errno)); + ret = send_sb_va(&cc->scc, SBD_ERROR_LOG, + "failed to stat %s (%s)\n", path, + strerror(errno)); free(path); if (ret < 0) return ret; @@ -2025,12 +1999,8 @@ int com_add(struct command_context *cc) else ret = add_one_audio_file(path, &pad); if (ret < 0) { - if (cc->use_sideband) - send_sb_va(&cc->scc, SBD_OUTPUT, "%s: %s\n", path, - para_strerror(-ret)); - else - sc_send_va_buffer(&cc->scc, "%s: %s\n", path, - para_strerror(-ret)); + send_sb_va(&cc->scc, SBD_OUTPUT, "%s: %s\n", path, + para_strerror(-ret)); free(path); return ret; }