generator: Don't print any tainted values in DBG3 messages for U_INT_4

The bits not written to are marked tainted by valgrind, don't print
them in the debug messages.  Also use more specific printf-specifiers
for other values.
This commit is contained in:
Tobias Brunner 2019-03-18 13:58:52 +01:00
parent 69cbe2ca3f
commit 333adbc25b
1 changed files with 6 additions and 6 deletions

View File

@ -254,7 +254,7 @@ static void generate_u_int_type(private_generator_t *this,
*(this->out_position) = high | low;
if (this->debug)
{
DBG3(DBG_ENC, " => %d", *(this->out_position));
DBG3(DBG_ENC, " => %hhu", *(this->out_position) >> 4);
}
/* write position is not changed, just bit position is moved */
this->current_bit = 4;
@ -268,7 +268,7 @@ static void generate_u_int_type(private_generator_t *this,
*(this->out_position) = high | low;
if (this->debug)
{
DBG3(DBG_ENC, " => %d", *(this->out_position));
DBG3(DBG_ENC, " => %hhu", *(this->out_position) & 0x0F);
}
this->out_position++;
this->current_bit = 0;
@ -290,7 +290,7 @@ static void generate_u_int_type(private_generator_t *this,
*this->out_position = *((uint8_t *)(this->data_struct + offset));
if (this->debug)
{
DBG3(DBG_ENC, " => %d", *(this->out_position));
DBG3(DBG_ENC, " => %hhu", *(this->out_position));
}
this->out_position++;
break;
@ -318,7 +318,7 @@ static void generate_u_int_type(private_generator_t *this,
val = htons(val);
if (this->debug)
{
DBG3(DBG_ENC, " => %d", val);
DBG3(DBG_ENC, " => %hu", val);
}
/* write bytes to buffer (set bit is overwritten) */
write_bytes_to_buffer(this, &val, sizeof(uint16_t));
@ -392,7 +392,7 @@ static void generate_flag(private_generator_t *this, uint32_t offset)
*(this->out_position) = *(this->out_position) | flag;
if (this->debug)
{
DBG3(DBG_ENC, " => %d", *this->out_position);
DBG3(DBG_ENC, " => %hhu", *this->out_position);
}
this->current_bit++;
@ -412,7 +412,7 @@ static void generate_from_chunk(private_generator_t *this, uint32_t offset)
if (this->current_bit != 0)
{
DBG1(DBG_ENC, "can not generate a chunk at bitpos %d",
DBG1(DBG_ENC, "can not generate a chunk at bitpos %hhu",
this->current_bit);
return ;
}