403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/ports/games/xjig/files/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/ports/games/xjig/files/patch-reset_image.H
--- reset_image.H.orig	Wed Jul 17 02:59:50 1996
+++ reset_image.H	Fri Aug  6 03:12:24 2004
@@ -16,15 +16,25 @@
 // to access data beyond the allocated image, that might lead to a segmentation
 // violation. Therefore, it might be good to allocated some additional
 // rows of data for the image.
-	offset_bytes=xwidth*offset_rows*sizeof(DATA_TYPE);
-	xdata=new DATA_TYPE[xwidth*(xheight+2*offset_rows)];
+
+	extern int scanline_pad;
+
+	int byte_pad = scanline_pad / 8;
+
+	offset_bytes=xwidth*offset_rows*DATA_BYTES;
+	// xdata=new DATA_TYPE[xwidth*(xheight+2*offset_rows)];
+
+	xdata=(DATA_TYPE*)new char[DATA_BYTES*xwidth*(xheight+2*offset_rows)];
 	{	DATA_TYPE	*xdata_run=xdata;
 		unsigned long blk_pixel=BlackPixel(dpy,scr);
 		for (int i=xwidth*(xheight+2*offset_rows);i>0;i--) {
-			*xdata_run++=(DATA_TYPE)blk_pixel;
+			// *xdata_run++=(DATA_TYPE)blk_pixel;
+			*xdata_run=(DATA_TYPE)blk_pixel; // align fault
+			char *my_xdata_run = (char *)xdata_run;
+			my_xdata_run += DATA_BYTES;
 		}
 	}
-	xdata+=(offset_bytes/sizeof(DATA_TYPE));
+	xdata+=(offset_bytes/DATA_BYTES);
 
 	if (!xdata) {
 		fprintf(stderr,"not enough memory for XImage-data");
@@ -32,9 +42,11 @@
 	}
 
 // create the XImage
+
 	ximage = XCreateImage(dpy, DefaultVisual(dpy,scr),
-				DefaultDepth(dpy,scr), ZPixmap, 0,
-				(char*)xdata, xwidth, xheight, 8*DATA_PAD, xwidth*sizeof(DATA_TYPE));
+			DefaultDepth(dpy,scr), ZPixmap, 0,
+			(char*)xdata, xwidth, xheight, scanline_pad,
+			((xwidth*DATA_BYTES + byte_pad - 1)/byte_pad) * byte_pad);
 
 	if (!ximage) {
 		fprintf(stderr,"\n*** can't allocate ximage.\n" );
@@ -47,9 +59,23 @@
 		register const byte	*org  = Data();
 		register int	j,i;
 
-		for (i=0; i<Height(); i++) {
-			for (j=0; j<Width(); j++) 
-				*copy++ = (DATA_TYPE)gif_cols[*org++];
+		extern int pixmap_depth;
+
+		switch(pixmap_depth) {
+		case 8:		// power of two covered by basic data type
+		case 16:
+		case 32:
+			for (i=0; i<Height(); i++) {
+				for (j=0; j<Width(); j++) 
+					*copy++ = (DATA_TYPE)gif_cols[*org++];
+			}
+			break;
+		case 24:
+			for (i=0; i<Height(); i++) {
+				for (j=0; j<Width(); j++) 
+					XPutPixel(ximage,j,i,gif_cols[*org++]);
+			}
+			break;
 		}
 	}
 	else {

Youez - 2016 - github.com/yon3zu
LinuXploit