[Xcb-commit] xcb-demo/tests lissajoux.c,1.6,1.7

Bart Massey xcb-commit at lists.freedesktop.org
Sat Dec 17 23:51:24 PST 2005


Update of /cvs/xcb/xcb-demo/tests
In directory gabe:/tmp/cvs-serv23821/tests

Modified Files:
	lissajoux.c 
Log Message:
Fixed bad bug in test_shm() ---"data" parameter needed to be passed
by address.  Shared memory case works now.



Index: lissajoux.c
===================================================================
RCS file: /cvs/xcb/xcb-demo/tests/lissajoux.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- lissajoux.c	18 Dec 2005 04:24:01 -0000	1.6
+++ lissajoux.c	18 Dec 2005 07:51:20 -0000	1.7
@@ -120,12 +120,12 @@
 
 /* Return 0 if shm is not availaible, 1 otherwise */
 void
-shm_test (Data data)
+shm_test (Data *datap)
 {
   XCBShmQueryVersionRep *rep;
 
-  rep = XCBShmQueryVersionReply (data.conn,
-				 XCBShmQueryVersion (data.conn),
+  rep = XCBShmQueryVersionReply (datap->conn,
+				 XCBShmQueryVersion (datap->conn),
 				 NULL);
   if (rep)
     {
@@ -136,25 +136,25 @@
 	format = rep->pixmap_format;
       else
 	format = 0;
-      data.image = XCBImageSHMCreate (data.conn, data.depth,
+      datap->image = XCBImageSHMCreate (datap->conn, datap->depth,
 				      format, NULL, W_W, W_H);
-      assert(data.image);
+      assert(datap->image);
 
       shminfo.shmid = shmget (IPC_PRIVATE,
-			      data.image->bytes_per_line*data.image->height,
+			      datap->image->bytes_per_line*datap->image->height,
 			      IPC_CREAT | 0777);
       assert(shminfo.shmid != -1);
       shminfo.shmaddr = shmat (shminfo.shmid, 0, 0);
       assert(shminfo.shmaddr);
-      data.image->data = shminfo.shmaddr;
+      datap->image->data = shminfo.shmaddr;
 
-      shminfo.shmseg = XCBShmSEGNew (data.conn);
-      XCBShmAttach (data.conn, shminfo.shmseg,
+      shminfo.shmseg = XCBShmSEGNew (datap->conn);
+      XCBShmAttach (datap->conn, shminfo.shmseg,
 		    shminfo.shmid, 0);
       assert(shmctl(shminfo.shmid, IPC_RMID, 0) != -1);
     }
 
-  if (data.image)
+  if (datap->image)
     {
       printf ("Use of shm.\n");
       do_shm = 1;
@@ -164,7 +164,7 @@
       printf ("Can't use shm. Use standard functions.\n");
       shmdt (shminfo.shmaddr);		       
       shmctl (shminfo.shmid, IPC_RMID, 0);
-      data.image = NULL;
+      datap->image = NULL;
     }
 }
 
@@ -242,7 +242,7 @@
   XCBSync (data.conn, 0); 
 
   if (try_shm)
-    shm_test (data);
+    shm_test (&data);
 
   time_start = get_time ();
   t_previous = 0.0;



More information about the xcb-commit mailing list