fixes for g++4

- avoid min/max macros, fstream impl gets confused
- explicit instantations must have template<> prepended
- can't declare ostream, use iosfwd
- friends do not a declaration make
This commit is contained in:
espie 2010-05-22 09:30:04 +00:00
parent f2a998c291
commit 3eae3e6638
11 changed files with 235 additions and 8 deletions

View File

@ -0,0 +1,33 @@
$OpenBSD: ogi-patch-festival_src_modules_OGIcommon_OGI_Macro_h,v 1.1 2010/05/22 09:30:04 espie Exp $
--- festival/src/modules/OGIcommon/OGI_Macro.h.orig Sat May 22 10:27:39 2010
+++ festival/src/modules/OGIcommon/OGI_Macro.h Sat May 22 10:40:48 2010
@@ -27,16 +27,10 @@
#define _V_ 1
#endif
-#ifndef min
-#define min(a,b) ((a) < (b) ? (a) : (b))
-#endif
+#include <algorithm>
+using std::min;
+using std::max;
-#ifndef max
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-
-
#ifndef OGI_MAXSHORT
#define OGI_MAXSHORT ((short) 32767)
#endif
@@ -49,7 +43,8 @@
#define OGI_MAXUSHORT ((unsigned short) 65535)
#endif
-#define clip(A) ((short) (max(min((A), OGI_MAXSHORT), OGI_MINSHORT)))
+#define clip(A) ((A) > OGI_MAXSHORT ? OGI_MAXSHORT : \
+ ((A) < OGI_MINSHORT ? OGI_MINSHORT : short(A)))
#define check_ov_ushort(A) if (A > OGI_MAXUSHORT){ cerr << __FILE__ << ": line " << __LINE__ << " overflow of ushort cast:" << A << endl; exit(-1);}

View File

