summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarel Zak2012-08-08 08:58:28 +0200
committerKarel Zak2012-08-08 08:58:28 +0200
commit33e785491b073ffe8a5f7546d214b8340ad29394 (patch)
tree0d55521959583bdb12f9de12b8b06f7fb4bd1aed /lib
parentinclude/tt: improve work with non-utf8 chars (diff)
downloadkernel-qcow2-util-linux-33e785491b073ffe8a5f7546d214b8340ad29394.tar.gz
kernel-qcow2-util-linux-33e785491b073ffe8a5f7546d214b8340ad29394.tar.xz
kernel-qcow2-util-linux-33e785491b073ffe8a5f7546d214b8340ad29394.zip
lib/tt: fix \x%02x usage
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/tt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/tt.c b/lib/tt.c
index 7063760a9..a538af66c 100644
--- a/lib/tt.c
+++ b/lib/tt.c
@@ -670,14 +670,14 @@ void tt_fputs_quoted(const char *data, FILE *out)
!isprint((unsigned char) *p) ||
iscntrl((unsigned char) *p)) {
- fprintf(out, "\\x%02x", *p);
+ fprintf(out, "\\x%02x", (unsigned char) *p);
} else if (*p == '\\' &&
*(p + 1) == 'x' &&
isxdigit((unsigned char) *(p + 2)) &&
isxdigit((unsigned char) *(p + 3))) {
- fprintf(out, "\\x%02x", *p);
+ fprintf(out, "\\x%02x", (unsigned char) *p);
} else
fputc(*p, out);
}
@@ -693,14 +693,14 @@ void tt_fputs_nonblank(const char *data, FILE *out)
!isprint((unsigned char) *p) ||
iscntrl((unsigned char) *p)) {
- fprintf(out, "\\x%02x", *p);
+ fprintf(out, "\\x%02x", (unsigned char) *p);
} else if (*p == '\\' &&
*(p + 1) == 'x' &&
isxdigit((unsigned char) *(p + 2)) &&
isxdigit((unsigned char) *(p + 3))) {
- fprintf(out, "\\x%02x", *p);
+ fprintf(out, "\\x%02x", (unsigned char) *p);
} else
fputc(*p, out);
}