ref: ef1bdbce6791e2bdc0a59993c7caa3276175694a
parent: c728e263d18ab49be4b4266a75a9ce25d931852b
author: cbagwell <cbagwell>
date: Tue Oct 2 21:38:32 EDT 2001
Fixed bug were private data wasn't 8-byte aligned but some platforms required it to be. Reverted back to declaring as double's.
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,10 @@
instead of reading in a large buffer.
o William Plant pointed out a bad pointer access in fade effect's
parsing of options.
+ o Ken pointed out a problem were private data was not 8-byte aligned
+ and causing crashes on most RISC CPU's. Fixed by going back to
+ old style of declaring private data as type "double" which usually
+ forces strictest alignment.
sox-12.17.2
-----------
--- a/src/st.h
+++ b/src/st.h
@@ -158,8 +158,13 @@
int st_errno; /* Failure error codes */
char st_errstr[256]; /* Extend Failure text */
st_format_t *h; /* format struct for this file */
- /* FIXME: I perfer void * or char * */
- char priv[ST_MAX_PRIVSIZE]; /* format's private data area */
+ /* The following is a portable trick to force the buffer to be
+ * aligned on an 8-byte bounder on platforms that are really picky
+ * about this. All pointer accesses to this data are always cast
+ * to a structure so it doesn't really matter what we do declare
+ * it as.
+ */
+ double priv[ST_MAX_PRIVSIZE/8]; /* format's private data area */
};
extern st_format_t st_formats[];
@@ -234,10 +239,13 @@
st_effect_t *h; /* effects driver */
LONG *obuf; /* output buffer */
LONG odone, olen; /* consumed, total length */
- /* FIXME: I perfer void * or char *
- * Why was this private area 8 times bigger then the soundstream one?
- * Someone forget to divide ST_MAX_PRIVSIZE by 8 ? */
- char priv[ST_MAX_PRIVSIZE*8]; /* private area for effect */
+ /* The following is a portable trick to force the buffer to be
+ * aligned on an 8-byte bounder on platforms that are really picky
+ * about this. All pointer accesses to this data are always cast
+ * to a structure so it doesn't really matter what we do declare
+ * it as.
+ */
+ double priv[ST_MAX_PRIVSIZE/8]; /* private area for effect */
};
extern st_effect_t st_effects[]; /* declared in handlers.c */