Commit 81d57419 authored by Lev Walkin's avatar Lev Walkin

printing charsdefn values

parent d1b4ac38
......@@ -60,6 +60,22 @@ asn1f_printable_value(asn1p_value_t *v) {
case ATV_MAX: return "MAX";
case ATV_FALSE: return "FALSE";
case ATV_TRUE: return "TRUE";
case ATV_TUPLE:
ret = snprintf(buf, sizeof(buf), "{%d, %d}",
(int)(v->value.v_integer >> 4),
(int)(v->value.v_integer & 0xff));
if(ret >= (ssize_t)sizeof(buf))
memcpy(buf + sizeof(buf) - 4, "...", 4);
return buf;
case ATV_QUADRUPLE:
ret = snprintf(buf, sizeof(buf), "{%d, %d, %d, %d}",
(int)((v->value.v_integer >> 24) & 0xff),
(int)((v->value.v_integer >> 16) & 0xff),
(int)((v->value.v_integer >> 8) & 0xff),
(int)(v->value.v_integer & 0xff));
if(ret >= (ssize_t)sizeof(buf))
memcpy(buf + sizeof(buf) - 4, "...", 4);
return buf;
case ATV_STRING:
case ATV_UNPARSED:
/* Buffer is guaranteed to be null-terminated */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment