From a031634bd64c7f30c4ace5ca06a5a47600b42f47 Mon Sep 17 00:00:00 2001
From: Vito Caputo <vcaputo@pengaru.com>
Date: Thu, 8 Oct 2020 01:29:12 -0700
Subject: *: more cosmetic formatting cleanups

Making things a bit more consistent
---
 src/rmd.c                     |  5 +++--
 src/rmd_cache.c               | 15 ++++++++++-----
 src/rmd_cache_audio.c         |  3 ++-
 src/rmd_cache_frame.c         |  6 ++++--
 src/rmd_capture_audio.c       |  5 +++--
 src/rmd_encode_audio_buffer.c |  9 +++++----
 src/rmd_encode_cache.c        |  3 ++-
 src/rmd_encode_image_buffer.c |  6 ++++--
 src/rmd_flush_to_ogg.c        |  9 ++++++---
 src/rmd_frame.c               |  9 ++++++---
 src/rmd_get_frame.c           | 23 ++++++++++++++---------
 src/rmd_getzpixmap.c          |  6 ++++--
 src/rmd_init_encoder.c        |  9 ++++++---
 src/rmd_initialize_data.c     | 15 ++++++++++-----
 src/rmd_jack.c                | 15 ++++++++++-----
 src/rmd_load_cache.c          | 17 ++++++++++-------
 src/rmd_make_dummy_pointer.c  |  4 ++--
 src/rmd_math.c                |  3 ++-
 src/rmd_opendev.c             |  7 ++++---
 src/rmd_parseargs.c           |  3 ++-
 src/rmd_poll_events.c         | 20 ++++++++++----------
 src/rmd_queryextensions.c     |  3 ++-
 src/rmd_rectinsert.c          | 11 ++++++-----
 src/rmd_register_callbacks.c  | 12 ++++++------
 src/rmd_rescue.c              |  3 ++-
 src/rmd_setbrwindow.c         |  4 ++--
 src/rmd_shortcuts.c           |  4 ++--
 src/rmd_specsfile.c           |  7 ++++---
 src/rmd_threads.c             |  6 ++++--
 src/rmd_timer.c               |  7 ++++---
 src/rmd_update_image.c        |  4 ++--
 src/rmd_wm_check.c            |  3 ++-
 src/rmd_wm_is_compositing.c   |  3 ++-
 src/rmd_yuv_utils.c           | 17 ++++++++---------
 src/test-rectinsert.c         | 27 ++++++++++++++++++---------
 35 files changed, 183 insertions(+), 120 deletions(-)

diff --git a/src/rmd.c b/src/rmd.c
index 5a93e79..64addd4 100644
--- a/src/rmd.c
+++ b/src/rmd.c
@@ -46,7 +46,8 @@
 #include <string.h>
 #include <errno.h>
 
