From patchwork Thu Mar 10 14:39:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: flite has naming conflicts with tslib Date: Thu, 10 Mar 2011 14:39:21 -0000 From: Tarjei Knapstad X-Patchwork-Id: 1231 Message-Id: To: openembedded-devel@lists.openembedded.org Just got a segfault when attempting to link my application with both tslib and flite. Turns out both have ts_open/ts_read/ts_close symbols and the touchscreen code ends up calling something totally unrelated in flite. Patch + updated recipe for flite-alsa-1.4 attached. Sincerely, --- Tarjei Knapstad diff -Naur flite-1.4-release-old/include/cst_tokenstream.h flite-1.4-release/include/cst_tokenstream.h --- flite-1.4-release-old/include/cst_tokenstream.h 2011-03-10 14:40:44.670064015 +0100 +++ flite-1.4-release/include/cst_tokenstream.h 2011-03-10 15:11:59.560722195 +0100 @@ -87,7 +87,7 @@ extern const cst_string * const cst_ts_default_singlecharsymbols; /* Public functions for tokenstream manipulation */ -cst_tokenstream *ts_open(const char *filename, +cst_tokenstream *tokenstream_open(const char *filename, const cst_string *whitespacesymbols, const cst_string *singlecharsymbols, const cst_string *prepunctsymbols, @@ -97,7 +97,7 @@ const cst_string *singlecharsymbols, const cst_string *prepunctsymbols, const cst_string *postpunctsymbols); -void ts_close(cst_tokenstream *ts); +void tokenstream_close(cst_tokenstream *ts); int ts_eof(cst_tokenstream *ts); const cst_string *ts_get(cst_tokenstream *ts); @@ -112,7 +112,7 @@ const cst_string *prepunctuation, const cst_string *postpunctuation); -int ts_read(void *buff, int size, int num, cst_tokenstream *ts); +int tokenstream_read(void *buff, int size, int num, cst_tokenstream *ts); int ts_set_stream_pos(cst_tokenstream *ts,int pos); int ts_get_stream_pos(cst_tokenstream *ts); diff -Naur flite-1.4-release-old/palm/arm_flite/arm_flite.c flite-1.4-release/palm/arm_flite/arm_flite.c --- flite-1.4-release-old/palm/arm_flite/arm_flite.c 2011-03-10 14:40:44.395064391 +0100 +++ flite-1.4-release/palm/arm_flite/arm_flite.c 2011-03-10 15:10:30.020839659 +0100 @@ -135,7 +135,7 @@ } } - ts_close(ts); + tokenstream_close(ts); return utt; } diff -Naur flite-1.4-release-old/src/hrg/cst_rel_io.c flite-1.4-release/src/hrg/cst_rel_io.c --- flite-1.4-release-old/src/hrg/cst_rel_io.c 2011-03-10 14:40:44.421064356 +0100 +++ flite-1.4-release/src/hrg/cst_rel_io.c 2011-03-10 15:10:30.204839419 +0100 @@ -49,7 +49,7 @@ cst_item *item; const char *token=0; - if ((fd = ts_open(filename,NULL,";","","")) == 0) + if ((fd = tokenstream_open(filename,NULL,";","","")) == 0) { cst_errmsg("relation_load: can't open file \"%s\" for reading\n", filename); @@ -66,7 +66,7 @@ { cst_errmsg("relation_load: no end of header marker in \"%s\"\n", filename); - ts_close(fd); + tokenstream_close(fd); return CST_ERROR_FORMAT; } @@ -82,7 +82,7 @@ item_set_string(item,"name",token); } - ts_close(fd); + tokenstream_close(fd); return CST_OK_FORMAT; } diff -Naur flite-1.4-release-old/src/lexicon/cst_lexicon.c flite-1.4-release/src/lexicon/cst_lexicon.c --- flite-1.4-release-old/src/lexicon/cst_lexicon.c 2011-03-10 14:40:44.504064241 +0100 +++ flite-1.4-release/src/lexicon/cst_lexicon.c 2011-03-10 15:10:30.154839484 +0100 @@ -80,7 +80,7 @@ cst_val *na = NULL; int i; - lf = ts_open(lexfile,"\n","","",""); + lf = tokenstream_open(lexfile,"\n","","",""); if (lf == NULL) { cst_errmsg("lex_add_addenda: cannot open lexicon file\n"); @@ -107,7 +107,7 @@ continue; /* a blank line */ } - ts_close(lf); + tokenstream_close(lf); return val_reverse(na); } @@ -129,7 +129,7 @@ w = ts_get(e); if (w[0] == '"') /* it was a quoted entry */ { /* so reparse it */ - ts_close(e); + tokenstream_close(e); e = ts_open_string(entry, cst_ts_default_whitespacesymbols, "","",""); @@ -147,7 +147,7 @@ cst_fprintf(stdout,"add_addenda: lex %s: expected \":\" in %s\n", lex->name, word); - cst_free(word); cst_free(pos); ts_close(e); + cst_free(word); cst_free(pos); tokenstream_close(e); return NULL; } } @@ -177,7 +177,7 @@ ventry = cons_val(string_val(word),cons_val(string_val(pos), val_reverse(phones))); - cst_free(word); cst_free(pos); ts_close(e); + cst_free(word); cst_free(pos); tokenstream_close(e); #if 0 printf("entry: "); val_print(stdout,ventry); diff -Naur flite-1.4-release-old/src/speech/cst_track_io.c flite-1.4-release/src/speech/cst_track_io.c --- flite-1.4-release-old/src/speech/cst_track_io.c 2011-03-10 14:40:44.421064356 +0100 +++ flite-1.4-release/src/speech/cst_track_io.c 2011-03-10 15:10:30.471839068 +0100 @@ -161,7 +161,7 @@ num_frames=0; num_channels=0; - ts = ts_open(filename,NULL,NULL,NULL,NULL); + ts = tokenstream_open(filename,NULL,NULL,NULL,NULL); if (ts == NULL) { cst_errmsg("cst_track_load: can't open file \"%s\"\n", @@ -173,13 +173,13 @@ { cst_errmsg("cst_track_load: not an EST file \"%s\"\n", filename); - ts_close(ts); return -1; + tokenstream_close(ts); return -1; } if (!cst_streq(ts_get(ts),"Track")) { cst_errmsg("cst_track_load: not an track file \"%s\"\n", filename); - ts_close(ts); return -1; + tokenstream_close(ts); return -1; } while (!cst_streq("EST_Header_End",(tok=ts_get(ts)))) @@ -199,7 +199,7 @@ { cst_errmsg("cst_track_load: don't know how to deal " "with type \"%s\"\n", tok); - ts_close(ts); + tokenstream_close(ts); return -1; } } @@ -219,7 +219,7 @@ { cst_errmsg("cst_track_load: EOF in header \"%s\"\n", filename); - ts_close(ts); return -1; + tokenstream_close(ts); return -1; } } @@ -233,7 +233,7 @@ rv = load_frame_binary(t, i, ts, swap); if (rv < 0) { - ts_close(ts); + tokenstream_close(ts); cst_errmsg("cst_track_load: EOF in data \"%s\"\n", filename); return rv; @@ -245,10 +245,10 @@ { cst_errmsg("cst_track_load: not EOF when expected \"%s\"\n", filename); - ts_close(ts); return -1; + tokenstream_close(ts); return -1; } - ts_close(ts); + tokenstream_close(ts); return 0; } diff -Naur flite-1.4-release-old/src/synth/cst_ssml.c flite-1.4-release/src/synth/cst_ssml.c --- flite-1.4-release-old/src/synth/cst_ssml.c 2011-03-10 14:40:44.487064265 +0100 +++ flite-1.4-release/src/synth/cst_ssml.c 2011-03-10 15:10:30.248839361 +0100 @@ -290,7 +290,7 @@ cst_wave *w; float d; - if ((ts = ts_open(filename, + if ((ts = tokenstream_open(filename, get_param_string(voice->features,"text_whitespace",NULL), get_param_string(voice->features,"text_singlecharsymbols",NULL), get_param_string(voice->features,"text_prepunctuation",NULL), @@ -320,7 +320,7 @@ d = flite_ssml_to_speech_ts(ts,voice,outtype); - ts_close(ts); + tokenstream_close(ts); return d; diff -Naur flite-1.4-release-old/src/synth/cst_synth.c flite-1.4-release/src/synth/cst_synth.c --- flite-1.4-release-old/src/synth/cst_synth.c 2011-03-10 14:40:44.487064265 +0100 +++ flite-1.4-release/src/synth/cst_synth.c 2011-03-10 15:10:30.288839308 +0100 @@ -200,7 +200,7 @@ } } - ts_close(fd); + tokenstream_close(fd); return u; } diff -Naur flite-1.4-release-old/src/synth/flite.c flite-1.4-release/src/synth/flite.c --- flite-1.4-release-old/src/synth/flite.c 2011-03-10 14:40:44.487064265 +0100 +++ flite-1.4-release/src/synth/flite.c 2011-03-10 15:10:30.524839000 +0100 @@ -161,7 +161,7 @@ cst_uttfunc utt_user_callback = 0; int fp; - if ((ts = ts_open(filename, + if ((ts = tokenstream_open(filename, get_param_string(voice->features,"text_whitespace",NULL), get_param_string(voice->features,"text_singlecharsymbols",NULL), get_param_string(voice->features,"text_prepunctuation",NULL), @@ -242,7 +242,7 @@ } delete_utterance(utt); - ts_close(ts); + tokenstream_close(ts); return durs; } diff -Naur flite-1.4-release-old/src/utils/cst_args.c flite-1.4-release/src/utils/cst_args.c --- flite-1.4-release-old/src/utils/cst_args.c 2011-03-10 14:40:44.420064357 +0100 +++ flite-1.4-release/src/utils/cst_args.c 2011-03-10 15:10:30.108839544 +0100 @@ -135,6 +135,6 @@ cst_free(op); } - ts_close(ts); + tokenstream_close(ts); } diff -Naur flite-1.4-release-old/src/utils/cst_tokenstream.c flite-1.4-release/src/utils/cst_tokenstream.c --- flite-1.4-release-old/src/utils/cst_tokenstream.c 2011-03-10 14:40:44.420064357 +0100 +++ flite-1.4-release/src/utils/cst_tokenstream.c 2011-03-10 15:11:59.491722286 +0100 @@ -138,7 +138,7 @@ cst_free(ts); } -cst_tokenstream *ts_open(const char *filename, +cst_tokenstream *tokenstream_open(const char *filename, const cst_string *whitespace, const cst_string *singlechars, const cst_string *prepunct, @@ -183,7 +183,7 @@ return ts; } -void ts_close(cst_tokenstream *ts) +void tokenstream_close(cst_tokenstream *ts) { if (ts->fd != NULL) { @@ -435,7 +435,7 @@ return ts->token; } -int ts_read(void *buff, int size, int num, cst_tokenstream *ts) +int tokenstream_read(void *buff, int size, int num, cst_tokenstream *ts) { /* people should complain about the speed here */ /* people will complain about EOF as end of file */ diff -Naur flite-1.4-release-old/testsuite/combine_waves_main.c flite-1.4-release/testsuite/combine_waves_main.c --- flite-1.4-release-old/testsuite/combine_waves_main.c 2011-03-10 14:40:44.670064015 +0100 +++ flite-1.4-release/testsuite/combine_waves_main.c 2011-03-10 15:10:30.058839610 +0100 @@ -55,7 +55,7 @@ const char *token; int i=0; - ts = ts_open(wavelistfile); + ts = tokenstream_open(wavelistfile); if (!ts) { fprintf(stderr,"combine_waves: can't open \"%s\"\n",wavelistfile); @@ -75,7 +75,7 @@ l = 0; } - ts_close(ts); + tokenstream_close(ts); return val_reverse(l); } diff -Naur flite-1.4-release-old/testsuite/token_test_main.c flite-1.4-release/testsuite/token_test_main.c --- flite-1.4-release-old/testsuite/token_test_main.c 2011-03-10 14:40:44.671064013 +0100 +++ flite-1.4-release/testsuite/token_test_main.c 2011-03-10 15:10:30.573838935 +0100 @@ -46,7 +46,7 @@ cst_tokenstream *fd; const char *token; - fd = ts_open("data.one"); + fd = tokenstream_open("data.one"); while (!ts_eof(fd)) { @@ -62,7 +62,7 @@ } - ts_close(fd); + tokenstream_close(fd); return 0; } diff -Naur flite-1.4-release-old/testsuite/utt_test_main.c flite-1.4-release/testsuite/utt_test_main.c --- flite-1.4-release-old/testsuite/utt_test_main.c 2011-03-10 14:40:44.671064013 +0100 +++ flite-1.4-release/testsuite/utt_test_main.c 2011-03-10 15:10:30.598838903 +0100 @@ -122,7 +122,7 @@ cst_item *item; cst_tokenstream *fd; - fd = ts_open(filename); + fd = tokenstream_open(filename); if (fd == 0) return 0; @@ -140,7 +140,7 @@ item_set_int(item,"line_number",fd->line_number); } - ts_close(fd); + tokenstream_close(fd); return 1; } diff -Naur flite-1.4-release-old/tools/flite_sort_main.c flite-1.4-release/tools/flite_sort_main.c --- flite-1.4-release-old/tools/flite_sort_main.c 2011-03-10 14:40:44.666064021 +0100 +++ flite-1.4-release/tools/flite_sort_main.c 2011-03-10 14:42:20.685932357 +0100 @@ -62,7 +62,7 @@ int s,i; const cst_val **ll; - ts = ts_open("-",NULL,"()","",""); + ts = tokenstream_open("-",NULL,"()","",""); f = NULL; s = 0;