chiark / gitweb /
configure.ac, debian/: Set up correct dependencies for GStreamer.
[disorder] / tests / udplog.c
index 81c0808c42c8cb72d0056da7f91cfd4617ccba4d..6c817ced7f3a1eb0e7927ffd72eab6616d660fe0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder
- * Copyright (C) 2007 Richard Kettlewell
+ * Copyright (C) 2007-2009 Richard Kettlewell
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -134,12 +134,13 @@ int main(int argc, char **argv) {
       disorder_fatal(0, "getnameinfo: %s", gai_strerror(err));
     xprintf("from host %s service %s: %d bytes\n", h, s, n);
     for(i = 0; i < n; i += 16) {
-      for(j = i; j < n && j < i + 16; ++j)
+      const int limit = n > i + 16 ? i + 16 : n;
+      for(j = i; j < limit; ++j)
        xprintf(" %02x", buffer[j]);
       for(; j < i + 16; ++j)
        xprintf("   ");
       xprintf("  ");
-      for(j = i; j < n && j < i + 16; ++j)
+      for(j = i; j < limit; ++j)
        xprintf("%c", buffer[j] < 128 && isprint(buffer[j]) ? buffer[j] : '.');
       xprintf("\n");
       if(fflush(stdout) < 0)