Changeset 1433ecda in mainline for uspace/app/blkdump/blkdump.c


Ignore:
Timestamp:
2018-04-04T15:42:37Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2c4e1cc
Parents:
47b2d7e3
Message:

Fix cstyle: make ccheck-fix and commit only files where all the changes are good.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/blkdump/blkdump.c

    r47b2d7e3 r1433ecda  
    7979        }
    8080
    81         --argc; ++argv;
     81        --argc;
     82        ++argv;
    8283
    8384        if (str_cmp(*argv, "--toc") == 0) {
    84                 --argc; ++argv;
     85                --argc;
     86                ++argv;
    8587                toc = true;
    8688                goto devname;
     
    8890
    8991        if (str_cmp(*argv, "--relative") == 0) {
    90                 --argc; ++argv;
     92                --argc;
     93                ++argv;
    9194                relative = true;
    9295        }
    9396
    9497        if (str_cmp(*argv, "--offset") == 0) {
    95                 --argc; ++argv;
     98                --argc;
     99                ++argv;
    96100                if (*argv == NULL) {
    97101                        printf(NAME ": Error, argument missing (offset).\n");
     
    107111                }
    108112
    109                 --argc; ++argv;
     113                --argc;
     114                ++argv;
    110115        }
    111116
    112117        if (str_cmp(*argv, "--count") == 0) {
    113                 --argc; ++argv;
     118                --argc;
     119                ++argv;
    114120                if (*argv == NULL) {
    115121                        printf(NAME ": Error, argument missing (count).\n");
     
    125131                }
    126132
    127                 --argc; ++argv;
     133                --argc;
     134                ++argv;
    128135        }
    129136
     
    196203                }
    197204
    198                 printf("---- Block %" PRIuOFF64 " (at %" PRIuOFF64 ") ----\n", current, current*block_size);
     205                printf("---- Block %" PRIuOFF64 " (at %" PRIuOFF64 ") ----\n", current, current * block_size);
    199206
    200207                for (data_offset = 0; data_offset < block_size; data_offset += 16) {
    201208                        if (relative) {
    202209                                printf("%8" PRIxOFF64 ": ", (aoff64_t) data_offset);
     210                        } else {
     211                                printf("%8" PRIxOFF64 ": ", current * block_size + data_offset);
    203212                        }
    204                         else {
    205                                 printf("%8" PRIxOFF64 ": ", current*block_size + data_offset);
    206                         }
    207                         print_hex_row(data+data_offset, block_size-data_offset, 16);
     213                        print_hex_row(data + data_offset, block_size - data_offset, 16);
    208214                        printf("\n");
    209215                }
     
    238244 * Print a row of 16 bytes as commonly seen in hexadecimal dumps
    239245 */
    240 static void print_hex_row(uint8_t *data, size_t length, size_t bytes_per_row) {
     246static void print_hex_row(uint8_t *data, size_t length, size_t bytes_per_row)
     247{
    241248        size_t pos;
    242249        uint8_t b;
     
    248255        /* Print hexadecimal values */
    249256        for (pos = 0; pos < length; pos++) {
    250                 if (pos == length/2) {
     257                if (pos == length / 2) {
    251258                        printf(" ");
    252259                }
     
    256263        /* Pad with spaces if we have less than 16 bytes */
    257264        for (pos = length; pos < bytes_per_row; pos++) {
    258                 if (pos == length/2) {
     265                if (pos == length / 2) {
    259266                        printf(" ");
    260267                }
     
    264271        /* Print printable characters */
    265272        for (pos = 0; pos < length; pos++) {
    266                 if (pos == length/2) {
     273                if (pos == length / 2) {
    267274                        printf(" ");
    268275                }
     
    270277                if (b >= 32 && b < 128) {
    271278                        putchar(b);
    272                 }
    273                 else {
     279                } else {
    274280                        putchar('.');
    275281                }
Note: See TracChangeset for help on using the changeset viewer.