diff options
author | systemcoder <systemcoder@protonmail.com> | 2020-03-21 16:58:00 +0000 |
---|---|---|
committer | systemcoder <systemcoder@protonmail.com> | 2020-03-21 16:58:00 +0000 |
commit | bb47949b70525a266ebc9badae1e87496001389d (patch) | |
tree | 3bb5af5fc62b146c73f50e017415553a7ab5d7d2 /H64E-2/h64e.c | |
parent | 574f32b4573637e87584ccc5baa2c110d04853c6 (diff) | |
download | H64D-2-bb47949b70525a266ebc9badae1e87496001389d.tar.gz H64D-2-bb47949b70525a266ebc9badae1e87496001389d.zip |
Fixed non mod size output
Diffstat (limited to 'H64E-2/h64e.c')
-rw-r--r-- | H64E-2/h64e.c | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/H64E-2/h64e.c b/H64E-2/h64e.c index 0a68734..f381d89 100644 --- a/H64E-2/h64e.c +++ b/H64E-2/h64e.c @@ -185,7 +185,7 @@ int h64e_fmt_byte_align16(H64E_format *fs, uint8_t *in_data, int32_t in_size, ui { //printf("Print offset\n"); int offset = fs->start_offset + fs->total_output; - buf_offset_sz = snprintf((char *)&buf_offset[0], BUF_SZ, "%08x: ",offset); + buf_offset_sz = snprintf((char *)&buf_offset[0], BUF_SZ, "%08x: ",offset); //make it wider } if (in_size%fs->column_size != 0) @@ -206,7 +206,6 @@ int h64e_fmt_byte_align16(H64E_format *fs, uint8_t *in_data, int32_t in_size, ui //group byte output if (fs->f_hex) { - buf1_sz = snprintf((char *)&buf1[0], BUF_SZ, "%02x",in_data[i]); } @@ -241,8 +240,7 @@ int h64e_fmt_byte_align16(H64E_format *fs, uint8_t *in_data, int32_t in_size, ui } } } - - + if (fs->f_output_types) { if (fs->output_fmt == H64E_O_INT8) @@ -254,11 +252,11 @@ int h64e_fmt_byte_align16(H64E_format *fs, uint8_t *in_data, int32_t in_size, ui buf3_sz = snprintf((char *)&buf3[0], BUF_SZ, "%4u ", uu); } } - - + } else { - printf("Empty spaces\n"); + //printf("Empty spaces\n"); //group byte output string + /* if (((fs->group_fmt == H64E_G_BYTE)||(fs->group_fmt == H64E_G_NONE)) && (fs->output_fmt == H64E_O_STRING)) { buf2_sz = snprintf((char *)&buf2[0], BUF_SZ, " "); @@ -266,19 +264,39 @@ int h64e_fmt_byte_align16(H64E_format *fs, uint8_t *in_data, int32_t in_size, ui //group byte output buf2_sz = snprintf((char *)&buf2[0], BUF_SZ, " "); } + */ + if (fs->f_hex) + { + buf1_sz = snprintf((char *)&buf1[0], BUF_SZ, " "); + } + + if (fs->f_ascii) + { + buf2_sz = snprintf((char *)&buf2[0], BUF_SZ, " "); + } + if (fs->f_space) { - if (buf2_sz<BUF_SZ) + //printf("Space enabled\n"); + if (fs->f_ascii) { - buf2[buf2_sz] = ' '; - buf2_sz += 1; + if (buf2_sz<BUF_SZ) + { + buf2[buf2_sz] = ' '; + buf2_sz += 1; + } } - if (buf3_sz<BUF_SZ) + if (fs->f_hex) { - buf3[buf3_sz] = ' '; - buf3_sz += 1; + if (buf1_sz<BUF_SZ) + { + buf1[buf1_sz] = ' '; + buf1_sz += 1; + } } } + + } //count converted chars per line fs->column_pos += 1; @@ -310,7 +328,7 @@ int h64e_fmt_byte_align16(H64E_format *fs, uint8_t *in_data, int32_t in_size, ui } } - if ((fs->f_output_types==1)) + if (fs->f_output_types==1) { if (fs->f_output_types) { |