diff options
author | IOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org> | 2018-09-30 20:47:03 +0200 |
---|---|---|
committer | IOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org> | 2018-09-30 20:47:03 +0200 |
commit | ec0462c8c150ed58fbe565b4dd8c6f7d7f532e91 (patch) | |
tree | 43bac57bac3efb5b7c91d47f894354bfb619f875 | |
parent | 44f41334fb2b0fdb4eaaf0ece9ef5ba18cfe8ac3 (diff) |
Added patch for 64bit-safe table-access
Closes: #792723
-rw-r--r-- | debian/patches/array64.patch | 190 | ||||
-rw-r--r-- | debian/patches/series | 1 |
2 files changed, 191 insertions, 0 deletions
diff --git a/debian/patches/array64.patch b/debian/patches/array64.patch new file mode 100644 index 0000000..e2cfb75 --- /dev/null +++ b/debian/patches/array64.patch @@ -0,0 +1,190 @@ +Description: 64bit safe array-access +Author: IOhannes m zmölnig +Forwarded: no +Last-Update: 2018-09-30 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- pd-maxlib.orig/arbran.c ++++ pd-maxlib/arbran.c +@@ -56,14 +56,14 @@ + t_garray *bx = x->x_bufx, *bp = x->x_bufp; + t_float a = 0; + t_int k = 0; +- t_float *tx, *tp; ++ t_word *tx, *tp; + int ix, ip; +- if (!garray_getfloatarray(bx, &ix, &tx)) ++ if (!garray_getfloatwords(bx, &ix, &tx)) + { + post("arbran: couldn't read from array!"); + return; + } +- if (!garray_getfloatarray(bp, &ip, &tp)) ++ if (!garray_getfloatwords(bp, &ip, &tp)) + { + post("arbran: couldn't read from array!"); + return; +@@ -71,11 +71,11 @@ + + for(k = 1; k < ix; k++) + { +- a += (tx[k]-tx[k-1])*(tp[k]+tp[k-1])/2.0; ++ a += (tx[k].w_float-tx[k-1].w_float)*(tp[k].w_float+tp[k-1].w_float)/2.0; + } + for(k = 0; k < ix; k++) + { +- tp[k] = tp[k]/a; ++ tp[k].w_float = tp[k].w_float/a; + } + garray_redraw(x->x_bufp); + } +@@ -85,14 +85,14 @@ + t_garray *bx = x->x_bufx, *bp = x->x_bufp; + t_float a, u, a0, slope, b, d, r; + t_int k = 0; +- t_float *tx, *tp; ++ t_word *tx, *tp; + int ix, ip; +- if (!garray_getfloatarray(bx, &ix, &tx)) ++ if (!garray_getfloatwords(bx, &ix, &tx)) + { + post("arbran: couldn't read from array!"); + return; + } +- if (!garray_getfloatarray(bp, &ip, &tp)) ++ if (!garray_getfloatwords(bp, &ip, &tp)) + { + post("arbran: couldn't read from array!"); + return; +@@ -103,20 +103,20 @@ + u = fran(); + while(u > a) + { +- a0 = (tx[k+1]-tx[k])*(tp[k+1]+tp[k])/2.0; ++ a0 = (tx[k+1].w_float-tx[k].w_float)*(tp[k+1].w_float+tp[k].w_float)/2.0; + a += a0; + k++; + } + k--; +- slope = (tp[k+1]-tp[k])/(tx[k+1]-tx[k]); ++ slope = (tp[k+1].w_float-tp[k].w_float)/(tx[k+1].w_float-tx[k].w_float); + if(slope == 0) + { +- r = (u-a+a0)/tp[k]+tx[k]; ++ r = (u-a+a0)/tp[k].w_float+tx[k].w_float; + } + else + { +- b=tp[k]/slope-tx[k]; +- d=b*b+tx[k]*tx[k]+2*b*tx[k]+2*(u-a+a0)/slope; ++ b=tp[k].w_float/slope-tx[k].w_float; ++ d=b*b+tx[k].w_float*tx[k].w_float+2*b*tx[k].w_float+2*(u-a+a0)/slope; + if(slope > 0) + r=-b+sqrt(d); + else +--- pd-maxlib.orig/score.c ++++ pd-maxlib/score.c +@@ -72,7 +72,7 @@ + + t_int velo = x->x_velo; /* get the velocity */ + t_garray *b = x->x_buf; /* make local copy of array */ +- float *tab; /* we'll store notes in here */ ++ t_word *tab; /* we'll store notes in here */ + int items; + int i, j, n, check; + +@@ -86,7 +86,7 @@ + x->x_error = 1; + goto output; + } +- if (!garray_getfloatarray(b, &items, &tab)) ++ if (!garray_getfloatwords(b, &items, &tab)) + { + post("score: couldn't read from array!"); + x->x_error = 1; +@@ -111,7 +111,7 @@ + for (i = x->x_index + 1; i < (x->x_index + x->x_skipindex + 1); i++) + { + // post("%d: %d -> %d", i, x->x_alloctable[n], (t_int)tab[i]); +- if(x->x_alloctable[n] == (t_int)tab[i]) ++ if(x->x_alloctable[n] == (int)tab[i].w_float) + { + if(i - x->x_index != 1) post("score: skipped %d notes!", i - x->x_index - 1); + x->x_alloctable[n] = -1; /* delete note, we've matched it! */ +@@ -127,7 +127,7 @@ + + for (j = 0; j < MAX_NOTES; j++) /* check with every note from our alloctable */ + { +- if (x->x_alloctable[check] == (t_int)tab[i]) /* this one would fit */ ++ if (x->x_alloctable[check] == (int)tab[i].w_float) /* this one would fit */ + { + /* check the time restrictions */ + if (clock_gettimesince(x->x_starttime[check]) < x->x_skiptime) +--- pd-maxlib.orig/subst.c ++++ pd-maxlib/subst.c +@@ -148,7 +148,7 @@ + t_atom newrow[MAXSIZE]; + t_garray *A = x->x_buf; + int npoints; +- t_float *vec; ++ t_word *vec; + + if(x->x_length <= 1) + { +@@ -224,7 +224,7 @@ + // write to array + if(x->x_array)if (!(A = (t_garray *)pd_findbyclass(x->x_array, garray_class))) + error("subst: %s: no such array", x->x_array->s_name); +- else if (!garray_getfloatarray(A, &npoints, &vec)) ++ else if (!garray_getfloatwords(A, &npoints, &vec)) + error("subst: %s: bad template ", x->x_array->s_name); + else + { +@@ -234,7 +234,7 @@ + { + while(npoints--) + { +- *vec++ = atom_getfloat(x->x_row + i); ++ vec[i].w_float = atom_getfloat(x->x_row + i); + i++; + } + } +@@ -243,10 +243,10 @@ + npoints -= l; + while (l--) + { +- *vec++ = atom_getfloat(x->x_row + i); ++ vec[i].w_float = atom_getfloat(x->x_row + i); + i++; + } +- while (npoints--) *vec++ = 0; ++ while (npoints--) { vec[i].w_float = 0; i++; } + } + garray_redraw(A); + } +@@ -298,7 +298,7 @@ + static void subst_load(t_subst *x, t_symbol *s) + { + t_garray *b; /* make local copy of array */ +- t_float *tab; /* the content itselfe */ ++ t_word *tab; /* the content itselfe */ + int items, i; + + if ((b = (t_garray *)pd_findbyclass(s, garray_class))) +@@ -310,14 +310,14 @@ + } + + // read from our array +- if (!garray_getfloatarray(b, &items, &tab)) ++ if (!garray_getfloatwords(b, &items, &tab)) + { + post("subst: couldn't read from array!"); + return; + } + for(i = 0; i < items; i++) + { +- SETFLOAT(x->x_row + i, tab[i]); // copy array into x->x_row ++ SETFLOAT(x->x_row + i, tab[i].w_float); // copy array into x->x_row + } + x->x_length = items; + post("subst: loaded %d values from array \"%s\"", items, s->s_name); diff --git a/debian/patches/series b/debian/patches/series index 1fc8df5..be00eab 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ force-pd_linux-as-extension fix-format.patch +array64.patch |