[comp.sources.x] v04i003: xcutbuf, Patch1

argv@island.uu.net (Dan Heller) (05/20/89)

Submitted-by: Dave Curry <davy@riacs.edu>
Posting-number: Volume 4, Issue 3
Archive-name: xcutbuf/patch1

***************

*** 1,5
  /*
!  * $Header: /usr/local/src/source/X.V11R3/contrib/clients/xcutbuf/RCS/patchlevel.h,v 1.1 89/05/02 11:04:40 davy Exp $
   *
   * patchlevel.h
   *

--- 1,5 -----
  /*
!  * $Header: /usr/local/src/source/X.V11R3/contrib/clients/xcutbuf/RCS/patchlevel.h,v 1.2 89/05/08 09:48:34 davy Exp $
   *
   * patchlevel.h
   *
***************
*** 11,16
   * davy@riacs.edu
   *
   * $Log:	patchlevel.h,v $
   * Revision 1.1  89/05/02  11:04:40  davy
   * Initial revision
   * 

--- 11,19 -----
   * davy@riacs.edu
   *
   * $Log:	patchlevel.h,v $
+  * Revision 1.2  89/05/08  09:48:34  davy
+  * Fix to avoid calling XFree with a null value.
+  * 
   * Revision 1.1  89/05/02  11:04:40  davy
   * Initial revision
   * 
***************
*** 16,19
   * 
   */
  
! #define PatchLevel	0

--- 19,22 -----
   * 
   */
  
! #define PatchLevel	1
*** /tmp/,RCSt1a07405	Mon May  8 09:49:59 1989
--- xcutbuf.c	Mon May  8 09:48:52 1989
***************
*** 1,5
  #ifndef lint
! static char *RCSid = "$Header: /usr/local/src/source/X.V11R3/contrib/clients/xcutbuf/RCS/xcutbuf.c,v 1.1 89/05/02 11:04:47 davy Exp $";
  #endif
  /*
   * xcutbuf - X11 cut buffer manager

--- 1,5 -----
  #ifndef lint
! static char *RCSid = "$Header: /usr/local/src/source/X.V11R3/contrib/clients/xcutbuf/RCS/xcutbuf.c,v 1.2 89/05/08 09:48:49 davy Exp $";
  #endif
  /*
   * xcutbuf - X11 cut buffer manager
***************
*** 23,28
   * davy@riacs.edu
   *
   * $Log:	xcutbuf.c,v $
   * Revision 1.1  89/05/02  11:04:47  davy
   * Initial revision
   * 

--- 23,31 -----
   * davy@riacs.edu
   *
   * $Log:	xcutbuf.c,v $
+  * Revision 1.2  89/05/08  09:48:49  davy
+  * Fix to avoid calling XFree with a null value.
+  * 
   * Revision 1.1  89/05/02  11:04:47  davy
   * Initial revision
   * 
***************
*** 256,262
  			/*
  			 * Free the X resource we got from XFetchBuffer.
  			 */
! 			XFree(buffer);
  		}
  	}
  	else {

--- 259,266 -----
  			/*
  			 * Free the X resource we got from XFetchBuffer.
  			 */
! 			if (buffer)
! 				XFree(buffer);
  		}
  	}
  	else {
***************
*** 291,297
  		/*
  		 * Free the X resource we got from XFetchBuffer.
  		 */
! 		XFree(buffer);
  	}
  }
  

--- 295,302 -----
  		/*
  		 * Free the X resource we got from XFetchBuffer.
  		 */
! 		if (buffer)
! 			XFree(buffer);
  	}
  }
  

*** /tmp/,RCSt1a07683	Mon May  8 11:14:27 1989
--- patchlevel.h	Mon May  8 11:09:49 1989
***************
*** 1,5
  /*
!  * $Header: /usr/local/src/sun3/X.V11R3/contrib/clients/xcutbuf/RCS/patchlevel.h,v 1.2 89/05/08 09:48:34 davy Exp $
   *
   * patchlevel.h
   *

--- 1,5 -----
  /*
!  * $Header: /usr/local/src/source/X.V11R3/contrib/clients/xcutbuf/RCS/patchlevel.h,v 1.3 89/05/08 11:09:27 davy Exp $
   *
   * patchlevel.h
   *
***************
*** 11,16
   * davy@riacs.edu
   *
   * $Log:	patchlevel.h,v $
   * Revision 1.2  89/05/08  09:48:34  davy
   * Fix to avoid calling XFree with a null value.
   * 

--- 11,19 -----
   * davy@riacs.edu
   *
   * $Log:	patchlevel.h,v $
+  * Revision 1.3  89/05/08  11:09:27  davy
+  * Fixed to properly handle buffer numbers after -list, -contents, -rotate.
+  * 
   * Revision 1.2  89/05/08  09:48:34  davy
   * Fix to avoid calling XFree with a null value.
   * 
***************
*** 19,22
   * 
   */
  
! #define PatchLevel	1

--- 22,25 -----
   * 
   */
  
! #define PatchLevel	2
*** /tmp/,RCSt1a07683	Mon May  8 11:14:30 1989
--- xcutbuf.c	Mon May  8 11:09:52 1989
***************
*** 1,5
  #ifndef lint
