summaryrefslogtreecommitdiff
path: root/print_render.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-08-26 21:45:45 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-10-02 22:16:09 -0700
commit95a436f7efd7061a15e3be533c56e573aac2db92 (patch)
treec6d28a9dac6e96c8401e26d722c98ca12011016d /print_render.c
parent8b26ded773e1cd4890e93836692ecc9f136c5efd (diff)
downloadxscope-95a436f7efd7061a15e3be533c56e573aac2db92.tar.gz
Refactor error printing to use common functions
All errors currently recognized by xscope fall into two forms, with or without a 32-bit value to print as a bad value, so use common implementations for those two forms so we can stop duplicating that code for every new extension-defined error. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'print_render.c')
-rw-r--r--print_render.c40
1 files changed, 5 insertions, 35 deletions
diff --git a/print_render.c b/print_render.c
index 769fde5..60db37f 100644
--- a/print_render.c
+++ b/print_render.c
@@ -724,59 +724,29 @@ RenderCreateConicalGradient(FD fd, const unsigned char *buf)
void
RenderPictFormatError(FD fd, const unsigned char *buf)
{
- PrintField(buf, 1, 1, ERROR, ERRORHEADER); /* Request */
- if (Verbose < 1)
- return;
- printfield(buf, 2, 2, CARD16, "sequence number");
- PrintField(buf, 4, 4, PICTFORMAT, "format");
- PrintField(buf, 8, 2, CARD16, "minor opcode");
- PrintField(buf, 10, 1, CARD8, "major opcode");
+ printErrorWithValue(buf, PICTFORMAT, "format");
}
void
RenderPictureError(FD fd, const unsigned char *buf)
{
- PrintField(buf, 1, 1, ERROR, ERRORHEADER); /* Request */
- if (Verbose < 1)
- return;
- printfield(buf, 2, 2, CARD16, "sequence number");
- PrintField(buf, 4, 4, PICTURE, "picture");
- PrintField(buf, 8, 2, CARD16, "minor opcode");
- PrintField(buf, 10, 1, CARD8, "major opcode");
+ printErrorWithValue(buf, PICTURE, "picture");
}
void
RenderPictOpError(FD fd, const unsigned char *buf)
{
- PrintField(buf, 1, 1, ERROR, ERRORHEADER); /* Request */
- if (Verbose < 1)
- return;
- printfield(buf, 2, 2, CARD16, "sequence number");
- PrintField(buf, 4, 4, PICTOP, "pictop");
- PrintField(buf, 8, 2, CARD16, "minor opcode");
- PrintField(buf, 10, 1, CARD8, "major opcode");
+ printErrorWithValue(buf, PICTOP, "pictop");
}
void
RenderGlyphSetError(FD fd, const unsigned char *buf)
{
- PrintField(buf, 1, 1, ERROR, ERRORHEADER); /* Request */
- if (Verbose < 1)
- return;
- printfield(buf, 2, 2, CARD16, "sequence number");
- PrintField(buf, 4, 4, GLYPHSET, "glyphset");
- PrintField(buf, 8, 2, CARD16, "minor opcode");
- PrintField(buf, 10, 1, CARD8, "major opcode");
+ printErrorWithValue(buf, GLYPHSET, "glyphset");
}
void
RenderGlyphError(FD fd, const unsigned char *buf)
{
- PrintField(buf, 1, 1, ERROR, ERRORHEADER); /* Request */
- if (Verbose < 1)
- return;
- printfield(buf, 2, 2, CARD16, "sequence number");
- PrintField(buf, 4, 4, CARD32, "glyph");
- PrintField(buf, 8, 2, CARD16, "minor opcode");
- PrintField(buf, 10, 1, CARD8, "major opcode");
+ printErrorWithValue(buf, CARD32, "glyph");
}