X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=attribute.c;h=df66c9d08de75f1013d6bc3befbe31bfc8022f8a;hp=bfb6d3f2765749be1147b430439bb78dfe3d8d8a;hb=133cbbe403c850da3efdaa6dcfc0cf55145d0aa2;hpb=49bd626084bf5f48e4d80075258b6da4703752cf diff --git a/attribute.c b/attribute.c index bfb6d3f2..df66c9d0 100644 --- a/attribute.c +++ b/attribute.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2008 Andre Noll + * Copyright (C) 1997-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -127,13 +127,13 @@ static int print_attribute(struct osl_table *table, struct osl_row *row, { struct lsatt_action_data *laad = data; struct osl_object bitnum_obj; - int ret, ret2; + int ret; if (!(laad->flags & LSATT_FLAG_LONG)) return para_printf(&laad->pb, "%s\n", name); ret = osl_get_object(table, row, ATTCOL_BITNUM, &bitnum_obj); if (ret < 0) { - ret2 = para_printf(&laad->pb, "%s: %s\n", name, para_strerror(-ret)); + para_printf(&laad->pb, "%s: %s\n", name, para_strerror(-ret)); return ret; } return para_printf(&laad->pb, "%u\t%s\n", *(unsigned char*)bitnum_obj.data, @@ -166,7 +166,7 @@ static void com_lsatt_callback(int fd, const struct osl_object *query) if (laad.flags & LSATT_FLAG_REVERSE) pmd.pm_flags |= PM_REVERSE_LOOP; for_each_matching_row(&pmd); - if (!laad.pb.offset) + if (laad.pb.offset) pass_buffer_as_shm(laad.pb.buf, laad.pb.offset, &fd); free(laad.pb.buf); } @@ -288,7 +288,7 @@ struct addatt_event_data { static void com_addatt_callback(int fd, const struct osl_object *query) { - char *p = query->data; + char *p; int ret = 1, ret2 = 0; struct para_buffer pb = { .max_size = SHMMAX, @@ -301,9 +301,9 @@ static void com_addatt_callback(int fd, const struct osl_object *query) struct osl_object objs[NUM_ATT_COLUMNS]; struct osl_row *row; unsigned char bitnum; - len = strlen(p); struct addatt_event_data aed; + len = strlen(p); if (!len || p[len - 1] == '-' || p[len - 1] == '+') { ret2 = para_printf(&pb, "invalid attribute name: %s\n", p); if (ret2 < 0) @@ -343,11 +343,11 @@ static void com_addatt_callback(int fd, const struct osl_object *query) aed.name = p; aed.bitnum = bitnum; afs_event(ATTRIBUTE_ADD, &pb, &aed); - greatest_att_bitnum = PARA_MAX(greatest_att_bitnum, bitnum); + greatest_att_bitnum = PARA_MAX(greatest_att_bitnum, (int)bitnum); } out: if (ret < 0 && ret2 >= 0) - ret = para_printf(&pb, "%s: %s\n", p, para_strerror(-ret)); + para_printf(&pb, "%s: %s\n", p, para_strerror(-ret)); if (pb.offset) pass_buffer_as_shm(pb.buf, pb.offset, &fd); free(pb.buf); @@ -388,7 +388,7 @@ static void com_mvatt_callback(int fd, const struct osl_object *query) ret = osl_update_object(attribute_table, row, ATTCOL_NAME, &obj); out: if (ret < 0) - ret = para_printf(&pb, "%s\n", para_strerror(-ret)); + para_printf(&pb, "%s\n", para_strerror(-ret)); else afs_event(ATTRIBUTE_RENAME, &pb, NULL); if (pb.offset) @@ -568,8 +568,7 @@ void attribute_close(void) /** * Open the attribute table. * - * \param ti Gets initialized by this function. - * \param db The database directory. + * \param dir The database directory. * * \return Positive on success, negative on errors. * @@ -598,10 +597,13 @@ static int attribute_create(const char *dir) return osl_create_table(&attribute_table_desc); } - +/** + * Initialize the attribute table structure. + * + * \param t The table structure to initialize. + */ void attribute_init(struct afs_table *t) { - t->name = attribute_table_desc.name; t->open = attribute_open; t->close = attribute_close; t->create = attribute_create;