diff options
author | Ben Brewer <ben.brewer@codethink.co.uk> | 2014-05-29 11:44:45 +0100 |
---|---|---|
committer | Ben Brewer <ben.brewer@codethink.co.uk> | 2014-06-02 11:03:00 +0100 |
commit | 9bb191462e637bc97b6bcbcfe798cc254ba7a7e4 (patch) | |
tree | 0a3804c055cb396eabf49f27c5f02f0dac65a4b5 /tbdiff/tbdiff-apply.c | |
parent | e9344787030b3ba052db9f79462ffa5da3a0ee32 (diff) | |
download | tbdiff-9bb191462e637bc97b6bcbcfe798cc254ba7a7e4.tar.gz |
Create tbd_cmd_t type to for commands and use sizeof in write
Previously commands were just treated as a uint8_t and given the value of
and enum. This is now made more clear in the code by defining tbd_cmd_t as
a uint8_t below the enum in tbdiff-common.h.
Diffstat (limited to 'tbdiff/tbdiff-apply.c')
-rw-r--r-- | tbdiff/tbdiff-apply.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tbdiff/tbdiff-apply.c b/tbdiff/tbdiff-apply.c index ba2e5fc..07a9961 100644 --- a/tbdiff/tbdiff-apply.c +++ b/tbdiff/tbdiff-apply.c @@ -93,8 +93,8 @@ tbd_apply_fread_block(FILE *stream, void **data, size_t *size) static int tbd_apply_identify(FILE *stream) { - uint8_t cmd; - if(fread(&cmd, 1, 1, stream) != 1) + tbd_cmd_t cmd; + if(fread(&cmd, sizeof(tbd_cmd_t), 1, stream) != 1) return TBD_ERROR(TBD_ERROR_UNABLE_TO_READ_STREAM); if(cmd != TBD_CMD_IDENTIFY) return TBD_ERROR(TBD_ERROR_INVALID_PARAMETER); @@ -712,8 +712,8 @@ tbd_apply(FILE *stream) uintptr_t depth = 0; bool flush = false; while(!flush) { - uint8_t cmd; - if(fread(&cmd, 1, 1, stream) != 1) + tbd_cmd_t cmd; + if(fread(&cmd, sizeof(tbd_cmd_t), 1, stream) != 1) return TBD_ERROR(TBD_ERROR_UNABLE_TO_READ_STREAM); switch(cmd) { case TBD_CMD_DIR_CREATE: |