When printing 8-bit XA_INTEGER output property values, inject newlines
every 16 bytes by printing the newline before the 17th byte, not after
the 16th byte.  The original scheme failed to print a final newline
when the data were not a multiple of 16 bytes (such as the single byte
"BorderDimensions" property).

Signed-off-by: Andy Ritger <[email protected]>
---
 xrandr.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xrandr.c b/xrandr.c
index d05737e..c394958 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -3169,14 +3169,14 @@ main (int argc, char **argv)
                    if (actual_type == XA_INTEGER && actual_format == 8) {
                        int k;
     
-                       printf("\t%s:\n", XGetAtomName (dpy, props[j]));
+                       printf("\t%s:", XGetAtomName (dpy, props[j]));
                        for (k = 0; k < nitems; k++) {
-                           if (k % 16 == 0)
-                               printf ("\t\t");
+                           if (k % 16 == 0) {
+                               printf("\n\t\t");
+                           }
                            printf("%02x", (unsigned char)prop[k]);
-                           if (k % 16 == 15)
-                               printf("\n");
                        }
+                       printf("\n");
                    } else if (actual_type == XA_INTEGER &&
                               actual_format == 32)
                    {
-- 
1.7.2.5

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to