Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2007 20:35:00 +0200
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        freebsd-ports@freebsd.org
Subject:   Re: fix for ghostscript gpl on current?
Message-ID:  <20070611203500.6d0d4238@deskjail>
In-Reply-To: <20070607200602.35a0ee2a@deskjail>
References:  <20070607200602.35a0ee2a@deskjail>

next in thread | previous in thread | raw e-mail | index | archive | help
--MP_+eRwfVrMvhuumfY5MPARDN6
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Quoting Alexander Leidinger <Alexander@Leidinger.net> (Thu, 7 Jun 2007 20:06:02 +0200):

> Hi,
> 
> does someone has a fix for the illegal instruction problem (gcc inserts
> an illegal instruction instead of bailing out with an error on some
> special kind of bad C code) with ghostscript gpl on current?

As nobody seems to have the same problem here's the patch (maybe crude
but "quick") for the archives in case someone needs it too.

Bye,
Alexander.

-- 
Other people's romantic gestures seem novel and exciting.

Your own romantic gestures seem fooolish and clumsy.
http://www.Leidinger.net  Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org     netchild @ FreeBSD.org  : PGP ID = 72077137

--MP_+eRwfVrMvhuumfY5MPARDN6
Content-Type: text/x-patch; name=patch-gs-typepunning
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=patch-gs-typepunning

--- ./src/ttfmain.c.orig	Mon Jun 11 19:53:06 2007
+++ ./src/ttfmain.c	Mon Jun 11 19:53:09 2007
@@ -141,19 +141,23 @@
 int ttfInterpreter__obtain(ttfMemory *mem, ttfInterpreter **ptti)
 {
     ttfInterpreter *tti;
+    void * temp_var;
 
     if (*ptti) {
 	(*ptti)->lock++;
 	return 0;
     }
-    tti = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)&st_ttfInterpreter, "ttfInterpreter__obtain");
+
+    temp_var = &st_ttfInterpreter;
+    tti = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)temp_var, "ttfInterpreter__obtain");
     if (!tti)
 	return fMemoryError;
     tti->usage = 0;
     tti->usage_size = 0;
     tti->ttf_memory = mem;
     tti->lock = 1;
-    tti->exec = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)&st_TExecution_Context, "ttfInterpreter__obtain");
+    temp_var = &st_TExecution_Context;
+    tti->exec = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)temp_var, "ttfInterpreter__obtain");
     if (!tti->exec) {
 	mem->free(mem, tti, "ttfInterpreter__obtain");
 	return fMemoryError;
@@ -225,6 +229,7 @@
     TT_Instance I;
     ttfMemory *mem = tti->ttf_memory;
     F26Dot6 ww, hh;
+    void *temp_var;
 
     this->tti = tti;
     this->design_grid = design_grid;
@@ -297,7 +302,8 @@
 	    return fMemoryError;
 	tti->usage_size = this->nMaxComponents * MAX_SUBGLYPH_NESTING;
     }
-    this->face = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)&st_TFace, "ttfFont__Open");
+    temp_var = &st_TFace;
+    this->face = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)temp_var, "ttfFont__Open");
     if (this->face == NULL)
 	return fMemoryError;
     memset(this->face, 0, sizeof(*this->face));
@@ -310,7 +316,8 @@
     code = r->Error(r);
     if (code < 0)
 	return fBadFontData;
-    this->inst = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)&st_TInstance, "ttfFont__Open");
+    temp_var = &st_TInstance;
+    this->inst = mem->alloc_struct(mem, (const ttfMemoryDescriptor *)temp_var, "ttfFont__Open");
     if (this->inst == NULL)
 	return fMemoryError;
     memset(this->inst, 0, sizeof(*this->inst));
--- ./src/gdevpdfd.c.orig	Mon Jun 11 19:53:18 2007
+++ ./src/gdevpdfd.c	Mon Jun 11 19:53:54 2007
@@ -833,6 +833,7 @@
 	gs_id id = gs_next_ids(cvd->mdev.memory, 1);
 	cos_value_t v;
 	const pdf_resource_t *pres;
+        void *temp_var;
 
 	memset(&s, 0, sizeof(s));
 	s.ctm.xx = cvd->m.xx;
@@ -842,7 +843,8 @@
 	s.ctm.tx = cvd->m.tx;
 	s.ctm.ty = cvd->m.ty;
 	memset(&inst, 0, sizeof(inst));
-	inst.saved = (gs_state *)&s; /* HACK : will use s.ctm only. */
+        temp_var = &s;
+	inst.saved = (gs_state *)temp_var; /* HACK : will use s.ctm only. */
 	inst.template.PaintType = 1;
 	inst.template.TilingType = 1;
 	inst.template.BBox.p.x = inst.template.BBox.p.y = 0;
--- ./src/gdevpdfi.c.orig	Mon Jun 11 19:54:05 2007
+++ ./src/gdevpdfi.c	Mon Jun 11 19:58:52 2007
@@ -922,6 +922,7 @@
     cos_value_t v;
     const pdf_resource_t *pres;
     int code;
+    void *temp_var;
 
     memset(&s, 0, sizeof(s));
     s.ctm.xx = pmat->xx;
@@ -931,7 +932,8 @@
     s.ctm.tx = pmat->tx;
     s.ctm.ty = pmat->ty;
     memset(&inst, 0, sizeof(inst));
-    inst.saved = (gs_state *)&s; /* HACK : will use s.ctm only. */
+    temp_var = &s;
+    inst.saved = (gs_state *)temp_var; /* HACK : will use s.ctm only. */
     inst.template.PaintType = 1;
     inst.template.TilingType = 1;
     inst.template.BBox.p.x = inst.template.BBox.p.y = 0;
--- ./src/gdevplnx.c.orig	Mon Jun 11 19:59:11 2007
+++ ./src/gdevplnx.c	Mon Jun 11 20:02:41 2007
@@ -549,8 +549,8 @@
 
 	if (lop != lop_orig) {
 	    lopis = *pis;
-	    gs_set_logical_op((gs_state *)&lopis, lop);
 	    pis_draw = &lopis;
+	    gs_set_logical_op((gs_state *)pis_draw, lop);
 	}
 	return dev_proc(plane_dev, fill_path)
 	    (plane_dev, pis_draw, ppath, params, &dcolor, pcpath);
@@ -582,8 +582,8 @@
 
 	if (lop != lop_orig) {
 	    lopis = *pis;
-	    gs_set_logical_op((gs_state *)&lopis, lop);
 	    pis_draw = &lopis;
+	    gs_set_logical_op((gs_state *)pis_draw, lop);
 	}
 	return dev_proc(plane_dev, stroke_path)
 	    (plane_dev, pis_draw, ppath, params, &dcolor, pcpath);

--MP_+eRwfVrMvhuumfY5MPARDN6--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070611203500.6d0d4238>