From bb47949b70525a266ebc9badae1e87496001389d Mon Sep 17 00:00:00 2001 From: systemcoder Date: Sat, 21 Mar 2020 16:58:00 +0000 Subject: Fixed non mod size output --- H64E-2/h64e.c | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) (limited to 'H64E-2/h64e.c') 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_szf_ascii) { - buf2[buf2_sz] = ' '; - buf2_sz += 1; + if (buf2_szf_hex) { - buf3[buf3_sz] = ' '; - buf3_sz += 1; + if (buf1_szcolumn_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) { -- cgit v1.2.3