[svn-commits] kpfleming: branch kpfleming/aligner2 r154425 - /team/kpfleming/aligner2/main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Nov 4 16:41:14 CST 2008


Author: kpfleming
Date: Tue Nov  4 16:41:13 2008
New Revision: 154425

URL: http://svn.digium.com/view/asterisk?view=rev&rev=154425
Log:
another attempt to make GCC on SPARC happy

Modified:
    team/kpfleming/aligner2/main/translate.c

Modified: team/kpfleming/aligner2/main/translate.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/aligner2/main/translate.c?view=diff&rev=154425&r1=154424&r2=154425
==============================================================================
--- team/kpfleming/aligner2/main/translate.c (original)
+++ team/kpfleming/aligner2/main/translate.c Tue Nov  4 16:41:13 2008
@@ -99,35 +99,37 @@
 static void *newpvt(struct ast_translator *t)
 {
 	struct ast_trans_pvt *pvt;
-	char *base;
 	unsigned char useplc = t->plc_samples > 0 && t->useplc;
 	struct template {
 		struct ast_trans_pvt pvt;
 		char desc[t->desc_size] AST_ALIGN_TO(uint32_t);
 		plc_state_t plc[useplc ? 1 : 0];
 		char friendly[AST_FRIENDLY_OFFSET] AST_ALIGN_TO(uint32_t);
-		char outbuf[t->buf_size] AST_ALIGN_TO(int16_t);
-	};
-
-	if (!(base = ast_calloc(sizeof(struct template), 1))) {
+		int16_t outbuf[t->buf_size / sizeof(int16_t)];
+	} *work;
+
+	if (!(work = ast_calloc(sizeof(*work), 1))) {
 		return NULL;
 	}
 
-	pvt = (struct ast_trans_pvt *) base;
+	pvt = &work->pvt;
 	pvt->t = t;
+
 	if (t->desc_size) {
-		pvt->pvt = base + offsetof(struct template, desc);
-	}
+		pvt->pvt = &work->desc;
+	}
+
 	if (useplc) {
-		pvt->plc = (plc_state_t *) (base + offsetof(struct template, plc));
-	}
+		pvt->plc = &work->plc[0];
+	}
+
 	if (t->buf_size) {
-		pvt->outbuf = (int16_t *) (base + offsetof(struct template, outbuf));
+		pvt->outbuf = &work->outbuf[0];
 	}
 
 	/* call local init routine, if present */
 	if (t->newpvt && t->newpvt(pvt)) {
-		free(base);
+		free(work);
 		return NULL;
 	}
 




More information about the svn-commits mailing list