-int main(int argc, char **argv){
+int main(int argc, char **argv)
+{
 	ProgData pdata = {};
 	EncData enc_data = {};
 	CacheData cache_data = {};
@@ -105,7 +106,7 @@ int main(int argc, char **argv){
 	if (!rmdSetBRWindow(pdata.dpy, &pdata.brwin, &pdata.specs, &pdata.args))
 		exit(11);
 
-	if (!pdata.args.nowmcheck && rmdWMIsCompositing( pdata.dpy, pdata.specs.screen ) ) {
+	if (!pdata.args.nowmcheck && rmdWMIsCompositing(pdata.dpy, pdata.specs.screen)) {
 
 		fprintf(stderr, "\nDetected compositing window manager.\n"
 			"Reverting to full screen capture at every frame.\n"
diff --git a/src/rmd_cache.c b/src/rmd_cache.c
index 1353bc2..bef6a83 100644
--- a/src/rmd_cache.c
+++ b/src/rmd_cache.c
@@ -48,7 +48,8 @@
 * \n number to be used as a postfix
 *
 */
-static void rmdCacheFileN(char *name, char **newname, int n) { // Nth cache file
+static void rmdCacheFileN(char *name, char **newname, int n) // Nth cache file
+{
 	char numbuf[8];
 
 	strcpy(*newname, name);
@@ -57,7 +58,8 @@ static void rmdCacheFileN(char *name, char **newname, int n) { // Nth cache file
 	strcat(*newname, numbuf);
 }
 
-int rmdSwapCacheFilesWrite(char *name, int n, gzFile *fp, FILE **ucfp) {
+int rmdSwapCacheFilesWrite(char *name, int n, gzFile *fp, FILE **ucfp)
+{
 	char *newname = malloc(strlen(name) + 10);
 
 	rmdCacheFileN(name, &newname, n);
@@ -75,7 +77,8 @@ int rmdSwapCacheFilesWrite(char *name, int n, gzFile *fp, FILE **ucfp) {
 	return ((*fp == NULL) && (*ucfp == NULL));
 }
 
-int rmdSwapCacheFilesRead(char *name, int n, gzFile *fp, FILE **ucfp) {
+int rmdSwapCacheFilesRead(char *name, int n, gzFile *fp, FILE **ucfp)
+{
 	char *newname = malloc(strlen(name) + 10);
 
 	rmdCacheFileN(name, &newname, n);
@@ -91,7 +94,8 @@ int rmdSwapCacheFilesRead(char *name, int n, gzFile *fp, FILE **ucfp) {
 	return ((*fp == NULL) && (*ucfp == NULL));
 }
 
-int rmdPurgeCache(CacheData *cache_data_t, int sound) {
+int rmdPurgeCache(CacheData *cache_data_t, int sound)
+{
 	struct stat buff;
 	char *fname;
 	int exit_value = 0;
@@ -131,7 +135,8 @@ int rmdPurgeCache(CacheData *cache_data_t, int sound) {
 	return exit_value;
 }
 
-void rmdInitCacheData(ProgData *pdata, EncData *enc_data_t, CacheData *cache_data_t) {
+void rmdInitCacheData(ProgData *pdata, EncData *enc_data_t, CacheData *cache_data_t)
+{
 	int	width, height, pid;
 	char	pidbuf[8];
 
diff --git a/src/rmd_cache_audio.c b/src/rmd_cache_audio.c
index 76101f9..00d2097 100644
--- a/src/rmd_cache_audio.c
+++ b/src/rmd_cache_audio.c
@@ -39,7 +39,8 @@
 
 
 
-void *rmdCacheAudioBuffer(ProgData *pdata) {
+void *rmdCacheAudioBuffer(ProgData *pdata)
+{
 	size_t	write_size = pdata->periodsize * pdata->sound_framesize;
 
 #ifdef HAVE_LIBJACK
diff --git a/src/rmd_cache_frame.c b/src/rmd_cache_frame.c
index cae1c14..a1cb669 100644
--- a/src/rmd_cache_frame.c
+++ b/src/rmd_cache_frame.c
@@ -53,7 +53,8 @@ static int rmdFlushBlock(
 			int blockwidth,
 			gzFile fp,
 			FILE *ucfp,
-			int flush) {
+			int flush)
+{
 
 	int	bytes_written = 0,
 		block_i = (!blockwidth) ? 0 : (blockno / (width / blockwidth)),//place on the grid
@@ -88,7 +89,8 @@ static int rmdFlushBlock(
 	return bytes_written;
 }
 
-void *rmdCacheImageBuffer(ProgData *pdata) {
+void *rmdCacheImageBuffer(ProgData *pdata)
+{
 
 	gzFile		fp = NULL;
 	FILE		*ucfp = NULL;
diff --git a/src/rmd_capture_audio.c b/src/rmd_capture_audio.c
index 1d5b596..f939350 100644
--- a/src/rmd_capture_audio.c
+++ b/src/rmd_capture_audio.c
@@ -42,7 +42,8 @@
 #include <time.h>
 
 
-void *rmdCaptureAudio(ProgData *pdata) {
+void *rmdCaptureAudio(ProgData *pdata)
+{
 
 #ifdef HAVE_LIBASOUND
 	int frames = pdata->periodsize;
@@ -160,7 +161,7 @@ void *rmdCaptureAudio(ProgData *pdata) {
 		pthread_mutex_lock(&pdata->sound_buffer_mutex);
 		tmp = pdata->sound_buffer;
 		if (!tmp)
-				pdata->sound_buffer = newbuf;
+			pdata->sound_buffer = newbuf;
 		else {
 			while (tmp->next != NULL)
 				tmp = tmp->next;
diff --git a/src/rmd_encode_audio_buffer.c b/src/rmd_encode_audio_buffer.c
index 0be0e2f..4e20a1c 100644
--- a/src/rmd_encode_audio_buffer.c
+++ b/src/rmd_encode_audio_buffer.c
@@ -37,7 +37,8 @@
 #include <errno.h>
 
 
-void *rmdEncodeAudioBuffer(ProgData *pdata) {
+void *rmdEncodeAudioBuffer(ProgData *pdata)
+{
 	int	sampread = pdata->periodsize;
 #ifdef HAVE_LIBJACK
 	void	*jackbuf = NULL;
@@ -122,9 +123,8 @@ void *rmdEncodeAudioBuffer(ProgData *pdata) {
 			vorbis_analysis(&pdata->enc_data->m_vo_block, NULL);
 			vorbis_bitrate_addblock(&pdata->enc_data->m_vo_block);
 
-			while (vorbis_bitrate_flushpacket(&pdata->enc_data->m_vo_dsp, &pdata->enc_data->m_ogg_pckt2)) {
+			while (vorbis_bitrate_flushpacket(&pdata->enc_data->m_vo_dsp, &pdata->enc_data->m_ogg_pckt2))
 				ogg_stream_packetin(&pdata->enc_data->m_ogg_vs, &pdata->enc_data->m_ogg_pckt2);
-			}
 		}
 		pthread_mutex_unlock(&pdata->libogg_mutex);
 	}
@@ -136,7 +136,8 @@ void *rmdEncodeAudioBuffer(ProgData *pdata) {
 	pthread_exit(&errno);
 }
 
-void rmdSyncEncodeAudioBuffer(ProgData *pdata, signed char *buff) {
+void rmdSyncEncodeAudioBuffer(ProgData *pdata, signed char *buff)
+{
 	int	sampread = (buff != NULL) ? pdata->periodsize : 0;
 	float	**vorbis_buffer = vorbis_analysis_buffer(&pdata->enc_data->m_vo_dsp, sampread);
 
diff --git a/src/rmd_encode_cache.c b/src/rmd_encode_cache.c
index 1e0727c..e2bf85d 100644
--- a/src/rmd_encode_cache.c
+++ b/src/rmd_encode_cache.c
@@ -39,7 +39,8 @@
 
 
 
-void rmdEncodeCache(ProgData *pdata){
+void rmdEncodeCache(ProgData *pdata)
+{
 	pthread_t	flush_to_ogg_t, load_cache_t;
 
 	fprintf(stderr, "STATE:ENCODING\n");
diff --git a/src/rmd_encode_image_buffer.c b/src/rmd_encode_image_buffer.c
index bfb3888..cc819aa 100644
--- a/src/rmd_encode_image_buffer.c
+++ b/src/rmd_encode_image_buffer.c
@@ -33,7 +33,8 @@
 #include <errno.h>
 
 
-void *rmdEncodeImageBuffer(ProgData *pdata) {
+void *rmdEncodeImageBuffer(ProgData *pdata)
+{
 	unsigned int	encode_frameno = 0, last_encode_frameno = 0;
 
 	rmdThreadsSetName("rmdEncodeImages");
@@ -91,7 +92,8 @@ void *rmdEncodeImageBuffer(ProgData *pdata) {
 
 //this function is meant to be called normally
 //not through a thread of it's own
-void rmdSyncEncodeImageBuffer(ProgData *pdata, unsigned int n_frames) {
+void rmdSyncEncodeImageBuffer(ProgData *pdata, unsigned int n_frames)
+{
 	EncData	*enc_data = pdata->enc_data;
 
 	if (theora_encode_YUVin(&enc_data->m_th_st, &enc_data->yuv)) {
diff --git a/src/rmd_flush_to_ogg.c b/src/rmd_flush_to_ogg.c
index 100c5d1..ff5332d 100644
--- a/src/rmd_flush_to_ogg.c
+++ b/src/rmd_flush_to_ogg.c
@@ -45,7 +45,8 @@
 //will invalidate it. But we must have pages from
 //both streams at every time in
 //order to do correct multiplexing
-static void page_copy(ogg_page *new, ogg_page *old) {
+static void page_copy(ogg_page *new, ogg_page *old)
+{
 
 	new->header_len = old->header_len;
 	new->header = malloc(new->header_len);
@@ -57,13 +58,15 @@ static void page_copy(ogg_page *new, ogg_page *old) {
 }
 
 //free our copy
-static void page_free(ogg_page *pg) {
+static void page_free(ogg_page *pg)
+{
 	pg->header_len = pg->body_len = 0;
 	free(pg->header);
 	free(pg->body);
 }
 
-void *rmdFlushToOgg(ProgData *pdata) {
+void *rmdFlushToOgg(ProgData *pdata)
+{
 	int		videoflag = 0, audioflag = 0;
 	double		video_bytesout = 0, audio_bytesout = 0;
 	ogg_page	videopage,	//owned by libogg
diff --git a/src/rmd_frame.c b/src/rmd_frame.c
index ee5c4d8..685ca12 100644
--- a/src/rmd_frame.c
+++ b/src/rmd_frame.c
@@ -42,7 +42,8 @@ void rmdDrawFrame(	Display *dpy,
 			int screen,  
 			Window win,
 			int width,
-			int height) {
+			int height)
+{
 
 	GC gc;
 	XGCValues gcv;
@@ -78,7 +79,8 @@ void rmdDrawFrame(	Display *dpy,
 void rmdMoveFrame(	Display *dpy,
 			Window win,
 			int x,
-			int y) {
+			int y)
+{
 
 	XMoveWindow(dpy, win, x-BORDER_WIDTH, y-BORDER_WIDTH);
 //	XSync(pdata->dpy, False);
@@ -90,7 +92,8 @@ Window rmdFrameInit(	Display *dpy,
 			int x,
 			int y,
 			int width,
-			int height) {
+			int height)
+{
 
 	XSetWindowAttributes attribs;
 	XColor white, white_e;
diff --git a/src/rmd_get_frame.c b/src/rmd_get_frame.c
index 50a58ce..9524333 100644
--- a/src/rmd_get_frame.c
+++ b/src/rmd_get_frame.c
@@ -99,8 +99,8 @@ static void clip_dummy_pointer_area(XRectangle *area, XRectangle *clip, XRectang
 static void mark_buffer_area(	unsigned char *data,
 				int x_tm, int y_tm,
 				int width_tm, int height_tm,
-				int buffer_width, int depth) {
-
+				int buffer_width, int depth)
+{
 	if ((depth == 24) || (depth == 32)) {
 		MARK_BUFFER_AREA_C(	data,
 					x_tm,
@@ -122,7 +122,8 @@ static void mark_buffer_area(	unsigned char *data,
 
 //besides taking the first screenshot, this functions primary purpose is to 
 //initialize the structures and memory.
-static int rmdFirstFrame(ProgData *pdata, Image *image) {
+static int rmdFirstFrame(ProgData *pdata, Image *image)
+{
 	const XRectangle	*rrect = &pdata->brwin.rrect;
 
 	if (pdata->args.noshared) {
@@ -185,7 +186,8 @@ static int rmdFirstFrame(ProgData *pdata, Image *image) {
 }
 
 //make a deep copy
-static void rmdBRWinCpy(BRWindow *target, BRWindow *source) {
+static void rmdBRWinCpy(BRWindow *target, BRWindow *source)
+{
 	target->winrect = source->winrect;
 	target->rrect = source->rrect;
 	target->windowid = source->windowid;
@@ -197,7 +199,8 @@ static void rmdMoveCaptureArea(	XRectangle *rect,
 				int cursor_x,
 				int cursor_y,
 				int width,
-				int height) {
+				int height)
+{
 	int t_x = 0, t_y = 0;
 
 	t_x = cursor_x - rect->width / 2;
@@ -209,7 +212,8 @@ static void rmdMoveCaptureArea(	XRectangle *rect,
 }
 
 
-static void rmdBlocksReset(unsigned int blocks_w, unsigned int blocks_h) {
+static void rmdBlocksReset(unsigned int blocks_w, unsigned int blocks_h)
+{
 	memset(yblocks, 0, blocks_w * blocks_h * sizeof(*yblocks));
 	memset(ublocks, 0, blocks_w * blocks_h * sizeof(*ublocks));
 	memset(vblocks, 0, blocks_w * blocks_h * sizeof(*vblocks));
@@ -233,8 +237,8 @@ static void rmdBlocksFromList(	RectArea   **root,
 				unsigned int x_offset,
 				unsigned int y_offset,
 				unsigned int blocks_w,
-				unsigned int blocks_h) {
-
+				unsigned int blocks_h)
+{
 	rmdBlocksReset(blocks_w, blocks_h);
 
 	for (RectArea *temp = *root; temp; temp = temp->next) {
@@ -258,7 +262,8 @@ static void rmdBlocksFromList(	RectArea   **root,
 	}
 }
 
-void *rmdGetFrame(ProgData *pdata) {
+void *rmdGetFrame(ProgData *pdata)
+{
 	int	blocks_w = pdata->enc_data->yuv.y_width / Y_UNIT_WIDTH,
 		blocks_h = pdata->enc_data->yuv.y_height / Y_UNIT_WIDTH;
 	unsigned int msk_ret;
diff --git a/src/rmd_getzpixmap.c b/src/rmd_getzpixmap.c
index 43465c8..8f6684c 100644
--- a/src/rmd_getzpixmap.c
+++ b/src/rmd_getzpixmap.c
@@ -43,7 +43,8 @@ int rmdGetZPixmap(	Display *dpy,
 			int x,
 			int y,
 			int width,
-			int height) {
+			int height)
+{
 
 	xGetImageReply reply;
 	xGetImageReq *request;
@@ -82,7 +83,8 @@ int rmdGetZPixmapSHM(	Display *dpy,
 			int x,
 			int y,
 			int width,
-			int height) {
+			int height)
+{
 
 	xShmGetImageReply reply;
 	xShmGetImageReq *request = NULL;
diff --git a/src/rmd_init_encoder.c b/src/rmd_init_encoder.c
index a0d81e6..122b8d9 100644
--- a/src/rmd_init_encoder.c
+++ b/src/rmd_init_encoder.c
@@ -38,7 +38,8 @@
 
 
 
-static void m_add_fishead_packet(ogg_stream_state *m_ogg_state) {
+static void m_add_fishead_packet(ogg_stream_state *m_ogg_state)
+{
 	fishead_packet	skel_fp;
 
 	skel_fp.ptime_n = skel_fp.btime_n = 0;
@@ -48,7 +49,8 @@ static void m_add_fishead_packet(ogg_stream_state *m_ogg_state) {
 }
 
 
-static int rmdIncrementalNaming(char **name) {
+static int rmdIncrementalNaming(char **name)
+{
 	struct stat buff;
 	char *base_name__;
 	int i = 0, fname_length = strlen(*name)-4;
@@ -83,7 +85,8 @@ static int rmdIncrementalNaming(char **name) {
 	return 0;
 }
 
-void rmdInitEncoder(ProgData *pdata, EncData *enc_data_t, int buffer_ready) {
+void rmdInitEncoder(ProgData *pdata, EncData *enc_data_t, int buffer_ready)
+{
 	int y0, y1, y2, fname_length;
 	ogg_stream_state m_ogg_skel;
 	ogg_page skel_og_pg;
diff --git a/src/rmd_initialize_data.c b/src/rmd_initialize_data.c
index 09c8132..4cd015f 100644
--- a/src/rmd_initialize_data.c
+++ b/src/rmd_initialize_data.c
@@ -42,10 +42,12 @@
 #include <string.h>
 
 #ifdef HAVE_LIBASOUND
-static void rmdFixBufferSize(snd_pcm_uframes_t *buffsize) {
+static void rmdFixBufferSize(snd_pcm_uframes_t *buffsize)
+{
 	snd_pcm_uframes_t buffsize_t = *buffsize,
 #else
-static void rmdFixBufferSize(u_int32_t *buffsize) {
+static void rmdFixBufferSize(u_int32_t *buffsize)
+{
 	u_int32_t buffsize_t = *buffsize,
 #endif
 	buffsize_ret = 1;
@@ -58,7 +60,8 @@ static void rmdFixBufferSize(u_int32_t *buffsize) {
 			(int)buffsize_ret, (int)*buffsize);
 }
 
-int rmdInitializeData(ProgData *pdata, EncData *enc_data, CacheData *cache_data) {
+int rmdInitializeData(ProgData *pdata, EncData *enc_data, CacheData *cache_data)
+{
 	fprintf(stderr, "Initializing...\n");
 
 	rmdMakeMatrices();
@@ -186,7 +189,8 @@ int rmdInitializeData(ProgData *pdata, EncData *enc_data, CacheData *cache_data)
 
 }
 
-void rmdSetupDefaultArgs(ProgArgs *args) {
+void rmdSetupDefaultArgs(ProgArgs *args)
+{
 	args->delay			= 0;
 	args->windowid			= 0;
 	args->x				= 0;
@@ -244,7 +248,8 @@ void rmdSetupDefaultArgs(ProgArgs *args) {
 	strcpy(args->filename, "out.ogv");
 }
 
-void rmdCleanUp(void) {
+void rmdCleanUp(void)
+{
 	free(yblocks);
 	free(ublocks);
 	free(vblocks);
diff --git a/src/rmd_jack.c b/src/rmd_jack.c
index 841017f..6002df0 100644
--- a/src/rmd_jack.c
+++ b/src/rmd_jack.c
@@ -46,7 +46,8 @@
 *
 *   \returns Zero always
 */
-static int rmdJackCapture(jack_nframes_t nframes, void *jdata_t) {
+static int rmdJackCapture(jack_nframes_t nframes, void *jdata_t)
+{
 	JackData *jdata = (JackData *)jdata_t;
 
 	if (!jdata->pdata->running || jdata->pdata->paused || !jdata->capture_started)
@@ -80,7 +81,8 @@ static int rmdJackCapture(jack_nframes_t nframes, void *jdata_t) {
 *
 *   \returns 0 on Success, 1 on failure
 */
-static int rmdSetupPorts(JackData *jdata) {
+static int rmdSetupPorts(JackData *jdata)
+{
 	jdata->ports = malloc(sizeof(jack_port_t *) * jdata->nports);
 	jdata->portbuf = malloc(sizeof(jack_default_audio_sample_t *) * jdata->nports);
 	memset(jdata->portbuf, 0, sizeof(jack_default_audio_sample_t *) * jdata->nports);
@@ -118,7 +120,8 @@ static int rmdSetupPorts(JackData *jdata) {
 //the program should stop recording,
 //encode the result(if not on the fly)
 //an exit cleanly.
-static void rmdJackShutdown(void *jdata_t) {
+static void rmdJackShutdown(void *jdata_t)
+{
 	JackData *jdata = (JackData *)jdata_t;
 
 	jdata->pdata->running = FALSE;
@@ -126,7 +129,8 @@ static void rmdJackShutdown(void *jdata_t) {
 	fprintf (stderr, "JACK shutdown\n");
 }
 
-int rmdStartJackClient(JackData *jdata) {
+int rmdStartJackClient(JackData *jdata)
+{
 	float ring_buffer_size = 0.0;
 	int pid;
 	char pidbuf[8];
@@ -183,7 +187,8 @@ int rmdStartJackClient(JackData *jdata) {
 	return 0;
 }
 
-int rmdStopJackClient(JackData *jdata) {
+int rmdStopJackClient(JackData *jdata)
+{
 	int ret = 0;
 
 	jack_ringbuffer_free(jdata->sound_buffer);
diff --git a/src/rmd_load_cache.c b/src/rmd_load_cache.c
index 4fbacfd..b5ac9fb 100644
--- a/src/rmd_load_cache.c
+++ b/src/rmd_load_cache.c
@@ -73,8 +73,8 @@ static void rmdLoadBlock(
 			int blockno,
 			int width,
 			int height,
-			int blockwidth) {
-
+			int blockwidth)
+{
 	int	block_i = blockno / (width / blockwidth),//place on the grid
 		block_k = blockno % (width / blockwidth);
 
@@ -85,7 +85,8 @@ static void rmdLoadBlock(
 }
 
 //returns number of bytes
-static int rmdReadZF(void * buffer, size_t size, size_t nmemb, FILE *ucfp, gzFile ifp) {
+static int rmdReadZF(void * buffer, size_t size, size_t nmemb, FILE *ucfp, gzFile ifp)
+{
 	if ((ifp != NULL && ucfp != NULL) ||
 	   (ifp == NULL && ucfp == NULL))
 		return -1;
@@ -95,7 +96,8 @@ static int rmdReadZF(void * buffer, size_t size, size_t nmemb, FILE *ucfp, gzFil
 		return gzread(ifp, buffer, size * nmemb);
 }
 
-static int rmdReadFrame(CachedFrame *frame, FILE *ucfp, gzFile ifp) {
+static int rmdReadFrame(CachedFrame *frame, FILE *ucfp, gzFile ifp)
+{
 	int	index_entry_size = sizeof(u_int32_t);
 
 	if (frame->header->Ynum > 0) {
@@ -161,7 +163,8 @@ static int rmdReadFrame(CachedFrame *frame, FILE *ucfp, gzFile ifp) {
 	return 0;
 }
 
-static int read_header(ProgData *pdata, gzFile ifp, FILE *ucfp, FrameHeader *fheader) {
+static int read_header(ProgData *pdata, gzFile ifp, FILE *ucfp, FrameHeader *fheader)
+{
 	if (!pdata->args.zerocompression) {
 		return gzread(ifp, fheader, sizeof(FrameHeader)) == sizeof(FrameHeader);
 	} else {
@@ -169,8 +172,8 @@ static int read_header(ProgData *pdata, gzFile ifp, FILE *ucfp, FrameHeader *fhe
 	}
 }
 
-void *rmdLoadCache(ProgData *pdata) {
-
+void *rmdLoadCache(ProgData *pdata)
+{
 	yuv_buffer	*yuv = &pdata->enc_data->yuv;
 	gzFile		ifp = NULL;
 	FILE		*ucfp = NULL;
diff --git a/src/rmd_make_dummy_pointer.c b/src/rmd_make_dummy_pointer.c
index 25bb027..bd38ea6 100644
--- a/src/rmd_make_dummy_pointer.c
+++ b/src/rmd_make_dummy_pointer.c
@@ -38,8 +38,8 @@ unsigned char *rmdMakeDummyPointer(	Display *display,
 					int size,
 					int color,
 					int type,
-					unsigned char *npxl) {
-
+					unsigned char *npxl)
+{
 	unsigned long	bpixel = XBlackPixel(display, specs->screen);
 	unsigned long	wpixel = XWhitePixel(display, specs->screen);
 	int		i, k, o = '.';
diff --git a/src/rmd_math.c b/src/rmd_math.c
index 1cf3d29..3527490 100644
--- a/src/rmd_math.c
+++ b/src/rmd_math.c
@@ -28,6 +28,7 @@
 
 #include <math.h>
 
-double rmdRoundf(double val) {
+double rmdRoundf(double val)
+{
 	return val < 0.0 ? ceilf(val - .5) : floorf(val + 0.5);
 }
diff --git a/src/rmd_opendev.c b/src/rmd_opendev.c
index 37fb33c..3bf9474 100644
--- a/src/rmd_opendev.c
+++ b/src/rmd_opendev.c
@@ -48,8 +48,8 @@ snd_pcm_t *rmdOpenDev(	const char *pcm_dev,
 			snd_pcm_uframes_t *buffsize,
 			snd_pcm_uframes_t *periodsize,
 			unsigned int *periodtime,
-			int *hard_pause) {
-
+			int *hard_pause)
+{
 	snd_pcm_t *mhandle;
 	snd_pcm_hw_params_t *hwparams;
 	unsigned int periods = 2;
@@ -140,7 +140,8 @@ snd_pcm_t *rmdOpenDev(	const char *pcm_dev,
 
 #else
 
-int rmdOpenDev(const char *pcm_dev, unsigned int channels, unsigned int frequency) {
+int rmdOpenDev(const char *pcm_dev, unsigned int channels, unsigned int frequency)
+{
 	int fd ;
 	unsigned int value;
 
diff --git a/src/rmd_parseargs.c b/src/rmd_parseargs.c
index 12d2cd4..5a39f2a 100644
--- a/src/rmd_parseargs.c
+++ b/src/rmd_parseargs.c
@@ -65,7 +65,8 @@ static void rmdPrintAndExit(poptContext con, enum poptCallbackReason reason, con
 static boolean rmdValidateArguments(const ProgArgs *args);
 
 
-boolean rmdParseArgs(int argc, char **argv, ProgArgs *arg_return) {
+boolean rmdParseArgs(int argc, char **argv, ProgArgs *arg_return)
+{
 	poptContext popt_context = NULL;
 	boolean no_cursor = FALSE;
 	boolean quick_subsampling = FALSE;
diff --git a/src/rmd_poll_events.c b/src/rmd_poll_events.c
index 49f2478..3639751 100644
--- a/src/rmd_poll_events.c
+++ b/src/rmd_poll_events.c
@@ -44,7 +44,6 @@
 
 static int clip_event_area(XDamageNotifyEvent *e, XRectangle *cliprect, XRectangle *res)
 {
-
 #if 0
 	printf("got area %x,%x %x,%x\n",
 		e->area.x,
@@ -52,7 +51,6 @@ static int clip_event_area(XDamageNotifyEvent *e, XRectangle *cliprect, XRectang
 		e->area.width,
 		e->area.height);
 #endif
-
 	if (	e->area.x <= cliprect->x &&
 		e->area.y <= cliprect->y &&
 		e->area.width >= cliprect->width &&
@@ -100,7 +98,8 @@ static int clip_event_area(XDamageNotifyEvent *e, XRectangle *cliprect, XRectang
 /* Try align xrect to even boundaries relative to cliprect,
  * this is done for the UV routines which operate at 2x2 rgb pixel granularity.
  */
-static void uv_align(XRectangle *cliprect, XRectangle *xrect) {
+static void uv_align(XRectangle *cliprect, XRectangle *xrect)
+{
 	XRectangle	rel;
 
 	rel.x = xrect->x - cliprect->x;
@@ -134,12 +133,12 @@ static void uv_align(XRectangle *cliprect, XRectangle *xrect) {
 }
 
 
-void rmdInitEventsPolling(ProgData *pdata) {
-	Window root_return,
-		   parent_return,
-		   *children;
-	unsigned int i,
-				 nchildren;
+void rmdInitEventsPolling(ProgData *pdata)
+{
+	Window		root_return,
+			parent_return,
+			*children;
+	unsigned int	i, nchildren;
 
 	XSelectInput (pdata->dpy, pdata->specs.root, SubstructureNotifyMask);
 
@@ -168,7 +167,8 @@ void rmdInitEventsPolling(ProgData *pdata) {
 }
 
 
-void rmdEventLoop(ProgData *pdata) {
+void rmdEventLoop(ProgData *pdata)
+{
 	int inserts = 0;
 
 	XEvent event;
diff --git a/src/rmd_queryextensions.c b/src/rmd_queryextensions.c
index 4484866..76142ba 100644
--- a/src/rmd_queryextensions.c
+++ b/src/rmd_queryextensions.c
@@ -40,7 +40,8 @@ void rmdQueryExtensions(	Display *dpy,
 				ProgArgs *args,
 				int *damage_event,
 				int *damage_error,
-				int *shm_opcode) {
+				int *shm_opcode)
+{
 	int	xf_event_basep,
 		xf_error_basep,
 		shm_event_base,
diff --git a/src/rmd_rectinsert.c b/src/rmd_rectinsert.c
index 2d2fd8c..537967e 100644
--- a/src/rmd_rectinsert.c
+++ b/src/rmd_rectinsert.c
@@ -59,7 +59,8 @@
 static int rmdCollideRects(	const XRectangle *xrect1,
 				const XRectangle *xrect2,
 				XRectangle xrect_return[],
-				int *nrects) {
+				int *nrects)
+{
 	if ((xrect1->x>=xrect2->x)&&
 		(xrect1->x+xrect1->width<=xrect2->x+xrect2->width)&&
 		(xrect1->y>=xrect2->y)&&
@@ -277,8 +278,8 @@ static int rmdCollideRects(	const XRectangle *xrect1,
 	}
 }
 
-int rmdRectInsert(RectArea **root, const XRectangle *xrect) {
-
+int rmdRectInsert(RectArea **root, const XRectangle *xrect)
+{
 	int		total_insertions = 0;
 	RectArea	*temp = NULL, *newnode = (RectArea *)malloc(sizeof(RectArea));
 
@@ -465,8 +466,8 @@ int rmdRectInsert(RectArea **root, const XRectangle *xrect) {
 	return total_insertions;
 }
 
-void rmdClearList(RectArea **root) {
-
+void rmdClearList(RectArea **root)
+{
 	RectArea *temp;
 	temp=*root;
 	if (temp!=NULL) {
diff --git a/src/rmd_register_callbacks.c b/src/rmd_register_callbacks.c
index 33e04dd..a359297 100644
--- a/src/rmd_register_callbacks.c
+++ b/src/rmd_register_callbacks.c
@@ -40,13 +40,13 @@ static int *pdata_aborted		= NULL;
 static int *pdata_pause_state_changed	= NULL;
 
 
-static void rmdSetPaused(int signum) {
-
+static void rmdSetPaused(int signum)
+{
 	*pdata_pause_state_changed = TRUE;
 }
 
-static void rmdSetRunning(int signum) {
-
+static void rmdSetRunning(int signum)
+{
 	if (!*pdata_paused) {
 
 		*pdata_running = FALSE;
@@ -57,8 +57,8 @@ static void rmdSetRunning(int signum) {
 	}
 }
 
-void rmdRegisterCallbacks(ProgData *pdata) {
-
+void rmdRegisterCallbacks(ProgData *pdata)
+{
 	struct sigaction pause_act;
 	struct sigaction end_act;
 
diff --git a/src/rmd_rescue.c b/src/rmd_rescue.c
index 84bcf4b..82bb8df 100644
--- a/src/rmd_rescue.c
+++ b/src/rmd_rescue.c
@@ -40,7 +40,8 @@
 #include <stdlib.h>
 
 
-int rmdRescue(const char *path) {
+int rmdRescue(const char *path)
+{
 	unsigned short	width, height;
 	ProgData	pdata;
 	EncData		enc_data;
diff --git a/src/rmd_setbrwindow.c b/src/rmd_setbrwindow.c
index 9ad30b8..8534c77 100644
--- a/src/rmd_setbrwindow.c
+++ b/src/rmd_setbrwindow.c
@@ -33,8 +33,8 @@
 boolean rmdSetBRWindow(	Display *dpy,
 			BRWindow *brwin,
 			DisplaySpecs *specs,
-			ProgArgs *args) {
-
+			ProgArgs *args)
+{
 	//before we start recording we have to make sure the ranges are valid
 	if (args->windowid == 0) {//root window
 		//first set it up
diff --git a/src/rmd_shortcuts.c b/src/rmd_shortcuts.c
index e1e07f5..c0e1723 100644
--- a/src/rmd_shortcuts.c
+++ b/src/rmd_shortcuts.c
@@ -40,8 +40,8 @@
 int rmdRegisterShortcut(	Display *dpy,
 				Window root,
 				const char *shortcut,
-				HotKey *hotkey) {
-
+				HotKey *hotkey)
+{
 	int		keycode = 0, i, j;
 	KeySym		key = 0;
 	unsigned int	modifier_mask = 0, numlock_mask = 0;
diff --git a/src/rmd_specsfile.c b/src/rmd_specsfile.c
index 50542a8..7676bc9 100644
--- a/src/rmd_specsfile.c
+++ b/src/rmd_specsfile.c
@@ -33,8 +33,8 @@
 #include <stdio.h>
 
 
-int rmdWriteSpecsFile(ProgData *pdata) {
-	
+int rmdWriteSpecsFile(ProgData *pdata)
+{
 	FILE *fp;
 
 	fp=fopen(pdata->cache_data->specsfile,"wb");
@@ -63,7 +63,8 @@ int rmdWriteSpecsFile(ProgData *pdata) {
 	return 0;
 }
 
-int rmdReadSpecsFile(ProgData *pdata) {
+int rmdReadSpecsFile(ProgData *pdata)
+{
 	char Cached_Version[256];
 	FILE *fp;
 
diff --git a/src/rmd_threads.c b/src/rmd_threads.c
index 7facba0..40fe94a 100644
--- a/src/rmd_threads.c
+++ b/src/rmd_threads.c
@@ -47,7 +47,8 @@
 #include <time.h>
 #include <unistd.h>
 
-void rmdThreads(ProgData *pdata) {
+void rmdThreads(ProgData *pdata)
+{
 	pthread_t	image_capture_t,
 			image_encode_t,
 			image_cache_t,
@@ -170,6 +171,7 @@ void rmdThreads(ProgData *pdata) {
 	pthread_join(timer_t,NULL);
 }
 
-void rmdThreadsSetName(const char *name) {
+void rmdThreadsSetName(const char *name)
+{
 	prctl(PR_SET_NAME, (unsigned long)name, 0, 0, 0);
 }
diff --git a/src/rmd_timer.c b/src/rmd_timer.c
index dd7b26c..ed49520 100644
--- a/src/rmd_timer.c
+++ b/src/rmd_timer.c
@@ -47,7 +47,8 @@ static struct timespec us_to_timespec(unsigned int us)
 	};
 }
 
-static void sync_streams(ProgData *pdata, unsigned int *frame_step, struct timespec *delay) {
+static void sync_streams(ProgData *pdata, unsigned int *frame_step, struct timespec *delay)
+{
 	int	avd;
 
 	pthread_mutex_lock(&pdata->avd_mutex);
@@ -91,8 +92,8 @@ static void sync_streams(ProgData *pdata, unsigned int *frame_step, struct times
 #endif
 }
 
-void *rmdTimer(ProgData *pdata) {
-
+void *rmdTimer(ProgData *pdata)
+{
 	rmdThreadsSetName("rmdTimer");
 
 	while (pdata->timer_alive) {
diff --git a/src/rmd_update_image.c b/src/rmd_update_image.c
index 343e1bb..3948af2 100644
--- a/src/rmd_update_image.c
+++ b/src/rmd_update_image.c
@@ -47,8 +47,8 @@ void rmdUpdateImage(	Display * dpy,
 			Image *image,
 			int noshmem,
 			int shm_opcode,
-			int no_quick_subsample){
-
+			int no_quick_subsample)
+{
 	RectArea *temp;
 
 	for (temp = *root; temp; temp = temp->next) {
diff --git a/src/rmd_wm_check.c b/src/rmd_wm_check.c
index 4934425..5185dad 100644
--- a/src/rmd_wm_check.c
+++ b/src/rmd_wm_check.c
@@ -32,7 +32,8 @@
 #include <X11/Xatom.h>
 
 
-char *rmdWMCheck(Display *dpy,Window root) {
+char *rmdWMCheck(Display *dpy,Window root)
+{
 	Window  	*wm_child=NULL;
 	Atom		nwm_atom,
 			utf8_string,
diff --git a/src/rmd_wm_is_compositing.c b/src/rmd_wm_is_compositing.c
index bc43282..95bc307 100644
--- a/src/rmd_wm_is_compositing.c
+++ b/src/rmd_wm_is_compositing.c
@@ -35,7 +35,8 @@
 #include <stdlib.h>
 
 
-boolean rmdWMIsCompositing( Display *dpy, int screen ) {
+boolean rmdWMIsCompositing(Display *dpy, int screen)
+{
 	Window win;
 	Atom atom;
 	char buf[32];
diff --git a/src/rmd_yuv_utils.c b/src/rmd_yuv_utils.c
index 609511a..21bce16 100644
--- a/src/rmd_yuv_utils.c
+++ b/src/rmd_yuv_utils.c
@@ -41,7 +41,8 @@ unsigned char	*yblocks,
 		*ublocks,
 		*vblocks;
 
-void rmdMakeMatrices (void) {
+void rmdMakeMatrices (void)
+{
 	int i;
 
  	/* assuming 8-bit precision */
@@ -374,8 +375,8 @@ void rmdUpdateYuvBuffer(	yuv_buffer *yuv,
 				int width_tm,
 				int height_tm,
 				int sampling,
-				int depth) {
-
+				int depth)
+{
 	if (data_back == NULL) {
 		switch (depth) {
 		case 24:
@@ -415,8 +416,8 @@ void rmdDummyPointerToYuv(	yuv_buffer *yuv,
 				int height_tm,
 				int x_offset,
 				int y_offset,
-				unsigned char no_pixel) {
-
+				unsigned char no_pixel)
+{
 	int i, k, j = 0;
 	int x_2 = x_tm / 2, y_2 = y_tm / 2, y_width_2 = yuv->y_width/2;
 
@@ -443,7 +444,6 @@ void rmdDummyPointerToYuv(	yuv_buffer *yuv,
 			}
 		}
 	}
-
 }
 
 static inline unsigned char avg_4_pixels(	unsigned char *data_array,
@@ -452,7 +452,6 @@ static inline unsigned char avg_4_pixels(	unsigned char *data_array,
 						int i_tm,
 						int offset)
 {
-
     return 	((data_array[(k_tm*width_img+i_tm)*RMD_ULONG_SIZE_T+offset]+
 		data_array[((k_tm-1)*width_img+i_tm)*RMD_ULONG_SIZE_T+offset]+
 		data_array[(k_tm*width_img+i_tm-1)*RMD_ULONG_SIZE_T+offset]+
@@ -467,8 +466,8 @@ void rmdXFixesPointerToYuv(	yuv_buffer *yuv,
 				int height_tm,
 				int x_offset,
 				int y_offset,
-				int column_discard_stride) {
-
+				int column_discard_stride)
+{
 	unsigned char	avg0, avg1, avg2, avg3;
 	int		x_2 = x_tm / 2, y_2 = y_tm / 2;
 
diff --git a/src/test-rectinsert.c b/src/test-rectinsert.c
index 71d2030..40c2ce3 100644
--- a/src/test-rectinsert.c
+++ b/src/test-rectinsert.c
@@ -29,7 +29,8 @@
 
 
 
-static void rmdSetPixel(boolean *state, int x, int y, boolean value) {
+static void rmdSetPixel(boolean *state, int x, int y, boolean value)
+{
     int index = y * STATE_WIDTH + x;
 
     // Guard against non-optimal implementations
@@ -40,7 +41,8 @@ static void rmdSetPixel(boolean *state, int x, int y, boolean value) {
     state[y * STATE_WIDTH + x] = value;
 }
 
-static boolean rmdGetPixel(boolean *state, int x, int y) {
+static boolean rmdGetPixel(boolean *state, int x, int y)
+{
     int index = y * STATE_WIDTH + x;
 
     // Guard against non-optimal implementations
@@ -51,7 +53,8 @@ static boolean rmdGetPixel(boolean *state, int x, int y) {
     return state[y * STATE_WIDTH + x];
 }
 
-static void rmdWriteGeomToState(XRectangle *rect, boolean *state) {
+static void rmdWriteGeomToState(XRectangle *rect, boolean *state)
+{
     int x, y;
 
     for (y = rect->y; y < rect->y + rect->height; y++) {
@@ -61,7 +64,8 @@ static void rmdWriteGeomToState(XRectangle *rect, boolean *state) {
     }
 }
 
-static void rmdClearState(boolean *state) {
+static void rmdClearState(boolean *state)
+{
     int x, y;
 
     for (y = 0; y < STATE_HEIGHT; y++) {
@@ -71,7 +75,8 @@ static void rmdClearState(boolean *state) {
     }
 }
 
-static void rmdWarnIfNonOptimal(XRectangle *rect) {
+static void rmdWarnIfNonOptimal(XRectangle *rect)
+{
     if (rect->x      < 0 || rect->x      >= STATE_WIDTH  ||
         rect->y      < 0 || rect->y      >= STATE_HEIGHT ||
         rect->width  == 0 || rect->width  >  STATE_WIDTH  ||
@@ -87,7 +92,8 @@ static void rmdWarnIfNonOptimal(XRectangle *rect) {
     }
 }
 
-static void GetState(RectArea *root, boolean *state) {
+static void GetState(RectArea *root, boolean *state)
+{
     RectArea *current = root;
 
     rmdClearState(state);
@@ -102,7 +108,8 @@ static void GetState(RectArea *root, boolean *state) {
     }
 }
  
-static boolean rmdStatesEqual(boolean *a, boolean *b) {
+static boolean rmdStatesEqual(boolean *a, boolean *b)
+{
     int x, y;
 
     for (y = 0; y < STATE_HEIGHT; y++) {
@@ -116,7 +123,8 @@ static boolean rmdStatesEqual(boolean *a, boolean *b) {
     return TRUE;
 }
 
-static void rmdPrintState(boolean *state) {
+static void rmdPrintState(boolean *state)
+{
     int x, y;
     
     for (y = 0; y < STATE_HEIGHT; y++) {
@@ -138,7 +146,8 @@ static void rmdPrintState(boolean *state) {
  * rmdRectInsert() with various testdata and after each call comparing
  * the current state with a predefied set of expected states.
  */
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
     boolean current_state[STATE_WIDTH * STATE_HEIGHT];
     RectArea *root = NULL;
     int i = 0;
-- 
cgit v1.2.3