Fix: clang 'constant-out-of-range-compare' warning

This patch fixes two 'autological-constant-out-of-range-compare' clang
warnings caused by comparing enum type variables with -1.

It's possible that compilers optimize these two comparisons away.

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: handle signed return value for snprintf

Signed-off-by: David Goulet <dgoulet@efficios.com>