summaryrefslogtreecommitdiff
path: root/recordmydesktop
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-07-04 15:10:54 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-07-11 13:36:41 -0700
commitfea85626dde939653c02405d37eb8cb6b41f09e2 (patch)
tree2fe5ac89add8dc494138f6024e9af4240d77906c /recordmydesktop
parente4c798757f858cf437d17a1b32770ad8550e986e (diff)
*: more random formatting cleanups
nothing functionally different
Diffstat (limited to 'recordmydesktop')
-rw-r--r--recordmydesktop/src/rmd_get_frame.c78
-rw-r--r--recordmydesktop/src/rmd_load_cache.c16
-rw-r--r--recordmydesktop/src/rmd_rectinsert.c1
3 files changed, 49 insertions, 46 deletions
diff --git a/recordmydesktop/src/rmd_get_frame.c b/recordmydesktop/src/rmd_get_frame.c
index c2d109d..39392b0 100644
--- a/recordmydesktop/src/rmd_get_frame.c
+++ b/recordmydesktop/src/rmd_get_frame.c
@@ -157,7 +157,7 @@ static int rmdFirstFrame(ProgData *pdata, XImage **image, XShmSegmentInfo *shmin
brwin->rrect.width,
brwin->rrect.height);
} else {
- (*image)=XShmCreateImage( pdata->dpy,
+ (*image) = XShmCreateImage( pdata->dpy,
pdata->specs.visual,
pdata->specs.depth,
ZPixmap,
@@ -167,7 +167,7 @@ static int rmdFirstFrame(ProgData *pdata, XImage **image, XShmSegmentInfo *shmin
brwin->rrect.height);
(*shminfo).shmid = shmget(IPC_PRIVATE,
- (*image)->bytes_per_line*
+ (*image)->bytes_per_line *
(*image)->height,
IPC_CREAT|0777);
@@ -176,10 +176,10 @@ static int rmdFirstFrame(ProgData *pdata, XImage **image, XShmSegmentInfo *shmin
return 12;
}
- (*shminfo).shmaddr=(*image)->data=shmat((*shminfo).shmid, NULL,0);
+ (*shminfo).shmaddr = (*image)->data = shmat((*shminfo).shmid, NULL,0);
(*shminfo).readOnly = False;
- if (!XShmAttach(pdata->dpy,shminfo)) {
+ if (!XShmAttach(pdata->dpy, shminfo)) {
fprintf(stderr,"Failed to attach shared memory to proccess.\n");
return 12;
}
@@ -281,7 +281,7 @@ void *rmdGetFrame(ProgData *pdata) {
XShmSegmentInfo shminfo, shminfo_back; //info structure for the image above.
int init_img1 = 0, init_img2 = 0, img_sel, d_buff;
- img_sel=d_buff=pdata->args.full_shots;
+ img_sel = d_buff = pdata->args.full_shots;
if ((init_img1 = rmdFirstFrame(pdata,&image,&shminfo) != 0)) {
if (pdata->args.encOnTheFly) {
@@ -316,7 +316,7 @@ void *rmdGetFrame(ProgData *pdata) {
}
if (!pdata->args.noframe) {
- pdata->shaped_w=rmdFrameInit( pdata->dpy,
+ pdata->shaped_w = rmdFrameInit( pdata->dpy,
pdata->specs.screen,
pdata->specs.root,
pdata->brwin.rrect.x,
@@ -324,13 +324,13 @@ void *rmdGetFrame(ProgData *pdata) {
pdata->brwin.rrect.width,
pdata->brwin.rrect.height);
- XSelectInput(pdata->dpy,pdata->shaped_w,ExposureMask);
+ XSelectInput(pdata->dpy, pdata->shaped_w, ExposureMask);
}
- mouse_pos_abs.x=mouse_pos_temp.x=0;
- mouse_pos_abs.y=mouse_pos_temp.y=0;
- mouse_pos_abs.width=mouse_pos_temp.width=pdata->dummy_p_size;
- mouse_pos_abs.height=mouse_pos_temp.height=pdata->dummy_p_size;
+ mouse_pos_abs.x = mouse_pos_temp.x = 0;
+ mouse_pos_abs.y = mouse_pos_temp.y = 0;
+ mouse_pos_abs.width = mouse_pos_temp.width = pdata->dummy_p_size;
+ mouse_pos_abs.height = mouse_pos_temp.height = pdata->dummy_p_size;
//This is the the place where we call XSelectInput
//and arrange so that we listen for damage on all
@@ -462,31 +462,32 @@ void *rmdGetFrame(ProgData *pdata) {
rmdBlocksFromList( &pdata->rect_root,
temp_brwin.rrect.x,
temp_brwin.rrect.y,
- pdata->enc_data->yuv.y_width/Y_UNIT_WIDTH,
- pdata->enc_data->yuv.y_height/Y_UNIT_WIDTH);
+ pdata->enc_data->yuv.y_width / Y_UNIT_WIDTH,
+ pdata->enc_data->yuv.y_height / Y_UNIT_WIDTH);
pthread_mutex_unlock(&pdata->yuv_mutex);
} else {
- unsigned char *front_buff=(!img_sel)?((unsigned char*)image->data):
+ unsigned char *front_buff = !img_sel ? ((unsigned char*)image->data):
((unsigned char*)image_back->data);
- unsigned char *back_buff=(!d_buff)?NULL:((img_sel)?
+ unsigned char *back_buff = !d_buff ? NULL : (img_sel ?
((unsigned char*)image->data):
((unsigned char*)image_back->data));
if (!pdata->args.noshared)
- XShmGetImage(pdata->dpy,pdata->specs.root,
- ((!img_sel)?image:image_back),
- (temp_brwin.rrect.x),
- (temp_brwin.rrect.y),AllPlanes);
+ XShmGetImage( pdata->dpy,
+ pdata->specs.root,
+ ((!img_sel) ? image : image_back),
+ temp_brwin.rrect.x,
+ temp_brwin.rrect.y, AllPlanes);
if (pdata->args.noshared)
- rmdGetZPixmap( pdata->dpy,
- pdata->specs.root,
- image->data,
- temp_brwin.rrect.x,
- temp_brwin.rrect.y,
- temp_brwin.rrect.width,
- temp_brwin.rrect.height);
+ rmdGetZPixmap( pdata->dpy,
+ pdata->specs.root,
+ image->data,
+ temp_brwin.rrect.x,
+ temp_brwin.rrect.y,
+ temp_brwin.rrect.width,
+ temp_brwin.rrect.height);
pthread_mutex_lock(&pdata->yuv_mutex);
for(int i = 0; i < blocknum_x * blocknum_y; i++)
@@ -507,21 +508,23 @@ void *rmdGetFrame(ProgData *pdata) {
if (pdata->args.xfixes_cursor || pdata->args.have_dummy_cursor) {
int mouse_xoffset, mouse_yoffset;
+
//avoid segfaults
clip_dummy_pointer_area(&mouse_pos_abs, &temp_brwin.rrect, &mouse_pos_temp);
- mouse_xoffset=mouse_pos_temp.x-mouse_pos_abs.x;
- mouse_yoffset=mouse_pos_temp.y-mouse_pos_abs.y;
- if ((mouse_xoffset<0) || (mouse_xoffset>mouse_pos_abs.width))
- mouse_xoffset=0;
+ mouse_xoffset = mouse_pos_temp.x - mouse_pos_abs.x;
+ mouse_yoffset = mouse_pos_temp.y - mouse_pos_abs.y;
+
+ if ((mouse_xoffset < 0) || (mouse_xoffset > mouse_pos_abs.width))
+ mouse_xoffset = 0;
- if ((mouse_yoffset<0) || (mouse_yoffset>mouse_pos_abs.height))
- mouse_yoffset=0;
+ if ((mouse_yoffset < 0) || (mouse_yoffset > mouse_pos_abs.height))
+ mouse_yoffset = 0;
//draw the cursor
- if ( (mouse_pos_temp.x>=0)&&
- (mouse_pos_temp.y>=0)&&
- (mouse_pos_temp.width>0)&&
- (mouse_pos_temp.height>0)) {
+ if ( (mouse_pos_temp.x >= 0) &&
+ (mouse_pos_temp.y >= 0) &&
+ (mouse_pos_temp.width > 0) &&
+ (mouse_pos_temp.height > 0)) {
if (pdata->args.xfixes_cursor) {
rmdXFixesPointerToYuv(
@@ -554,7 +557,8 @@ void *rmdGetFrame(ProgData *pdata) {
//on the currently front buffer (which
//will be the back buffer next time it's
//used)
- unsigned char *front_buff = (!img_sel)?((unsigned char*)image->data):
+ unsigned char *front_buff = !img_sel ?
+ ((unsigned char*)image->data) :
((unsigned char*)image_back->data);
mark_buffer_area(
diff --git a/recordmydesktop/src/rmd_load_cache.c b/recordmydesktop/src/rmd_load_cache.c
index 415ace8..297b1a0 100644
--- a/recordmydesktop/src/rmd_load_cache.c
+++ b/recordmydesktop/src/rmd_load_cache.c
@@ -89,13 +89,13 @@ static int rmdReadZF(void * buffer, size_t size, size_t nmemb, FILE *ucfp, gzFil
(ifp == NULL && ucfp == NULL))
return -1;
else if (ucfp != NULL) {
- return (size * fread(buffer, size, nmemb, ucfp));
+ return size * fread(buffer, size, nmemb, ucfp);
} else
return gzread(ifp, buffer, size * nmemb);
}
static int rmdReadFrame(CachedFrame *frame, FILE *ucfp, gzFile ifp) {
- int index_entry_size = sizeof(u_int32_t);
+ int index_entry_size = sizeof(u_int32_t);
if (frame->header->Ynum > 0) {
if (rmdReadZF( frame->YBlocks,
@@ -170,10 +170,10 @@ void *rmdLoadCache(ProgData *pdata) {
CachedFrame frame;
int nth_cache = 1,
audio_end = 0,
- extra_frames = 0,//total number of duplicated frames
- missing_frames = 0,//if this is found >0 current run will not load
- //a frame but it will proccess the previous
- thread_exit = 0,//0 success, -1 couldn't find files,1 couldn't remove
+ extra_frames = 0, //total number of duplicated frames
+ missing_frames = 0, //if this is found >0 current run will not load
+ //a frame but it will proccess the previous
+ thread_exit = 0, //0 success, -1 couldn't find files,1 couldn't remove
blocknum_x = pdata->enc_data->yuv.y_width / Y_UNIT_WIDTH,
blocknum_y = pdata->enc_data->yuv.y_height / Y_UNIT_WIDTH,
blockszy = Y_UNIT_BYTES,//size of y plane block in bytes
@@ -246,9 +246,9 @@ void *rmdLoadCache(ProgData *pdata) {
if ( (frame.header->Ynum <= blocknum_x * blocknum_y) &&
(frame.header->Unum <= blocknum_x * blocknum_y) &&
(frame.header->Vnum <= blocknum_x * blocknum_y) &&
- (!rmdReadFrame( &frame,
+ !rmdReadFrame( &frame,
(pdata->args.zerocompression ? ucfp : NULL),
- (pdata->args.zerocompression ? NULL : ifp)))
+ (pdata->args.zerocompression ? NULL : ifp))
) {
//load the blocks for each buffer
diff --git a/recordmydesktop/src/rmd_rectinsert.c b/recordmydesktop/src/rmd_rectinsert.c
index acb4aae..c9b81b9 100644
--- a/recordmydesktop/src/rmd_rectinsert.c
+++ b/recordmydesktop/src/rmd_rectinsert.c
@@ -490,7 +490,6 @@ void rmdClearList(RectArea **root) {
while (temp->next!=NULL) {
temp=temp->next;
free(temp->prev);
-
}
free(temp);
*root=NULL;
© All Rights Reserved