! static char *RCSid = "$Header: /usr/local/src/sun3/X.V11R3/contrib/clients/xcutbuf/RCS/xcutbuf.c,v 1.2 89/05/08 09:48:49 davy Exp $";
  #endif
  /*
   * xcutbuf - X11 cut buffer manager

--- 1,5 -----
  #ifndef lint
! static char *RCSid = "$Header: /usr/local/src/source/X.V11R3/contrib/clients/xcutbuf/RCS/xcutbuf.c,v 1.3 89/05/08 11:09:49 davy Exp $";
  #endif
  /*
   * xcutbuf - X11 cut buffer manager
***************
*** 23,28
   * davy@riacs.edu
   *
   * $Log:	xcutbuf.c,v $
   * Revision 1.2  89/05/08  09:48:49  davy
   * Fix to avoid calling XFree with a null value.
   * 

--- 23,31 -----
   * davy@riacs.edu
   *
   * $Log:	xcutbuf.c,v $
+  * Revision 1.3  89/05/08  11:09:49  davy
+  * Fixed to properly handle buffer numbers after -list, -contents, -rotate.
+  * 
   * Revision 1.2  89/05/08  09:48:49  davy
   * Fix to avoid calling XFree with a null value.
   * 
***************
*** 88,93
  				usage();
  
  			bnum = atoi(*++argv);
  			continue;
  		}
  

--- 91,97 -----
  				usage();
  
  			bnum = atoi(*++argv);
+ 			CheckBounds(bnum);
  			continue;
  		}
  
***************
*** 100,106
  				usage();
  
  			if (argc == 0) {
! 				rotate = DEFAULT_ROTATE;
  			}
  			else {
  				rotate = atoi(*++argv);

--- 104,110 -----
  				usage();
  
  			if (argc == 0) {
! 				bnum = DEFAULT_ROTATE;
  			}
  			else {
  				bnum = atoi(*++argv);
***************
*** 103,110
  				rotate = DEFAULT_ROTATE;
  			}
  			else {
! 				rotate = atoi(*++argv);
! 				CheckBounds(rotate);
  			}
  
  			continue;

--- 107,114 -----
  				bnum = DEFAULT_ROTATE;
  			}
  			else {
! 				bnum = atoi(*++argv);
! 				CheckBounds(bnum);
  			}
  
  			rotate = 1;
***************
*** 107,112
  				CheckBounds(rotate);
  			}
  
  			continue;
  		}
  

--- 111,117 -----
  				CheckBounds(bnum);
  			}
  
+ 			rotate = 1;
  			continue;
  		}
  
***************
*** 119,125
  				usage();
  
  			if (argc == 0) {
! 				contents = DEFAULT_LIST;
  			}
  			else {
  				contents = atoi(*++argv);

--- 124,130 -----
  				usage();
  
  			if (argc == 0) {
! 				bnum = DEFAULT_LIST;
  			}
  			else {
  				bnum = atoi(*++argv);
***************
*** 122,129
  				contents = DEFAULT_LIST;
  			}
  			else {
! 				contents = atoi(*++argv);
! 				CheckBounds(contents);
  			}
  
  			continue;

--- 127,134 -----
  				bnum = DEFAULT_LIST;
  			}
  			else {
! 				bnum = atoi(*++argv);
! 				CheckBounds(bnum);
  			}
  
  			contents = 1;
***************
*** 126,131
  				CheckBounds(contents);
  			}
  
  			continue;
  		}
  

--- 131,137 -----
  				CheckBounds(bnum);
  			}
  
+ 			contents = 1;
  			continue;
  		}
  
***************
*** 139,145
  				usage();
  
  			if (argc == 0) {
! 				list = DEFAULT_LIST;
  			}
  			else {
  				list = atoi(*++argv);

--- 145,151 -----
  				usage();
  
  			if (argc == 0) {
! 				bnum = DEFAULT_LIST;
  			}
  			else {
  				bnum = atoi(*++argv);
***************
*** 142,149
  				list = DEFAULT_LIST;
  			}
  			else {
! 				list = atoi(*++argv);
! 				CheckBounds(list);
  			}
  
  			continue;

--- 148,155 -----
  				bnum = DEFAULT_LIST;
  			}
  			else {
! 				bnum = atoi(*++argv);
! 				CheckBounds(bnum);
  			}
  
  			list = 1;
***************
*** 146,151
  				CheckBounds(list);
  			}
  
  			continue;
  		}
  

--- 152,158 -----
  				CheckBounds(bnum);
  			}
  
+ 			list = 1;
  			continue;
  		}
  
***************
*** 193,199
  	 * Go do our thing.
  	 */
  	if (contents)
! 		ListCutBuffers(display, contents, 1);
  	else if (list)
  		ListCutBuffers(display, list, 0);
  	else if (rotate)

--- 200,206 -----
  	 * Go do our thing.
  	 */
  	if (contents)
! 		ListCutBuffers(display, bnum, 1);
  	else if (list)
  		ListCutBuffers(display, bnum, 0);
  	else if (rotate)
***************
*** 195,201
  	if (contents)
  		ListCutBuffers(display, contents, 1);
  	else if (list)
! 		ListCutBuffers(display, list, 0);
  	else if (rotate)
  		RotateCutBuffers(display, rotate);
  	else if (stuff)

--- 202,208 -----
  	if (contents)
  		ListCutBuffers(display, bnum, 1);
  	else if (list)
! 		ListCutBuffers(display, bnum, 0);
  	else if (rotate)
  		RotateCutBuffers(display, bnum);
  	else if (stuff)
***************
*** 197,203
  	else if (list)
  		ListCutBuffers(display, list, 0);
  	else if (rotate)
! 		RotateCutBuffers(display, rotate);
  	else if (stuff)
  		StuffCutBuffers(display, filename, bnum, argc, argv);
  

--- 204,210 -----
  	else if (list)
  		ListCutBuffers(display, bnum, 0);
  	else if (rotate)
! 		RotateCutBuffers(display, bnum);
  	else if (stuff)
  		StuffCutBuffers(display, filename, bnum, argc, argv);