summaryrefslogtreecommitdiff
path: root/lang/vslisp/patches/patch-ad
blob: 430619be6d59affb5deb3161039fd72ede1b178d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
$NetBSD: patch-ad,v 1.1 2002/03/15 00:22:43 jmc Exp $

--- src/lc.c.orig	Fri Mar 15 00:16:37 2002
+++ src/lc.c	Fri Mar 15 00:16:49 2002
@@ -124,9 +124,11 @@
    return y; 
   }
   if(((l->f)>>1)==4) { /* DOUBLE */
+   double d;
    pos= *l2;y=pos;
    b[pos]=l->f;pos++;
-   *(double *)(b+pos)=GetDouble((ATOM)l);
+   d=GetDouble((ATOM)l);
+   memcpy(b+pos, &d, sizeof(double));
    pos+=sizeof(double);
    *l2=pos;
    ltab[ltabn].p=(uc *)l;ltab[ltabn].v=y;ltabn++;
@@ -155,10 +157,12 @@
  if((l->f)&1) { /* LIST */
  } else {
   if(((l->f)>>1)==4) {
+   double d;
    b[*l1]=3;(*l1)++;
    a=strlen(global.Symbols[n]->nm);b[*l1]=a; (*l1)++;
    memcpy(b+(*l1),global.Symbols[n]->nm,a);(*l1)+=a;
-   *(double *)(b+(*l1))=GetDouble((ATOM)l);(*l1)+=sizeof(double);
+   d=GetDouble((ATOM)l);
+   memcpy(b+(*l1), &d, sizeof(double));(*l1)+=sizeof(double);
    return 0;
   } else
   if(((l->f)>>1)==0) {
@@ -267,7 +271,12 @@
  }
  /* It's ATOM */
  if(((*b)>>1)==4) { /*DOUBLE*/
-  return (LIST)MakeDAtom(*((double *)(b+1)));
+  union dd {
+       char a[sizeof(double)];
+       double d;
+  } dd;
+  memcpy(&dd.a, b+1, sizeof(double));
+  return (LIST)MakeDAtom(dd.d);
  } else
  { /*STRING*/
   return (LIST)MakeAtom(b+1);
@@ -311,11 +320,16 @@
    l1+=1+l1[1]+4+ *((ui *)(l1+1+l1[1]+1))+1;
   } else
   if(*l1==3) {
+   union dd {
+        char a[sizeof(double)];
+        double d;
+   } dd;
+   memcpy(&dd.a, (l1+1+l1[1]+1), sizeof(double));
    memcpy(ss,l1+2,*(l1+1));
    ss[(int)l1[1]]=0;
    t1=mklist(NIL,mklist((LIST)MakeAtom(ss),
      mklist(mklist((LIST)MakeAtom("quote"),
-        mklist((LIST)MakeDAtom(*((double *)(l1+1+l1[1]+1))),
+        mklist((LIST)MakeDAtom(dd.d),
           NIL)),NIL)));
    t1->g=0;
    L_Setq(&global,t1);