summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brewer <ben.brewer@codethink.co.uk>2014-05-29 11:33:20 (GMT)
committerBen Brewer <ben.brewer@codethink.co.uk>2014-06-02 10:03:00 (GMT)
commit949840e4562054b3588ae591bf7f402279126054 (patch)
tree82a2769f7fe6882812c4474cbb91281564663f61
parentd14fea7f73b1f2a96d5d4384e3bbbae98cf2965f (diff)
downloadtbdiff-949840e4562054b3588ae591bf7f402279126054.tar.gz
style: Fix alignment and whitespace issues in tbdiff-create
-rw-r--r--tbdiff/tbdiff-create.c120
1 files changed, 61 insertions, 59 deletions
diff --git a/tbdiff/tbdiff-create.c b/tbdiff/tbdiff-create.c
index 33881ed..21738a5 100644
--- a/tbdiff/tbdiff-create.c
+++ b/tbdiff/tbdiff-create.c
@@ -53,7 +53,9 @@ tbd_create_fwrite_string(FILE *stream,
}
static int
-tbd_create_fwrite_block(FILE *stream, void const *data, size_t size)
+tbd_create_fwrite_block(FILE *stream,
+ void const *data,
+ size_t size)
{
if (fwrite(&size, 1, sizeof(size), stream) != sizeof(size)) {
return TBD_ERROR(TBD_ERROR_UNABLE_TO_WRITE_STREAM);
@@ -75,8 +77,8 @@ tbd_create_fwrite_mdata_mask(FILE *stream,
}
static int
-tbd_create_fwrite_mtime(FILE *stream,
- time_t mtime)
+tbd_create_fwrite_mtime(FILE *stream,
+ time_t mtime)
{
if(tbd_write_time_t(mtime, stream) != 1)
return TBD_ERROR(TBD_ERROR_UNABLE_TO_WRITE_STREAM);
@@ -84,8 +86,8 @@ tbd_create_fwrite_mtime(FILE *stream,
}
static int
-tbd_create_fwrite_mode(FILE *stream,
- mode_t mode)
+tbd_create_fwrite_mode(FILE *stream,
+ mode_t mode)
{
if(tbd_write_mode_t(mode, stream) != 1)
return TBD_ERROR(TBD_ERROR_UNABLE_TO_WRITE_STREAM);
@@ -93,8 +95,8 @@ tbd_create_fwrite_mode(FILE *stream,
}
static int
-tbd_create_fwrite_gid(FILE *stream,
- gid_t gid)
+tbd_create_fwrite_gid(FILE *stream,
+ gid_t gid)
{
if(tbd_write_gid_t(gid, stream) != 1)
return TBD_ERROR(TBD_ERROR_UNABLE_TO_WRITE_STREAM);
@@ -102,8 +104,8 @@ tbd_create_fwrite_gid(FILE *stream,
}
static int
-tbd_create_fwrite_uid(FILE *stream,
- uid_t uid)
+tbd_create_fwrite_uid(FILE *stream,
+ uid_t uid)
{
if(tbd_write_uid_t(uid, stream) != 1)
return TBD_ERROR(TBD_ERROR_UNABLE_TO_WRITE_STREAM);
@@ -111,8 +113,8 @@ tbd_create_fwrite_uid(FILE *stream,
}
static int
-tbd_create_fwrite_dev(FILE *stream,
- uint32_t dev)
+tbd_create_fwrite_dev(FILE *stream,
+ uint32_t dev)
{
if(tbd_write_uint32_t(dev, stream) != 1)
return TBD_ERROR(TBD_ERROR_UNABLE_TO_WRITE_STREAM);
@@ -219,11 +221,11 @@ tbd_create_cmd_file_create(FILE *stream,
{
int err;
if((err = tbd_create_fwrite_cmd(stream, TBD_CMD_FILE_CREATE)) != 0 ||
- (err = tbd_create_fwrite_string(stream, f->name)) != 0 ||
- (err = tbd_create_fwrite_mtime (stream, f->mtime)) != 0 ||
- (err = tbd_create_fwrite_mode (stream, f->mode)) != 0 ||
- (err = tbd_create_fwrite_uid (stream, f->uid)) != 0 ||
- (err = tbd_create_fwrite_gid (stream, f->gid)) != 0)
+ (err = tbd_create_fwrite_string(stream, f->name)) != 0 ||
+ (err = tbd_create_fwrite_mtime (stream, f->mtime)) != 0 ||
+ (err = tbd_create_fwrite_mode (stream, f->mode)) != 0 ||
+ (err = tbd_create_fwrite_uid (stream, f->uid)) != 0 ||
+ (err = tbd_create_fwrite_gid (stream, f->gid)) != 0)
return err;
uint32_t size = f->size;
@@ -268,7 +270,7 @@ tbd_metadata_mask(tbd_stat_t *a,
}
static int
-tbd_create_cmd_file_metadata_update(FILE *stream,
+tbd_create_cmd_file_metadata_update(FILE *stream,
tbd_stat_t *a,
tbd_stat_t *b)
{
@@ -279,11 +281,11 @@ tbd_create_cmd_file_metadata_update(FILE *stream,
return 0;
/* TODO: Optimize protocol by only sending useful metadata */
if((err = tbd_create_fwrite_cmd(stream, TBD_CMD_FILE_METADATA_UPDATE)) != 0 ||
- (err = tbd_create_fwrite_mdata_mask (stream, metadata_mask)) != 0 ||
- (err = tbd_create_fwrite_mtime (stream, b->mtime)) != 0 ||
- (err = tbd_create_fwrite_uid (stream, b->uid)) != 0 ||
- (err = tbd_create_fwrite_gid (stream, b->gid)) != 0 ||
- (err = tbd_create_fwrite_mode (stream, b->mode)) != 0)
+ (err = tbd_create_fwrite_mdata_mask(stream, metadata_mask)) != 0 ||
+ (err = tbd_create_fwrite_mtime (stream, b->mtime)) != 0 ||
+ (err = tbd_create_fwrite_uid (stream, b->uid)) != 0 ||
+ (err = tbd_create_fwrite_gid (stream, b->gid)) != 0 ||
+ (err = tbd_create_fwrite_mode (stream, b->mode)) != 0)
return err;
return tbd_create_fwrite_string(stream, b->name);
@@ -398,7 +400,7 @@ tbd_create_cmd_file_delta(FILE *stream,
/* TODO: Optimize protocol by only sending useful metadata */
int err;
- if(((err = tbd_create_fwrite_cmd(stream, TBD_CMD_FILE_DELTA)) != 0) ||
+ if(((err = tbd_create_fwrite_cmd(stream, TBD_CMD_FILE_DELTA)) != 0) ||
((err = tbd_create_fwrite_string(stream, b->name)) != 0) ||
((err = tbd_create_fwrite_mdata_mask(stream, metadata_mask)) != 0) ||
((err = tbd_create_fwrite_mtime (stream, b->mtime)) != 0) ||
@@ -436,16 +438,16 @@ tbd_create_cmd_file_delta(FILE *stream,
}
static int
-tbd_create_cmd_dir_create(FILE *stream,
- tbd_stat_t *d)
+tbd_create_cmd_dir_create(FILE *stream,
+ tbd_stat_t *d)
{
int err;
if((err = tbd_create_fwrite_cmd(stream, TBD_CMD_DIR_CREATE)) != 0 ||
- (err = tbd_create_fwrite_string(stream, d->name)) != 0 ||
- (err = tbd_create_fwrite_mtime(stream, d->mtime)) != 0 ||
- (err = tbd_create_fwrite_uid(stream, d->uid)) != 0 ||
- (err = tbd_create_fwrite_gid(stream, d->gid)) != 0)
+ (err = tbd_create_fwrite_string(stream, d->name)) != 0 ||
+ (err = tbd_create_fwrite_mtime(stream, d->mtime)) != 0 ||
+ (err = tbd_create_fwrite_uid(stream, d->uid)) != 0 ||
+ (err = tbd_create_fwrite_gid(stream, d->gid)) != 0)
return err;
return tbd_create_fwrite_mode(stream, d->mode);
@@ -462,8 +464,8 @@ tbd_create_cmd_dir_enter(FILE *stream,
}
static int
-tbd_create_cmd_dir_leave(FILE *stream,
- tbd_stat_t *dir)
+tbd_create_cmd_dir_leave(FILE *stream,
+ tbd_stat_t *dir)
{
int err;
if ((err = tbd_create_fwrite_cmd(stream, TBD_CMD_DIR_LEAVE)) !=
@@ -495,7 +497,7 @@ tbd_create_cmd_dir_delta(FILE *stream,
if(metadata_mask == TBD_METADATA_NONE)
return 0;
- if((err = tbd_create_fwrite_cmd(stream, TBD_CMD_DIR_DELTA)) != 0 ||
+ if((err = tbd_create_fwrite_cmd(stream, TBD_CMD_DIR_DELTA)) != 0 ||
(err = tbd_create_fwrite_mdata_mask (stream, metadata_mask)) != 0 ||
(err = tbd_create_fwrite_mtime (stream, b->mtime)) != 0 ||
(err = tbd_create_fwrite_uid (stream, b->uid)) != 0 ||
@@ -507,8 +509,8 @@ tbd_create_cmd_dir_delta(FILE *stream,
}
static int
-tbd_create_cmd_symlink_create(FILE *stream,
- tbd_stat_t *symlink)
+tbd_create_cmd_symlink_create(FILE *stream,
+ tbd_stat_t *symlink)
{
int err;
char path[PATH_BUFFER_LENGTH];
@@ -521,19 +523,19 @@ tbd_create_cmd_symlink_create(FILE *stream,
path[len] = '\0';
if((err = tbd_create_fwrite_cmd(stream, TBD_CMD_SYMLINK_CREATE)) != 0 ||
- (err = tbd_create_fwrite_mtime (stream, symlink->mtime)) != 0 ||
- (err = tbd_create_fwrite_uid (stream, symlink->uid)) != 0 ||
- (err = tbd_create_fwrite_gid (stream, symlink->gid)) != 0 ||
- (err = tbd_create_fwrite_string(stream, symlink->name)) != 0)
+ (err = tbd_create_fwrite_mtime (stream, symlink->mtime)) != 0 ||
+ (err = tbd_create_fwrite_uid (stream, symlink->uid)) != 0 ||
+ (err = tbd_create_fwrite_gid (stream, symlink->gid)) != 0 ||
+ (err = tbd_create_fwrite_string(stream, symlink->name)) != 0)
return err;
return tbd_create_fwrite_string(stream, path);
}
static int
-tbd_create_cmd_symlink_delta(FILE *stream,
- tbd_stat_t *a,
- tbd_stat_t *b)
+tbd_create_cmd_symlink_delta(FILE *stream,
+ tbd_stat_t *a,
+ tbd_stat_t *b)
{
int err;
char path_a[PATH_BUFFER_LENGTH];
@@ -569,25 +571,25 @@ tbd_create_cmd_symlink_delta(FILE *stream,
}
static int
-tbd_create_cmd_special_create(FILE *stream,
- tbd_stat_t *nod)
+tbd_create_cmd_special_create(FILE *stream,
+ tbd_stat_t *nod)
{
int err;
if((err = tbd_create_fwrite_cmd(stream, TBD_CMD_SPECIAL_CREATE)) != 0 ||
- (err = tbd_create_fwrite_string(stream, nod->name)) != 0 ||
- (err = tbd_create_fwrite_mtime (stream, nod->mtime)) != 0 ||
- (err = tbd_create_fwrite_mode (stream, nod->mode)) != 0 ||
- (err = tbd_create_fwrite_uid (stream, nod->uid)) != 0 ||
- (err = tbd_create_fwrite_gid (stream, nod->gid)) != 0)
+ (err = tbd_create_fwrite_string(stream, nod->name)) != 0 ||
+ (err = tbd_create_fwrite_mtime (stream, nod->mtime)) != 0 ||
+ (err = tbd_create_fwrite_mode (stream, nod->mode)) != 0 ||
+ (err = tbd_create_fwrite_uid (stream, nod->uid)) != 0 ||
+ (err = tbd_create_fwrite_gid (stream, nod->gid)) != 0)
return err;
return tbd_create_fwrite_dev(stream, nod->rdev);
}
static int
-tbd_create_cmd_special_delta(FILE *stream,
- tbd_stat_t *a,
- tbd_stat_t *b)
+tbd_create_cmd_special_delta(FILE *stream,
+ tbd_stat_t *a,
+ tbd_stat_t *b)
{
uint16_t metadata_mask = tbd_metadata_mask(a, b);
if(a->rdev != b->rdev)
@@ -670,10 +672,10 @@ tbd_create_dir(FILE *stream,
}
static int
-tbd_create_impl(FILE *stream,
- tbd_stat_t *a,
- tbd_stat_t *b,
- bool top)
+tbd_create_impl(FILE *stream,
+ tbd_stat_t *a,
+ tbd_stat_t *b,
+ bool top)
{
if((a == NULL) && (b == NULL))
return TBD_ERROR(TBD_ERROR_NULL_POINTER);
@@ -757,7 +759,7 @@ tbd_create_impl(FILE *stream,
/* Handle deletions. */
for(i = 0; i < a->size; i++) {
err = 0;
-
+
tbd_stat_t *_a = tbd_stat_entry(a, i);
if(_a == NULL)
return TBD_ERROR(TBD_ERROR_UNABLE_TO_STAT_FILE);
@@ -781,9 +783,9 @@ tbd_create_impl(FILE *stream,
}
int
-tbd_create(FILE *stream,
- tbd_stat_t *a,
- tbd_stat_t *b)
+tbd_create(FILE *stream,
+ tbd_stat_t *a,
+ tbd_stat_t *b)
{
int err;
if((stream == NULL) || (a == NULL) || (b == NULL))