[svn-commits] seanbright: tools/trunk r6419 - /tools/trunk/dahdi_monitor.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Apr 21 08:34:10 CDT 2009


Author: seanbright
Date: Tue Apr 21 08:34:06 2009
New Revision: 6419

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6419
Log:
Whitespace and coding guidelines changes

Modified:
    tools/trunk/dahdi_monitor.c

Modified: tools/trunk/dahdi_monitor.c
URL: http://svn.digium.com/svn-view/dahdi/tools/trunk/dahdi_monitor.c?view=diff&rev=6419&r1=6418&r2=6419
==============================================================================
--- tools/trunk/dahdi_monitor.c (original)
+++ tools/trunk/dahdi_monitor.c Tue Apr 21 08:34:06 2009
@@ -25,7 +25,7 @@
  * this program for more details.
  */
 
-#include <stdio.h> 
+#include <stdio.h>
 #include <getopt.h>
 #include <string.h>
 #include <stdarg.h>
@@ -58,9 +58,8 @@
 
 #define FRAG_SIZE 8
 
-/* Put the ofh (output file handles) outside
- * the main loop in case we ever add a signal
- * handler.
+/* Put the ofh (output file handles) outside the main loop in case we ever add a
+ * signal handler.
  */
 static FILE *ofh[6];
 
@@ -100,12 +99,13 @@
 		close(fd);
 		return -1;
 	}
-	if (speed != 8000) 
+	if (speed != 8000) {
 		fprintf(stderr, "Warning: Requested 8000 Hz, got %d\n", speed);
+	}
 	if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &fragsize)) {
 		fprintf(stderr, "Sound card won't let me set fragment size to %u %u-byte buffers (%x)\n"
 						"so sound may be choppy: %s.\n", BUFFERS, (1 << FRAG_SIZE), fragsize, strerror(errno));
-	}	
+	}
 	bzero(&ispace, sizeof(ispace));
 	bzero(&ospace, sizeof(ospace));
 
@@ -117,9 +117,9 @@
 		/* They don't support block size stuff, so just return but notify the user */
 		fprintf(stderr, "Sound card won't let me know the output buffering...\n");
 	}
-	fprintf(stderr, "New input space:  %d of %d %d byte fragments (%d bytes left)\n", 
+	fprintf(stderr, "New input space:  %d of %d %d byte fragments (%d bytes left)\n",
 		ispace.fragments, ispace.fragstotal, ispace.fragsize, ispace.bytes);
-	fprintf(stderr, "New output space:  %d of %d %d byte fragments (%d bytes left)\n", 
+	fprintf(stderr, "New output space:  %d of %d %d byte fragments (%d bytes left)\n",
 		ospace.fragments, ospace.fragstotal, ospace.fragsize, ospace.bytes);
 	return fd;
 }
@@ -181,10 +181,10 @@
 		avg = barlen;
 	if (max > barlen)
 		max = barlen;
-	
-	if (avg > 0) 
+
+	if (avg > 0)
 		memset(bar, '#', avg);
-	if (max > 0) 
+	if (max > 0)
 		memset(bar + max, '*', 1);
 
 	bar[barlen+1] = '\0';
@@ -206,25 +206,25 @@
 	float ms;
 	static struct timeval last;
 	struct timeval tv;
-	
+
 	gettimeofday(&tv, NULL);
 	ms = (tv.tv_sec - last.tv_sec) * 1000.0 + (tv.tv_usec - last.tv_usec) / 1000.0;
-	for (x=0;x<cnt;x++) {
+	for (x = 0; x < cnt; x++) {
 		txavg += abs(tx[x]);
 		rxavg += abs(rx[x]);
 	}
 	txavg = abs(txavg / cnt);
 	rxavg = abs(rxavg / cnt);
-	
+
 	if (txavg > txbest)
 		txbest = txavg;
 	if (rxavg > rxbest)
 		rxbest = rxavg;
-	
+
 	/* Update no more than 10 times a second */
 	if (ms < 100)
 		return;
-	
+
 	/* Save as max levels, if greater */
 	if (txbest > txmax) {
 		txmax = txbest;
@@ -246,7 +246,7 @@
 		printf("   Rx: %5d (%5d) Tx: %5d (%5d)", rxbest, rxmax, txbest, txmax);
 	txbest = 0;
 	rxbest = 0;
-	
+
 	/* If we have had the same max hits for x times, clear the values */
 	sametxmax++;
 	samerxmax++;
@@ -310,9 +310,9 @@
 		fprintf(stderr, "        dahdi_monitor 1 -m -r streamrx.raw -t streamtx.raw -R streampreechorx.raw -T streampreechotx.raw\n");
 		exit(1);
 	}
-    
+
 	chan = atoi(argv[1]);
-    
+
 	while ((opt = getopt(argc, argv, "vmol:f:r:t:s:F:R:T:S:")) != -1) {
 		switch (opt) {
 		case '?':
@@ -585,7 +585,7 @@
 				x = fwrite(buf_tx, 1, res_tx, ofh[MON_TX]);
 
 			if (stereo_output && ofh[MON_STEREO]) {
-				for (x=0;x<res_tx;x++) {
+				for (x = 0; x < res_tx; x++) {
 					stereobuf[x*2] = buf_brx[x];
 					stereobuf[x*2+1] = buf_tx[x];
 				}
@@ -615,23 +615,24 @@
 					x = fwrite(buf_tx, 1, res_tx, ofh[MON_PRE_TX]);
 
 				if (stereo_output && ofh[MON_PRE_STEREO]) {
-					for (x=0;x<res_brx;x++) {
+					for (x = 0; x < res_brx; x++) {
 						stereobuf[x*2] = buf_brx[x];
 						stereobuf[x*2+1] = buf_tx[x];
 					}
-					x = fwrite(stereobuf, 1, res_brx*2, ofh[MON_PRE_STEREO]);
+					x = fwrite(stereobuf, 1, res_brx * 2, ofh[MON_PRE_STEREO]);
 				}
 			}
 		}
 
 		if (ossoutput && afd) {
 			if (stereo) {
-				for (x=0;x<res_brx;x++) {
-					buf_tx[x<<1] = buf_tx[(x<<1) + 1] = buf_brx[x];
+				for (x = 0; x < res_brx; x++) {
+					buf_tx[x << 1] = buf_tx[(x << 1) + 1] = buf_brx[x];
 				}
 				x = write(afd, buf_tx, res_brx << 1);
-			} else
+			} else {
 				x = write(afd, buf_brx, res_brx);
+			}
 		}
 
 		if (limit && readcount >= limit) {




More information about the svn-commits mailing list