@ -0,0 +1,21 @@
$OpenBSD: ogi-patch-festival_src_modules_OGIcommon_OGI_TimeWarp_cc,v 1.1 2010/05/22 09:30:04 espie Exp $
--- festival/src/modules/OGIcommon/OGI_TimeWarp.cc.orig Sat May 22 10:23:26 2010
+++ festival/src/modules/OGIcommon/OGI_TimeWarp.cc Sat May 22 10:24:53 2010
@@ -94,7 +94,7 @@ void OGI_TimeWarp::nonuniform_stretch(
if (modfactor < 0.0001)
EST_error("OGI_TimeWarp::nonuniform_stretch - illegal mod factor input\n");
- breakpt = max(min(breakpt, 0.9999), 0.0001);
+ breakpt = max(min(breakpt, 0.9999f), 0.0001f);
if (n > 1){
x0 = x.a(n-2);
@@ -117,7 +117,7 @@ void OGI_TimeWarp::nonuniform_stretch(
}
// make sure it is a legal warp
- targ = min(max(targ, y0 + 0.0001*(y1-y0)), y1-0.0001*(y1-y0));
+ targ = min(max(targ, float(y0 + 0.0001*(y1-y0))), float(y1-0.0001*(y1-y0)));
// insert a point into time warp function
insert_before(n-1, src, targ);

View File

@ -0,0 +1,12 @@
$OpenBSD: ogi-patch-festival_src_modules_OGIcommon_OGI_Wave_h,v 1.1 2010/05/22 09:30:04 espie Exp $
--- festival/src/modules/OGIcommon/OGI_Wave.h.orig Sat May 22 10:35:47 2010
+++ festival/src/modules/OGIcommon/OGI_Wave.h Sat May 22 10:36:47 2010
@@ -70,7 +70,7 @@ class OGI_Wave { (public)
for (k=0; k < Nv_in; k++){
if (fabs(v_in[k]) > (double) OGI_MAXSHORT){
clip = TRUE;
- buf[k+pNused] = (short) (max(min(v_in[k], OGI_MAXSHORT), OGI_MINSHORT));
+ buf[k+pNused] = clip(v_in[k]);
}
else
buf[k+pNused] = (short) v_in[k];

View File

@ -0,0 +1,24 @@
$OpenBSD: ogi-patch-festival_src_modules_OGIcommon_OGI_file_h,v 1.1 2010/05/22 09:30:04 espie Exp $
--- festival/src/modules/OGIcommon/OGI_file.h.orig Sat May 22 10:17:21 2010
+++ festival/src/modules/OGIcommon/OGI_file.h Sat May 22 10:19:20 2010
@@ -21,16 +21,13 @@
#define OGI_ALL -99
+#include <algorithm>
+using std::min;
+using std::max;
+
// note: sizeof(bool)=4 on MS VC++ 5.0 because they define it as int
// sizeof(bool)=1 in gcc (much more reasonable)
typedef char OGIbool;
-
-#ifndef min
-#define min(a,b) ((a) < (b) ? (a) : (b))
-#endif
-#ifndef max
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#endif
void save_OGI_label(const EST_FVector &y, const EST_StrList &names, const EST_String &filename, int N=OGI_ALL);

View File

@ -1,7 +1,7 @@
$OpenBSD: ogi-patch-festival_src_modules_OGIdbase_OGIdbUnits_cc,v 1.1 2004/08/11 23:08:24 jolan Exp $
--- festival/src/modules/OGIdbase/OGIdbUnits.cc.orig Mon Aug 9 04:28:45 2004
+++ festival/src/modules/OGIdbase/OGIdbUnits.cc Mon Aug 9 04:29:08 2004
@@ -194,7 +194,7 @@ void OGIdbUnits::load_file(EST_String &u
$OpenBSD: ogi-patch-festival_src_modules_OGIdbase_OGIdbUnits_cc,v 1.2 2010/05/22 09:30:04 espie Exp $
--- festival/src/modules/OGIdbase/OGIdbUnits.cc.orig Thu Sep 14 00:08:16 2000
+++ festival/src/modules/OGIdbase/OGIdbUnits.cc Sat May 22 10:10:46 2010
@@ -194,7 +194,7 @@ void OGIdbUnits::load_file(EST_String &unitdic_file, f
resize(Nunits_max);
for (i=0; (!ts.eof()) && (i<Nunits_max); ){
@ -10,3 +10,24 @@ $OpenBSD: ogi-patch-festival_src_modules_OGIdbase_OGIdbUnits_cc,v 1.1 2004/08/11
if ((line.length() > 0) && (line[0] != ';')){
EST_TokenStream ls;
ls.set_WhiteSpaceChars(" \t\n");
@@ -390,8 +390,10 @@ OGIbool *EST_TVector<OGIbool>::error_return = &error_r
// IVector *
//
static EST_IVector * const def_val_IVectVect = NULL;
+template<>
EST_IVector * const *EST_TVector<EST_IVector *>::def_val = &def_val_IVectVect;
static EST_IVector *error_return_IVectVect = NULL;
+template<>
EST_IVector * *EST_TVector<EST_IVector *>::error_return = &error_return_IVectVect;
@@ -399,7 +401,9 @@ EST_IVector * *EST_TVector<EST_IVector *>::error_retur
// StrVector *
//
static EST_StrVector * const def_val_StrVectVect = NULL;
+template<>
EST_StrVector * const *EST_TVector<EST_StrVector *>::def_val = &def_val_StrVectVect;
static EST_StrVector *error_return_StrVectVect = NULL;
+template<>
EST_StrVector * *EST_TVector<EST_StrVector *>::error_return = &error_return_StrVectVect;

View File

@ -1,7 +1,16 @@
$OpenBSD: ogi-patch-festival_src_modules_OGIdbase_OGIresLPC_db_cc,v 1.1 2004/08/11 23:08:24 jolan Exp $
--- festival/src/modules/OGIdbase/OGIresLPC_db.cc.orig Mon Aug 9 04:29:37 2004
+++ festival/src/modules/OGIdbase/OGIresLPC_db.cc Mon Aug 9 04:29:43 2004
@@ -453,7 +453,7 @@ void OGIresLPC_db::load_ungrp_gains(OGId
$OpenBSD: ogi-patch-festival_src_modules_OGIdbase_OGIresLPC_db_cc,v 1.2 2010/05/22 09:30:04 espie Exp $
--- festival/src/modules/OGIdbase/OGIresLPC_db.cc.orig Thu Sep 14 00:08:16 2000
+++ festival/src/modules/OGIdbase/OGIresLPC_db.cc Sat May 22 10:34:59 2010
@@ -345,7 +345,7 @@ void OGIresLPC_db::load_ungrp_lpc(int n, OGIdbase &db)
}
-#define chk_clip(A) if ((A) > (float) OGI_MAXSHORT) { clip = 1; A = min(OGI_MAXSHORT, max(-OGI_MAXSHORT, A));}
+#define chk_clip(A) if ((A) > double(OGI_MAXSHORT)) { clip = 1; A = min(double(OGI_MAXSHORT), max(double(-OGI_MAXSHORT), A));}
void OGIresLPC_db::modify_gain(int n){
if ((p_gainL[n]==1.0) && (p_gainR[n]==1.0))
@@ -453,7 +453,7 @@ void OGIresLPC_db::load_ungrp_gains(OGIdbase &db){
ts.set_PunctuationSymbols("");
for (i=0; (!ts.eof()) && (i<db.unitdic.Nunits());){
@ -10,3 +19,32 @@ $OpenBSD: ogi-patch-festival_src_modules_OGIdbase_OGIresLPC_db_cc,v 1.1 2004/08/
if ((line.length() > 0) && (line[0] != ';')){
EST_TokenStream ls;
@@ -578,22 +578,28 @@ template class EST_TVector<EST_Track *>;
//
template ostream& operator << (ostream &st, const EST_TVector<long> &v);
static long const def_val_long = -1;
+template<>
long const *EST_TVector<long>::def_val = &def_val_long;
static long error_return_long = -1;
+template<>
long *EST_TVector<long>::error_return = &error_return_long;
//
// Wave *
//
static EST_Wave * const def_val_WaveVect = NULL;
+template<>
EST_Wave * const *EST_TVector<EST_Wave *>::def_val = &def_val_WaveVect;
static EST_Wave *error_return_WaveVect = NULL;
+template<>
EST_Wave * *EST_TVector<EST_Wave *>::error_return = &error_return_WaveVect;
//
// Track *
//
static EST_Track * const def_val_TrackVect = NULL;
+template<>
EST_Track * const *EST_TVector<EST_Track *>::def_val = &def_val_TrackVect;
static EST_Track *error_return_TrackVect = NULL;
+template<>
EST_Track * *EST_TVector<EST_Track *>::error_return = &error_return_TrackVect;

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-festival_src_modules_MultiSyn_EST_JoinCostCache_h,v 1.1 2010/05/22 09:30:04 espie Exp $
--- festival/src/modules/MultiSyn/EST_JoinCostCache.h.orig Thu May 13 12:16:45 2010
+++ festival/src/modules/MultiSyn/EST_JoinCostCache.h Thu May 13 12:16:58 2010
@@ -60,7 +60,6 @@
#include "ling_class/EST_Item.h"
class EST_JoinCost;
-class ostream;
class EST_JoinCostCache {
public:

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-festival_src_modules_clunits_clunits_h,v 1.1 2010/05/22 09:30:04 espie Exp $
--- festival/src/modules/clunits/clunits.h.orig Thu May 13 12:12:42 2010
+++ festival/src/modules/clunits/clunits.h Thu May 13 12:13:05 2010
@@ -83,9 +83,9 @@ class CLDB {
CLfile *get_fileitem(const EST_String &name)
{ return (CLfile *)fileindex.lookup(name); }
void load_coefs_sig(EST_Item *unit);
- CLfile *CLDB::get_file_coefs_sig(const EST_String &fileid);
+ CLfile *get_file_coefs_sig(const EST_String &fileid);
void load_join_coefs(CLunit *unit);
- CLfile *CLDB::get_file_join_coefs(const EST_String &fileid);
+ CLfile *get_file_join_coefs(const EST_String &fileid);
};

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-speech_tools_include_EST_Chunk_h,v 1.1 2010/05/22 09:30:04 espie Exp $
--- speech_tools/include/EST_Chunk.h.orig Thu May 13 11:33:56 2010
+++ speech_tools/include/EST_Chunk.h Thu May 13 11:50:09 2010
@@ -103,6 +103,11 @@
/* */
/************************************************************************/
+class EST_ChunkPtr;
+extern EST_ChunkPtr chunk_allocate(int);
+extern EST_ChunkPtr chunk_allocate(int, const char *, int);
+extern EST_ChunkPtr chunk_allocate(int, const EST_ChunkPtr &, int, int);
+
class EST_Chunk {
public:
typedef unsigned short use_counter;

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-speech_tools_include_EST_String_h,v 1.1 2010/05/22 09:30:04 espie Exp $
--- speech_tools/include/EST_String.h.orig Thu May 13 11:35:04 2010
+++ speech_tools/include/EST_String.h Thu May 13 12:00:07 2010
@@ -75,5 +75,6 @@ extern "C" void abort(void);
*/
+extern void make_updatable(EST_ChunkPtr &, EST_Chunk::EST_chunk_size);
class EST_String {
/** For better libg++ compatibility.
@@ -644,7 +645,11 @@ class EST_String { (public)
int operator == (const char *a, const EST_String &b);
int operator == (const EST_String &a, const EST_String &b);
ostream &operator << (ostream &s, const EST_String &str);
+EST_String operator + (const EST_String &a, const EST_String &b);
+ /// Concatenate C String with EST_String
+EST_String operator + (const char *a, const EST_String &b);
+ /// Concatenate EST_String with C String
+EST_String operator + (const EST_String &a, const char *b);
#include "EST_Regex.h"
-
#endif

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-speech_tools_include_ling_class_EST_Item_h,v 1.1 2010/05/22 09:30:04 espie Exp $
--- speech_tools/include/ling_class/EST_Item.h.orig Thu May 13 11:37:38 2010
+++ speech_tools/include/ling_class/EST_Item.h Thu May 13 11:38:53 2010
@@ -79,6 +79,10 @@ use we envisage. Traversal of the items ....
*/
+class EST_Item;
+
+extern int same_item(const EST_Item *,const EST_Item *);
+
class EST_Item
{
private: