From 6abd917945951cb1971fccdd649ee7f59050813c Mon Sep 17 00:00:00 2001 From: systemcoder Date: Thu, 19 Mar 2020 21:30:57 +0000 Subject: Half of stuff is working. one byte works with offset,position,column size --- H64E-2/h64e.c | 56 +++++++++++++++++++++++++++++++++++--------------------- H64E-2/main.c | 16 ++++++++++------ 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/H64E-2/h64e.c b/H64E-2/h64e.c index 8a1325a..35875a2 100644 --- a/H64E-2/h64e.c +++ b/H64E-2/h64e.c @@ -176,6 +176,7 @@ int h64e_fmt_byte_align16(H64E_format *fs, uint8_t *in_data, int32_t in_size, ui //set offset to output if (fs->f_offset) { + //printf("Print offset\n"); int offset = fs->start_offset + fs->total_output; buf1_sz = snprintf((char *)&buf1[0], BUF_SZ, "%08x: ",offset); //no error check @@ -193,9 +194,10 @@ int h64e_fmt_byte_align16(H64E_format *fs, uint8_t *in_data, int32_t in_size, ui //size shout be allways matching (size mod columnsize == 0) //non matching size should be used at the end, on last line of output + //printf("Loop_size %d\n",loop_size); for (i=0; iin_size) + if (igroup_fmt == H64E_G_BYTE)||(fs->group_fmt == H64E_G_NONE)) && (fs->output_fmt == H64E_O_STRING)) @@ -210,18 +212,38 @@ int h64e_fmt_byte_align16(H64E_format *fs, uint8_t *in_data, int32_t in_size, ui //group byte output buf1_sz = snprintf((char *)&buf1[0], BUF_SZ, "%02x",in_data[i]); } - //count converted chars per line - fs->column_pos += 1; - fs->total_output += 1; - //add space if configured if (fs->f_space) { + //printf("Space enabled\n"); if (buf1_szgroup_fmt == H64E_G_BYTE)||(fs->group_fmt == H64E_G_NONE)) && (fs->output_fmt == H64E_O_STRING)) + { + buf1_sz = snprintf((char *)&buf1[0], BUF_SZ, " "); + } else { + //group byte output + buf1_sz = snprintf((char *)&buf1[0], BUF_SZ, " "); + } + if (fs->f_space) + { + if (buf1_szcolumn_pos += 1; + fs->total_output += 1; if (fs->column_pos == fs->column_size) { @@ -237,16 +259,7 @@ int h64e_fmt_byte_align16(H64E_format *fs, uint8_t *in_data, int32_t in_size, ui } } } - } else { - //group byte output string - if (((fs->group_fmt == H64E_G_BYTE)||(fs->group_fmt == H64E_G_NONE)) && (fs->output_fmt == H64E_O_STRING)) - { - buf1_sz = snprintf((char *)&buf1[0], BUF_SZ, " "); - } else { - //group byte output - buf1_sz = snprintf((char *)&buf1[0], BUF_SZ, " "); - } - } + //copy data to buffer after each iteration for (j=0; j1) + if (h64e_si_len(&sin)>=int8_fmt.column_size) { int cnv_num=-1; //printf("Input Out\n"); - cnv_bytes = h64e_si_data_out(&sin, &buf_cnv_in[0], 1); + cnv_bytes = h64e_si_data_out(&sin, &buf_cnv_in[0], int8_fmt.column_size); //cnv_total += cnv_bytes; @@ -303,7 +307,7 @@ int main(int argc, const char * argv[]) { switch (h64e.fmt.group) { case H64E_G_BYTE: - cnv_num = h64e_fmt_byte(&int8_fmt, &buf_cnv_in[0], cnv_bytes, buf_cnv_out, 512); + cnv_num = h64e_fmt_byte_align16(&int8_fmt, &buf_cnv_in[0], cnv_bytes, buf_cnv_out, 2048); break; case H64E_G_WORD: cnv_num = h64e_fmt_word(&int8_fmt, &buf_cnv_in[0], cnv_bytes, buf_cnv_out, 512); -- cgit v1.2.3